From 103654b50567e674c2937a04a5b9638012f6bc0d Mon Sep 17 00:00:00 2001 From: Andi Skrgat Date: Mon, 22 Jul 2024 12:19:27 +0200 Subject: [PATCH] Add namespace.yaml to respect single stream per document --- .github/workflows/kubelint.yaml | 17 +++-------------- Makefile | 7 +++---- README.md | 6 +++--- config/manager/kustomization.yaml | 3 ++- config/manager/manager.yaml | 7 +------ config/manager/namespace.yaml | 4 ++++ config/samples/memgraph_v1_ha.yaml | 4 ++-- docs/installation.md | 16 +++++----------- helm-charts | 2 +- 9 files changed, 24 insertions(+), 42 deletions(-) create mode 100644 config/manager/namespace.yaml diff --git a/.github/workflows/kubelint.yaml b/.github/workflows/kubelint.yaml index ee6d3d7..cc12160 100644 --- a/.github/workflows/kubelint.yaml +++ b/.github/workflows/kubelint.yaml @@ -48,29 +48,18 @@ jobs: with: directory: config/manifests config: ${GITHUB_WORKSPACE}/.github/config_files/config_lint.yaml - version: $KUBELINTER_VERSION + version: $KUBELINTER_VERSION - name: Scan directory ./config/samples/ with kube-linter uses: stackrox/kube-linter-action@v1.0.3 with: directory: config/samples config: ${GITHUB_WORKSPACE}/.github/config_files/config_lint.yaml - version: $KUBELINTER_VERSION + version: $KUBELINTER_VERSION - name: Scan directory ./config/scorecard/ with kube-linter uses: stackrox/kube-linter-action@v1.0.3 with: directory: config/scorecard config: ${GITHUB_WORKSPACE}/.github/config_files/config_lint.yaml - version: $KUBELINTER_VERSION - - - - - - - - - - - + version: $KUBELINTER_VERSION diff --git a/Makefile b/Makefile index 88164d4..219db0a 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 0.0.2 +VERSION ?= 0.0.3 # CHANNELS define the bundle channels used in the bundle. # Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") @@ -28,7 +28,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) # This variable is used to construct full image tags for bundle and catalog images. # # For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both -u my.domain/kubernetes-operator-bundle:$VERSION and my.domain/kubernetes-operator-catalog:$VERSION. +# my.domain/kubernetes-operator-bundle:$VERSION and my.domain/kubernetes-operator-catalog:$VERSION. IMAGE_TAG_BASE ?= memgraph/kubernetes-operator # BUNDLE_IMG defines the image:tag used for the bundle. @@ -232,7 +232,6 @@ HELMIFY ?= helmify helmify: $(HELMIFY) ## Download helmify locally if necessary. $(HELMIFY): $(LOCALBIN) test -s $(LOCALBIN)/helmify || GOBIN=$(LOCALBIN) go install github.com/arttor/helmify/cmd/helmify@latest - + helm: config/manifests kustomize helmify $(KUSTOMIZE) build config/default | $(HELMIFY) - diff --git a/README.md b/README.md index 7320903..4e63d94 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Introduction Memgraph Kubernetes Operator is WIP. You can currently install the operator and manage the deployment of Memgraph's High Availability cluster -through it. +through it. ## Table of Contents @@ -13,8 +13,8 @@ through it. ## Prerequisites -We use Go version 1.22.5 (not needed at the moment). Check out here how to [install Go](https://go.dev/doc/install). -The current Helm version is v3.14.4. +We use Go version 1.22.5 (not needed at the moment). Check out here how to [install Go](https://go.dev/doc/install). +The current Helm version used is v3.14.4. ## Documentation diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 1fe9778..c774522 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -1,8 +1,9 @@ resources: +- namespace.yaml - manager.yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: memgraph-kubernetes-operator newName: memgraph/kubernetes-operator - newTag: 0.0.2 + newTag: 0.0.3 diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 49c81a8..0c3aa93 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -1,8 +1,3 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: memgraph-operator-system ---- apiVersion: apps/v1 kind: Deployment metadata: @@ -30,7 +25,7 @@ spec: runAsNonRoot: true containers: - args: - image: memgraph/kubernetes-operator:0.0.2 + image: memgraph/kubernetes-operator:0.0.3 # TODO: (andi) Try to specify this in a single place, currently used by kustomization.yaml and Makefile name: manager securityContext: readOnlyRootFilesystem: true diff --git a/config/manager/namespace.yaml b/config/manager/namespace.yaml new file mode 100644 index 0000000..64458ee --- /dev/null +++ b/config/manager/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: memgraph-operator-system diff --git a/config/samples/memgraph_v1_ha.yaml b/config/samples/memgraph_v1_ha.yaml index 3730dcb..d03e35a 100644 --- a/config/samples/memgraph_v1_ha.yaml +++ b/config/samples/memgraph_v1_ha.yaml @@ -90,7 +90,7 @@ spec: coordinators: volumeClaim: logPVCClassName: "" - logPVC: false # TODO: (andi) Fix + logPVC: true logPVCSize: 256Mi storagePVCClassName: "" storagePVC: true @@ -102,7 +102,7 @@ spec: image: pullPolicy: IfNotPresent repository: memgraph/memgraph - tag: 2.18.0_27_0b62e6a73 + tag: 2.18.0 probes: liveness: initialDelaySeconds: 30 diff --git a/docs/installation.md b/docs/installation.md index 51a826d..bec8eac 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -2,7 +2,6 @@ All described installation options will run the Operator inside the cluster. -## Option I: Install using Makefile Make sure to clone this repository with its submodule (helm-charts). @@ -10,20 +9,14 @@ Make sure to clone this repository with its submodule (helm-charts). git clone --recurse-submodules git@github.com:memgraph/kubernetes-operator.git ``` -After this you can start your operator with a single command: +## Install K8 resources ```bash -make deploy +kubectl apply -k config/default ``` This command will use operator's image from Memgraph's DockerHub and create all necessary Kubernetes resources for running an operator. -## Option II: Install using kubectl - -```bash -kubectl apply -k config/default -``` - ## Verify installation Installation using any of options described above will cause creating Kubernetes ServiceAccount, RoleBinding, Role, Deployment and Pods all in newly created all in newly created all in newly created @@ -54,7 +47,7 @@ export MEMGRAPH_ORGANIZATION_NAME="" export MEMGRAPH_ENTERPRISE_LICENSE="" ``` -Start Memgraph HA cluster with `envsubst < config/samples/memgraph_v1_ha.yaml | kubectl apply -f -`. (The `envsubst command` is a part of the gettext package.) +Start Memgraph HA cluster with `envsubst < config/samples/memgraph_v1_ha.yaml | kubectl apply -f -`. (The `envsubst command` is a part of the `gettext` package.) Instead of using `envsubst` command, you can directly set environment variables in `config/samples/memgraph_v1_ha.yaml`. @@ -70,5 +63,6 @@ You can now find URL of any coordinator instances by running e.g `minikube servi ```bash kubectl delete -f config/samples/memgraph_v1_ha.yaml -make undeploy / or kubectl delete -k config/default +kubectl delete pvc --all # Or leave them if you want to use persistent storage +kubectl delete -k config/default ``` diff --git a/helm-charts b/helm-charts index b26beec..3fecad8 160000 --- a/helm-charts +++ b/helm-charts @@ -1 +1 @@ -Subproject commit b26beec07e7b8856de3049ffb4e4294854293cbf +Subproject commit 3fecad84b3c3fecd9c2ef19b942f4fc4065ce6f6