Skip to content

Commit

Permalink
Sanitize Kustomizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles-Garnsey authored Sep 22, 2021
1 parent 71e4c2c commit 0f64832
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ build
*.swo
*~
clientconfig
.vscode/
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions aux-config/control_plane/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- ../default
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resources:
- github.com/k8ssandra/k8ssandra-operator/config/default?ref=main
- ../default

patchesJson6902:
- patch: |-
Expand All @@ -10,8 +10,4 @@ patchesJson6902:
group: apps
kind: Deployment
name: k8ssandra-operator
version: v1

images:
- name: k8ssandra/k8ssandra-operator
newTag: latest
version: v1
4 changes: 4 additions & 0 deletions aux-config/default/cass-operator/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions aux-config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- ./cass-operator
- ../../config/default
2 changes: 0 additions & 2 deletions config/cass-operator-crd/kustomization.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions config/cass-operator/kustomization.yaml

This file was deleted.

1 change: 0 additions & 1 deletion config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace: default
# -

resources:
- ../cass-operator
- ../crd
- ../rbac
- ../manager
Expand Down
37 changes: 37 additions & 0 deletions docs/install/kustomize-structure.md
Original file line number Diff line number Diff line change
@@ -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│
└───────┘ └───────┘ └───────┘
```
6 changes: 0 additions & 6 deletions scripts/control_plane/kustomization.yaml

This file was deleted.

0 comments on commit 0f64832

Please sign in to comment.