From 0f648321354a113c91205dea3af551e5274b854f Mon Sep 17 00:00:00 2001 From: Miles Garnsey <11435896+Miles-Garnsey@users.noreply.github.com> Date: Wed, 22 Sep 2021 22:09:30 +1000 Subject: [PATCH] Sanitize Kustomizations --- .gitignore | 1 + Makefile | 6 +-- aux-config/control_plane/kustomization.yaml | 2 + .../data_plane/kustomization.yaml | 8 +--- .../default/cass-operator/kustomization.yaml | 4 ++ aux-config/default/kustomization.yaml | 3 ++ config/cass-operator-crd/kustomization.yaml | 2 - config/cass-operator/kustomization.yaml | 5 --- config/default/kustomization.yaml | 1 - docs/install/kustomize-structure.md | 37 +++++++++++++++++++ scripts/control_plane/kustomization.yaml | 6 --- 11 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 aux-config/control_plane/kustomization.yaml rename {scripts => aux-config}/data_plane/kustomization.yaml (59%) create mode 100644 aux-config/default/cass-operator/kustomization.yaml create mode 100644 aux-config/default/kustomization.yaml delete mode 100644 config/cass-operator-crd/kustomization.yaml delete mode 100644 config/cass-operator/kustomization.yaml create mode 100644 docs/install/kustomize-structure.md delete mode 100644 scripts/control_plane/kustomization.yaml diff --git a/.gitignore b/.gitignore index 44375861e..96f7d6d1b 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ build *.swo *~ clientconfig +.vscode/ \ No newline at end of file diff --git a/Makefile b/Makefile index e5875899c..fc97f7f0a 100644 --- a/Makefile +++ b/Makefile @@ -137,15 +137,15 @@ endif kind-e2e-test: build kustomize docker-build create-kind-multicluster kind-load-image-multi e2e-test single-up: build kustomize docker-build create-kind-cluster kind-load-image cert-manager - $(KUSTOMIZE) build scripts/control_plane | kubectl apply -f - + $(KUSTOMIZE) build aux-config/control_plane | kubectl apply -f - multi-up: build kustomize docker-build create-kind-multicluster kind-load-image-multi cert-manager-multi ## install the control plane kubectl config use-context kind-k8ssandra-0 - $(KUSTOMIZE) build scripts/control_plane | kubectl apply -f - + $(KUSTOMIZE) build aux-config/control_plane | kubectl apply -f - ## install the data plane kubectl config use-context kind-k8ssandra-1 - $(KUSTOMIZE) build scripts/data_plane | kubectl apply -f - + $(KUSTOMIZE) build aux-config/data_plane | kubectl apply -f - ## Create a client config make create-client-config ## Restart the control plane diff --git a/aux-config/control_plane/kustomization.yaml b/aux-config/control_plane/kustomization.yaml new file mode 100644 index 000000000..caa4acd7f --- /dev/null +++ b/aux-config/control_plane/kustomization.yaml @@ -0,0 +1,2 @@ +resources: +- ../default \ No newline at end of file diff --git a/scripts/data_plane/kustomization.yaml b/aux-config/data_plane/kustomization.yaml similarity index 59% rename from scripts/data_plane/kustomization.yaml rename to aux-config/data_plane/kustomization.yaml index e230907db..1420811bb 100644 --- a/scripts/data_plane/kustomization.yaml +++ b/aux-config/data_plane/kustomization.yaml @@ -1,5 +1,5 @@ resources: -- github.com/k8ssandra/k8ssandra-operator/config/default?ref=main +- ../default patchesJson6902: - patch: |- @@ -10,8 +10,4 @@ patchesJson6902: group: apps kind: Deployment name: k8ssandra-operator - version: v1 - -images: -- name: k8ssandra/k8ssandra-operator - newTag: latest + version: v1 \ No newline at end of file diff --git a/aux-config/default/cass-operator/kustomization.yaml b/aux-config/default/cass-operator/kustomization.yaml new file mode 100644 index 000000000..719637597 --- /dev/null +++ b/aux-config/default/cass-operator/kustomization.yaml @@ -0,0 +1,4 @@ +namespace: default +resources: +- github.com/k8ssandra/cass-operator/config/default?ref=v1.8.0-rc.1 +# namePrefix: cass-operator- # Can be removed in this case because cass-operator already has a namePrefix defined in the repo. \ No newline at end of file diff --git a/aux-config/default/kustomization.yaml b/aux-config/default/kustomization.yaml new file mode 100644 index 000000000..7717720e9 --- /dev/null +++ b/aux-config/default/kustomization.yaml @@ -0,0 +1,3 @@ +resources: +- ./cass-operator +- ../../config/default \ No newline at end of file diff --git a/config/cass-operator-crd/kustomization.yaml b/config/cass-operator-crd/kustomization.yaml deleted file mode 100644 index 50b8762da..000000000 --- a/config/cass-operator-crd/kustomization.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resources: - - github.com/k8ssandra/cass-operator/config/crd?ref=v1.8.0-rc.1 \ No newline at end of file diff --git a/config/cass-operator/kustomization.yaml b/config/cass-operator/kustomization.yaml deleted file mode 100644 index 49ec7fb12..000000000 --- a/config/cass-operator/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -namespace: default - -resources: -- github.com/k8ssandra/cass-operator/config/default?ref=v1.8.0-rc.1 - diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 995f72c1b..37f5f652a 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -17,7 +17,6 @@ namespace: default # - resources: -- ../cass-operator - ../crd - ../rbac - ../manager diff --git a/docs/install/kustomize-structure.md b/docs/install/kustomize-structure.md new file mode 100644 index 000000000..c7a5b1d3a --- /dev/null +++ b/docs/install/kustomize-structure.md @@ -0,0 +1,37 @@ +# About the kustomization structure + +The kustomization directories are slightly more complex than the average operator due to the dependancy on `cass-operator`. We deploy `cass-operator` using the manifests from Github to ensure that we remain up to date. + +## Objectives + +We want to achieve the following: + +1. Minimal modifications to the `config/` directory initially created by `operator-sdk`. +2. All remote operator manifests are pulled from their home GH repositories, not kept locally. +3. All local operator manifests come directly from `config/`. + +## Design + +The kustomization directories are as follows. Any kustomizations not generated by `operator-sdk` are stored in `aux-config/` rather than the templated `config/` directory. This is where we deploy k8ssandra-operator from when we want to include all its dependancies. + +``` + ┌──────────────┐ ┌───────────────┐ + │ control_plane│ │ cass-operator │ + └─────────────┬┘ └──────▲────────┘ + │ │ + │ ┌───────┐ │ + └──────────►default├──────┤ + └───▲───┘ │ + ┌─────────────┐ │ │ + │ data_plane ├─────────────┘ │ + └─────────────┘ │ + │ + ┌───────────▼─────────────────────┐ + │k8ssandra-operator/config/default│ + └────┬───────────┬────────────┬───┘ + │ │ │ + │ │ │ + ┌───▼───┐ ┌───▼───┐ ┌────▼──┐ + │ rbac │ │ crd │ │manager│ + └───────┘ └───────┘ └───────┘ +``` \ No newline at end of file diff --git a/scripts/control_plane/kustomization.yaml b/scripts/control_plane/kustomization.yaml deleted file mode 100644 index ecada5372..000000000 --- a/scripts/control_plane/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -resources: -- github.com/k8ssandra/k8ssandra-operator/config/default?ref=main - -images: -- name: k8ssandra/k8ssandra-operator - newTag: latest \ No newline at end of file