From 3d4817aabc23d467bd118eed24064a2e6217d5a3 Mon Sep 17 00:00:00 2001 From: Paul Martin Date: Thu, 12 Dec 2019 11:36:08 +0000 Subject: [PATCH 1/2] Added kustomization-patch and kustomization-patch-complex examples to test the KustomizationPatch prototype. --- kustomize-patch-complex/base/deployment.yaml | 27 +++++++++++++++++ .../base/kustomization.yaml | 7 +++++ .../overlays/ci/kustomization.yaml | 7 +++++ .../overlays/demo-canary/kustomization.yaml | 6 ++++ .../overlays/demo/kustomization.yaml | 9 ++++++ .../overlays/prod-canary/kustomization.yaml | 6 ++++ .../overlays/prod/kustomization.yaml | 8 +++++ .../patches/app-ingress/app-ingress.yaml | 13 ++++++++ .../patches/app-ingress/kustomization.yaml | 4 +++ .../patches/canary/kustomization.yaml | 30 +++++++++++++++++++ .../patches/ingress-vars/kustomization.yaml | 14 +++++++++ .../ingress-vars/kustomize-configuration.yaml | 4 +++ .../patches/stub-ingress/kustomization.yaml | 5 ++++ .../stub-ingress/kustomize-configuration.yaml | 4 +++ .../patches/stub-ingress/stub-ingress.yaml | 13 ++++++++ .../patches/stub/kustomization.yaml | 12 ++++++++ .../patches/stub/stub-deployment.yaml | 10 +++++++ .../patches/stub/stub-service.yaml | 12 ++++++++ kustomize-patch/base/deployment.yaml | 10 +++++++ kustomize-patch/base/kustomization.yaml | 9 ++++++ .../overlays/aggregate/kustomization.yaml | 4 +++ .../patches/patch1/kustomization.yaml | 11 +++++++ .../patches/patch1/patches/patch.yaml | 6 ++++ .../patches/patch2/kustomization.yaml | 11 +++++++ .../patches/patch2/patches/patch.yaml | 9 ++++++ 25 files changed, 251 insertions(+) create mode 100644 kustomize-patch-complex/base/deployment.yaml create mode 100644 kustomize-patch-complex/base/kustomization.yaml create mode 100644 kustomize-patch-complex/overlays/ci/kustomization.yaml create mode 100644 kustomize-patch-complex/overlays/demo-canary/kustomization.yaml create mode 100644 kustomize-patch-complex/overlays/demo/kustomization.yaml create mode 100644 kustomize-patch-complex/overlays/prod-canary/kustomization.yaml create mode 100644 kustomize-patch-complex/overlays/prod/kustomization.yaml create mode 100644 kustomize-patch-complex/patches/app-ingress/app-ingress.yaml create mode 100644 kustomize-patch-complex/patches/app-ingress/kustomization.yaml create mode 100644 kustomize-patch-complex/patches/canary/kustomization.yaml create mode 100644 kustomize-patch-complex/patches/ingress-vars/kustomization.yaml create mode 100644 kustomize-patch-complex/patches/ingress-vars/kustomize-configuration.yaml create mode 100644 kustomize-patch-complex/patches/stub-ingress/kustomization.yaml create mode 100644 kustomize-patch-complex/patches/stub-ingress/kustomize-configuration.yaml create mode 100644 kustomize-patch-complex/patches/stub-ingress/stub-ingress.yaml create mode 100644 kustomize-patch-complex/patches/stub/kustomization.yaml create mode 100644 kustomize-patch-complex/patches/stub/stub-deployment.yaml create mode 100644 kustomize-patch-complex/patches/stub/stub-service.yaml create mode 100644 kustomize-patch/base/deployment.yaml create mode 100644 kustomize-patch/base/kustomization.yaml create mode 100644 kustomize-patch/overlays/aggregate/kustomization.yaml create mode 100644 kustomize-patch/patches/patch1/kustomization.yaml create mode 100644 kustomize-patch/patches/patch1/patches/patch.yaml create mode 100644 kustomize-patch/patches/patch2/kustomization.yaml create mode 100644 kustomize-patch/patches/patch2/patches/patch.yaml diff --git a/kustomize-patch-complex/base/deployment.yaml b/kustomize-patch-complex/base/deployment.yaml new file mode 100644 index 0000000..e7935b5 --- /dev/null +++ b/kustomize-patch-complex/base/deployment.yaml @@ -0,0 +1,27 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app + labels: + role: app + # Track distinguishes between normal 'stable' deployment and 'canary' deployment. + # https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#canary-deployments + track: stable +spec: + replicas: 2 + selector: + matchLabels: + role: app + track: stable + template: + metadata: + labels: + role: app + track: stable + spec: + containers: + - name: app + image: nginx:latest + envFrom: + - configMapRef: + name: app diff --git a/kustomize-patch-complex/base/kustomization.yaml b/kustomize-patch-complex/base/kustomization.yaml new file mode 100644 index 0000000..32c14f5 --- /dev/null +++ b/kustomize-patch-complex/base/kustomization.yaml @@ -0,0 +1,7 @@ +resources: + - deployment.yaml + +configMapGenerator: + - name: app + literals: + - downstreamServiceUrl=http://www.google.com \ No newline at end of file diff --git a/kustomize-patch-complex/overlays/ci/kustomization.yaml b/kustomize-patch-complex/overlays/ci/kustomization.yaml new file mode 100644 index 0000000..2c3aad6 --- /dev/null +++ b/kustomize-patch-complex/overlays/ci/kustomization.yaml @@ -0,0 +1,7 @@ +# ci environment needs a stub server but no ingresses (only accessible internally) +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../base + - ../../patches/stub +namespace: ci diff --git a/kustomize-patch-complex/overlays/demo-canary/kustomization.yaml b/kustomize-patch-complex/overlays/demo-canary/kustomization.yaml new file mode 100644 index 0000000..ded9125 --- /dev/null +++ b/kustomize-patch-complex/overlays/demo-canary/kustomization.yaml @@ -0,0 +1,6 @@ +# demo-canary environment is the same as demo, but configured for the canary deployment +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../demo + - ../../patches/canary diff --git a/kustomize-patch-complex/overlays/demo/kustomization.yaml b/kustomize-patch-complex/overlays/demo/kustomization.yaml new file mode 100644 index 0000000..220d229 --- /dev/null +++ b/kustomize-patch-complex/overlays/demo/kustomization.yaml @@ -0,0 +1,9 @@ +# demo environment needs a stub server and ingresses for app and stub +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../base + - ../../patches/ingress-vars + - ../../patches/stub-ingress + - ../../patches/app-ingress +namespace: demo \ No newline at end of file diff --git a/kustomize-patch-complex/overlays/prod-canary/kustomization.yaml b/kustomize-patch-complex/overlays/prod-canary/kustomization.yaml new file mode 100644 index 0000000..8bd24dd --- /dev/null +++ b/kustomize-patch-complex/overlays/prod-canary/kustomization.yaml @@ -0,0 +1,6 @@ +# prod-canary environment is the same as prod, but configured for the canary deployment +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../prod + - ../../patches/canary diff --git a/kustomize-patch-complex/overlays/prod/kustomization.yaml b/kustomize-patch-complex/overlays/prod/kustomization.yaml new file mode 100644 index 0000000..eb56769 --- /dev/null +++ b/kustomize-patch-complex/overlays/prod/kustomization.yaml @@ -0,0 +1,8 @@ +# prod environment needs an app ingress and no stub +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../base + - ../../patches/ingress-vars + - ../../patches/app-ingress +namespace: prod \ No newline at end of file diff --git a/kustomize-patch-complex/patches/app-ingress/app-ingress.yaml b/kustomize-patch-complex/patches/app-ingress/app-ingress.yaml new file mode 100644 index 0000000..8c3987d --- /dev/null +++ b/kustomize-patch-complex/patches/app-ingress/app-ingress.yaml @@ -0,0 +1,13 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: app +spec: + rules: + - host: app.$(NAMESPACE).tld + http: + paths: + - path: + backend: + serviceName: app + servicePort: http diff --git a/kustomize-patch-complex/patches/app-ingress/kustomization.yaml b/kustomize-patch-complex/patches/app-ingress/kustomization.yaml new file mode 100644 index 0000000..4a8c3e9 --- /dev/null +++ b/kustomize-patch-complex/patches/app-ingress/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - app-ingress.yaml diff --git a/kustomize-patch-complex/patches/canary/kustomization.yaml b/kustomize-patch-complex/patches/canary/kustomization.yaml new file mode 100644 index 0000000..752bf4e --- /dev/null +++ b/kustomize-patch-complex/patches/canary/kustomization.yaml @@ -0,0 +1,30 @@ +# https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#canary-deployments +# https://medium.com/google-cloud/kubernetes-canary-deployments-for-mere-mortals-13728ce032fe +# https://dev.to/mostlyjason/intro-to-deployment-strategies-blue-green-canary-and-more-3a3 +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: KustomizationPatch + +replicas: + - name: app-canary + count: 1 + +patches: + - patch: |- + # Need to change the deployment name so that the original app deployment still runs (with the old version) + - op: replace + path: /metadata/name + value: app-canary + # Need to change these so that the deployment can link to its pods correctly + # https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#selector + - op: replace + path: /metadata/labels/track + value: canary + - op: replace + path: /spec/selector/matchLabels/track + value: canary + - op: replace + path: /spec/template/metadata/labels/track + value: canary + target: + kind: Deployment + name: app \ No newline at end of file diff --git a/kustomize-patch-complex/patches/ingress-vars/kustomization.yaml b/kustomize-patch-complex/patches/ingress-vars/kustomization.yaml new file mode 100644 index 0000000..1fa010e --- /dev/null +++ b/kustomize-patch-complex/patches/ingress-vars/kustomization.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: KustomizationPatch + +vars: + - name: NAMESPACE + objref: + apiVersion: apps/v1 + kind: Deployment + name: app + fieldref: + fieldpath: metadata.namespace + +configurations: + - kustomize-configuration.yaml \ No newline at end of file diff --git a/kustomize-patch-complex/patches/ingress-vars/kustomize-configuration.yaml b/kustomize-patch-complex/patches/ingress-vars/kustomize-configuration.yaml new file mode 100644 index 0000000..70e2604 --- /dev/null +++ b/kustomize-patch-complex/patches/ingress-vars/kustomize-configuration.yaml @@ -0,0 +1,4 @@ +# Additional locations where variables can be interpolated +varReference: + - path: spec/rules/host + kind: Ingress diff --git a/kustomize-patch-complex/patches/stub-ingress/kustomization.yaml b/kustomize-patch-complex/patches/stub-ingress/kustomization.yaml new file mode 100644 index 0000000..c190b83 --- /dev/null +++ b/kustomize-patch-complex/patches/stub-ingress/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: KustomizationPatch +resources: + - ../stub + - stub-ingress.yaml diff --git a/kustomize-patch-complex/patches/stub-ingress/kustomize-configuration.yaml b/kustomize-patch-complex/patches/stub-ingress/kustomize-configuration.yaml new file mode 100644 index 0000000..70e2604 --- /dev/null +++ b/kustomize-patch-complex/patches/stub-ingress/kustomize-configuration.yaml @@ -0,0 +1,4 @@ +# Additional locations where variables can be interpolated +varReference: + - path: spec/rules/host + kind: Ingress diff --git a/kustomize-patch-complex/patches/stub-ingress/stub-ingress.yaml b/kustomize-patch-complex/patches/stub-ingress/stub-ingress.yaml new file mode 100644 index 0000000..ac9dd0b --- /dev/null +++ b/kustomize-patch-complex/patches/stub-ingress/stub-ingress.yaml @@ -0,0 +1,13 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: stub +spec: + rules: + - host: stub.$(NAMESPACE).tld + http: + paths: + - path: + backend: + serviceName: stub + servicePort: http diff --git a/kustomize-patch-complex/patches/stub/kustomization.yaml b/kustomize-patch-complex/patches/stub/kustomization.yaml new file mode 100644 index 0000000..d076a8b --- /dev/null +++ b/kustomize-patch-complex/patches/stub/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: KustomizationPatch + +resources: + - stub-service.yaml + - stub-deployment.yaml + +configMapGenerator: + - name: app + behavior: merge + literals: + - downstreamServiceUrl=http://stub:9080 diff --git a/kustomize-patch-complex/patches/stub/stub-deployment.yaml b/kustomize-patch-complex/patches/stub/stub-deployment.yaml new file mode 100644 index 0000000..7c42f11 --- /dev/null +++ b/kustomize-patch-complex/patches/stub/stub-deployment.yaml @@ -0,0 +1,10 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: stub +spec: + template: + spec: + containers: + - name: stub + image: nginx:latest diff --git a/kustomize-patch-complex/patches/stub/stub-service.yaml b/kustomize-patch-complex/patches/stub/stub-service.yaml new file mode 100644 index 0000000..e804f06 --- /dev/null +++ b/kustomize-patch-complex/patches/stub/stub-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: stub +spec: + type: ClusterIP + selector: + role: stub + ports: + - name: http + port: 9080 + protocol: TCP diff --git a/kustomize-patch/base/deployment.yaml b/kustomize-patch/base/deployment.yaml new file mode 100644 index 0000000..7958f19 --- /dev/null +++ b/kustomize-patch/base/deployment.yaml @@ -0,0 +1,10 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: my-deployment +spec: + template: + spec: + containers: + - name: my-deployment + image: my-image diff --git a/kustomize-patch/base/kustomization.yaml b/kustomize-patch/base/kustomization.yaml new file mode 100644 index 0000000..c941c1f --- /dev/null +++ b/kustomize-patch/base/kustomization.yaml @@ -0,0 +1,9 @@ +resources: + - deployment.yaml + +configMapGenerator: + - name: app-config + literals: + - testValue1=from-base + - testValue2=from-base + - otherValue=from-base \ No newline at end of file diff --git a/kustomize-patch/overlays/aggregate/kustomization.yaml b/kustomize-patch/overlays/aggregate/kustomization.yaml new file mode 100644 index 0000000..8f467b5 --- /dev/null +++ b/kustomize-patch/overlays/aggregate/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - ../../base + - ../../patches/patch1 + - ../../patches/patch2 diff --git a/kustomize-patch/patches/patch1/kustomization.yaml b/kustomize-patch/patches/patch1/kustomization.yaml new file mode 100644 index 0000000..83586f8 --- /dev/null +++ b/kustomize-patch/patches/patch1/kustomization.yaml @@ -0,0 +1,11 @@ +kind: KustomizationPatch + +patchesStrategicMerge: + - patches/patch.yaml + +configMapGenerator: + - name: app-config + behavior: merge + literals: + - testValue1=from-patch1 + - patchValue=from-patch1 \ No newline at end of file diff --git a/kustomize-patch/patches/patch1/patches/patch.yaml b/kustomize-patch/patches/patch1/patches/patch.yaml new file mode 100644 index 0000000..848ee17 --- /dev/null +++ b/kustomize-patch/patches/patch1/patches/patch.yaml @@ -0,0 +1,6 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: my-deployment +spec: + replicas: 2 diff --git a/kustomize-patch/patches/patch2/kustomization.yaml b/kustomize-patch/patches/patch2/kustomization.yaml new file mode 100644 index 0000000..3628d66 --- /dev/null +++ b/kustomize-patch/patches/patch2/kustomization.yaml @@ -0,0 +1,11 @@ +kind: KustomizationPatch + +patchesStrategicMerge: + - patches/patch.yaml + +configMapGenerator: + - name: app-config + behavior: merge + literals: + - testValue2=from-patch2 + - patchValue=from-patch2 \ No newline at end of file diff --git a/kustomize-patch/patches/patch2/patches/patch.yaml b/kustomize-patch/patches/patch2/patches/patch.yaml new file mode 100644 index 0000000..950f612 --- /dev/null +++ b/kustomize-patch/patches/patch2/patches/patch.yaml @@ -0,0 +1,9 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: my-deployment +spec: + template: + metadata: + labels: + app: my-app From 4eedd903148ff9ed8c58d220324a69a37bb15e36 Mon Sep 17 00:00:00 2001 From: Paul Martin Date: Tue, 9 Jun 2020 18:57:52 +0100 Subject: [PATCH 2/2] kustomization-patch examples renamed to component- and use the new `kind: Component` --- .../base/deployment.yaml | 0 .../base/kustomization.yaml | 0 .../overlays/ci/kustomization.yaml | 1 + .../overlays/demo-canary/kustomization.yaml | 2 ++ .../overlays/demo/kustomization.yaml | 2 ++ .../overlays/prod-canary/kustomization.yaml | 2 ++ .../overlays/prod/kustomization.yaml | 2 ++ .../patches/app-ingress/app-ingress.yaml | 0 component-complex/patches/app-ingress/kustomization.yaml | 4 ++++ .../patches/canary/kustomization.yaml | 4 ++-- .../patches/ingress-vars/kustomization.yaml | 5 ++--- .../patches/ingress-vars/kustomize-configuration.yaml | 0 .../patches/stub-ingress/kustomization.yaml | 5 +++++ .../patches/stub-ingress/kustomize-configuration.yaml | 0 .../patches/stub-ingress/stub-ingress.yaml | 0 .../patches/stub/kustomization.yaml | 5 ++--- .../patches/stub/stub-deployment.yaml | 0 .../patches/stub/stub-service.yaml | 0 {kustomize-patch => component}/base/deployment.yaml | 0 {kustomize-patch => component}/base/kustomization.yaml | 0 component/overlays/aggregate/kustomization.yaml | 9 +++++++++ .../patches/patch1/kustomization.yaml | 3 ++- .../patches/patch1/patches/patch.yaml | 0 .../patches/patch2/kustomization.yaml | 3 ++- .../patches/patch2/patches/patch.yaml | 0 .../patches/app-ingress/kustomization.yaml | 4 ---- .../patches/stub-ingress/kustomization.yaml | 5 ----- kustomize-patch/overlays/aggregate/kustomization.yaml | 4 ---- 28 files changed, 37 insertions(+), 23 deletions(-) rename {kustomize-patch-complex => component-complex}/base/deployment.yaml (100%) rename {kustomize-patch-complex => component-complex}/base/kustomization.yaml (100%) rename {kustomize-patch-complex => component-complex}/overlays/ci/kustomization.yaml (94%) rename {kustomize-patch-complex => component-complex}/overlays/demo-canary/kustomization.yaml (93%) rename {kustomize-patch-complex => component-complex}/overlays/demo/kustomization.yaml (95%) rename {kustomize-patch-complex => component-complex}/overlays/prod-canary/kustomization.yaml (93%) rename {kustomize-patch-complex => component-complex}/overlays/prod/kustomization.yaml (94%) rename {kustomize-patch-complex => component-complex}/patches/app-ingress/app-ingress.yaml (100%) create mode 100644 component-complex/patches/app-ingress/kustomization.yaml rename {kustomize-patch-complex => component-complex}/patches/canary/kustomization.yaml (93%) rename {kustomize-patch-complex => component-complex}/patches/ingress-vars/kustomization.yaml (74%) rename {kustomize-patch-complex => component-complex}/patches/ingress-vars/kustomize-configuration.yaml (100%) create mode 100644 component-complex/patches/stub-ingress/kustomization.yaml rename {kustomize-patch-complex => component-complex}/patches/stub-ingress/kustomize-configuration.yaml (100%) rename {kustomize-patch-complex => component-complex}/patches/stub-ingress/stub-ingress.yaml (100%) rename {kustomize-patch-complex => component-complex}/patches/stub/kustomization.yaml (71%) rename {kustomize-patch-complex => component-complex}/patches/stub/stub-deployment.yaml (100%) rename {kustomize-patch-complex => component-complex}/patches/stub/stub-service.yaml (100%) rename {kustomize-patch => component}/base/deployment.yaml (100%) rename {kustomize-patch => component}/base/kustomization.yaml (100%) create mode 100644 component/overlays/aggregate/kustomization.yaml rename {kustomize-patch => component}/patches/patch1/kustomization.yaml (75%) rename {kustomize-patch => component}/patches/patch1/patches/patch.yaml (100%) rename {kustomize-patch => component}/patches/patch2/kustomization.yaml (75%) rename {kustomize-patch => component}/patches/patch2/patches/patch.yaml (100%) delete mode 100644 kustomize-patch-complex/patches/app-ingress/kustomization.yaml delete mode 100644 kustomize-patch-complex/patches/stub-ingress/kustomization.yaml delete mode 100644 kustomize-patch/overlays/aggregate/kustomization.yaml diff --git a/kustomize-patch-complex/base/deployment.yaml b/component-complex/base/deployment.yaml similarity index 100% rename from kustomize-patch-complex/base/deployment.yaml rename to component-complex/base/deployment.yaml diff --git a/kustomize-patch-complex/base/kustomization.yaml b/component-complex/base/kustomization.yaml similarity index 100% rename from kustomize-patch-complex/base/kustomization.yaml rename to component-complex/base/kustomization.yaml diff --git a/kustomize-patch-complex/overlays/ci/kustomization.yaml b/component-complex/overlays/ci/kustomization.yaml similarity index 94% rename from kustomize-patch-complex/overlays/ci/kustomization.yaml rename to component-complex/overlays/ci/kustomization.yaml index 2c3aad6..0a40491 100644 --- a/kustomize-patch-complex/overlays/ci/kustomization.yaml +++ b/component-complex/overlays/ci/kustomization.yaml @@ -3,5 +3,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../../base +components: - ../../patches/stub namespace: ci diff --git a/kustomize-patch-complex/overlays/demo-canary/kustomization.yaml b/component-complex/overlays/demo-canary/kustomization.yaml similarity index 93% rename from kustomize-patch-complex/overlays/demo-canary/kustomization.yaml rename to component-complex/overlays/demo-canary/kustomization.yaml index ded9125..11bfeed 100644 --- a/kustomize-patch-complex/overlays/demo-canary/kustomization.yaml +++ b/component-complex/overlays/demo-canary/kustomization.yaml @@ -3,4 +3,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../demo + +components: - ../../patches/canary diff --git a/kustomize-patch-complex/overlays/demo/kustomization.yaml b/component-complex/overlays/demo/kustomization.yaml similarity index 95% rename from kustomize-patch-complex/overlays/demo/kustomization.yaml rename to component-complex/overlays/demo/kustomization.yaml index 220d229..b7ecf17 100644 --- a/kustomize-patch-complex/overlays/demo/kustomization.yaml +++ b/component-complex/overlays/demo/kustomization.yaml @@ -3,6 +3,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../../base + +components: - ../../patches/ingress-vars - ../../patches/stub-ingress - ../../patches/app-ingress diff --git a/kustomize-patch-complex/overlays/prod-canary/kustomization.yaml b/component-complex/overlays/prod-canary/kustomization.yaml similarity index 93% rename from kustomize-patch-complex/overlays/prod-canary/kustomization.yaml rename to component-complex/overlays/prod-canary/kustomization.yaml index 8bd24dd..9e180fc 100644 --- a/kustomize-patch-complex/overlays/prod-canary/kustomization.yaml +++ b/component-complex/overlays/prod-canary/kustomization.yaml @@ -3,4 +3,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../prod + +components: - ../../patches/canary diff --git a/kustomize-patch-complex/overlays/prod/kustomization.yaml b/component-complex/overlays/prod/kustomization.yaml similarity index 94% rename from kustomize-patch-complex/overlays/prod/kustomization.yaml rename to component-complex/overlays/prod/kustomization.yaml index eb56769..a951c82 100644 --- a/kustomize-patch-complex/overlays/prod/kustomization.yaml +++ b/component-complex/overlays/prod/kustomization.yaml @@ -3,6 +3,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../../base + +components: - ../../patches/ingress-vars - ../../patches/app-ingress namespace: prod \ No newline at end of file diff --git a/kustomize-patch-complex/patches/app-ingress/app-ingress.yaml b/component-complex/patches/app-ingress/app-ingress.yaml similarity index 100% rename from kustomize-patch-complex/patches/app-ingress/app-ingress.yaml rename to component-complex/patches/app-ingress/app-ingress.yaml diff --git a/component-complex/patches/app-ingress/kustomization.yaml b/component-complex/patches/app-ingress/kustomization.yaml new file mode 100644 index 0000000..e22f9d2 --- /dev/null +++ b/component-complex/patches/app-ingress/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component +resources: + - app-ingress.yaml diff --git a/kustomize-patch-complex/patches/canary/kustomization.yaml b/component-complex/patches/canary/kustomization.yaml similarity index 93% rename from kustomize-patch-complex/patches/canary/kustomization.yaml rename to component-complex/patches/canary/kustomization.yaml index 752bf4e..51664c2 100644 --- a/kustomize-patch-complex/patches/canary/kustomization.yaml +++ b/component-complex/patches/canary/kustomization.yaml @@ -1,8 +1,8 @@ # https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#canary-deployments # https://medium.com/google-cloud/kubernetes-canary-deployments-for-mere-mortals-13728ce032fe # https://dev.to/mostlyjason/intro-to-deployment-strategies-blue-green-canary-and-more-3a3 -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: KustomizationPatch +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component replicas: - name: app-canary diff --git a/kustomize-patch-complex/patches/ingress-vars/kustomization.yaml b/component-complex/patches/ingress-vars/kustomization.yaml similarity index 74% rename from kustomize-patch-complex/patches/ingress-vars/kustomization.yaml rename to component-complex/patches/ingress-vars/kustomization.yaml index 1fa010e..31ddad1 100644 --- a/kustomize-patch-complex/patches/ingress-vars/kustomization.yaml +++ b/component-complex/patches/ingress-vars/kustomization.yaml @@ -1,6 +1,5 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: KustomizationPatch - +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component vars: - name: NAMESPACE objref: diff --git a/kustomize-patch-complex/patches/ingress-vars/kustomize-configuration.yaml b/component-complex/patches/ingress-vars/kustomize-configuration.yaml similarity index 100% rename from kustomize-patch-complex/patches/ingress-vars/kustomize-configuration.yaml rename to component-complex/patches/ingress-vars/kustomize-configuration.yaml diff --git a/component-complex/patches/stub-ingress/kustomization.yaml b/component-complex/patches/stub-ingress/kustomization.yaml new file mode 100644 index 0000000..175d376 --- /dev/null +++ b/component-complex/patches/stub-ingress/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component +resources: + - ../stub + - stub-ingress.yaml diff --git a/kustomize-patch-complex/patches/stub-ingress/kustomize-configuration.yaml b/component-complex/patches/stub-ingress/kustomize-configuration.yaml similarity index 100% rename from kustomize-patch-complex/patches/stub-ingress/kustomize-configuration.yaml rename to component-complex/patches/stub-ingress/kustomize-configuration.yaml diff --git a/kustomize-patch-complex/patches/stub-ingress/stub-ingress.yaml b/component-complex/patches/stub-ingress/stub-ingress.yaml similarity index 100% rename from kustomize-patch-complex/patches/stub-ingress/stub-ingress.yaml rename to component-complex/patches/stub-ingress/stub-ingress.yaml diff --git a/kustomize-patch-complex/patches/stub/kustomization.yaml b/component-complex/patches/stub/kustomization.yaml similarity index 71% rename from kustomize-patch-complex/patches/stub/kustomization.yaml rename to component-complex/patches/stub/kustomization.yaml index d076a8b..d51750b 100644 --- a/kustomize-patch-complex/patches/stub/kustomization.yaml +++ b/component-complex/patches/stub/kustomization.yaml @@ -1,6 +1,5 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: KustomizationPatch - +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component resources: - stub-service.yaml - stub-deployment.yaml diff --git a/kustomize-patch-complex/patches/stub/stub-deployment.yaml b/component-complex/patches/stub/stub-deployment.yaml similarity index 100% rename from kustomize-patch-complex/patches/stub/stub-deployment.yaml rename to component-complex/patches/stub/stub-deployment.yaml diff --git a/kustomize-patch-complex/patches/stub/stub-service.yaml b/component-complex/patches/stub/stub-service.yaml similarity index 100% rename from kustomize-patch-complex/patches/stub/stub-service.yaml rename to component-complex/patches/stub/stub-service.yaml diff --git a/kustomize-patch/base/deployment.yaml b/component/base/deployment.yaml similarity index 100% rename from kustomize-patch/base/deployment.yaml rename to component/base/deployment.yaml diff --git a/kustomize-patch/base/kustomization.yaml b/component/base/kustomization.yaml similarity index 100% rename from kustomize-patch/base/kustomization.yaml rename to component/base/kustomization.yaml diff --git a/component/overlays/aggregate/kustomization.yaml b/component/overlays/aggregate/kustomization.yaml new file mode 100644 index 0000000..58068ee --- /dev/null +++ b/component/overlays/aggregate/kustomization.yaml @@ -0,0 +1,9 @@ +kind: Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 + +resources: + - ../../base + +components: + - ../../patches/patch1 + - ../../patches/patch2 diff --git a/kustomize-patch/patches/patch1/kustomization.yaml b/component/patches/patch1/kustomization.yaml similarity index 75% rename from kustomize-patch/patches/patch1/kustomization.yaml rename to component/patches/patch1/kustomization.yaml index 83586f8..dfe35d0 100644 --- a/kustomize-patch/patches/patch1/kustomization.yaml +++ b/component/patches/patch1/kustomization.yaml @@ -1,4 +1,5 @@ -kind: KustomizationPatch +kind: Component +apiVersion: kustomize.config.k8s.io/v1alpha1 patchesStrategicMerge: - patches/patch.yaml diff --git a/kustomize-patch/patches/patch1/patches/patch.yaml b/component/patches/patch1/patches/patch.yaml similarity index 100% rename from kustomize-patch/patches/patch1/patches/patch.yaml rename to component/patches/patch1/patches/patch.yaml diff --git a/kustomize-patch/patches/patch2/kustomization.yaml b/component/patches/patch2/kustomization.yaml similarity index 75% rename from kustomize-patch/patches/patch2/kustomization.yaml rename to component/patches/patch2/kustomization.yaml index 3628d66..6091daa 100644 --- a/kustomize-patch/patches/patch2/kustomization.yaml +++ b/component/patches/patch2/kustomization.yaml @@ -1,4 +1,5 @@ -kind: KustomizationPatch +kind: Component +apiVersion: kustomize.config.k8s.io/v1alpha1 patchesStrategicMerge: - patches/patch.yaml diff --git a/kustomize-patch/patches/patch2/patches/patch.yaml b/component/patches/patch2/patches/patch.yaml similarity index 100% rename from kustomize-patch/patches/patch2/patches/patch.yaml rename to component/patches/patch2/patches/patch.yaml diff --git a/kustomize-patch-complex/patches/app-ingress/kustomization.yaml b/kustomize-patch-complex/patches/app-ingress/kustomization.yaml deleted file mode 100644 index 4a8c3e9..0000000 --- a/kustomize-patch-complex/patches/app-ingress/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - app-ingress.yaml diff --git a/kustomize-patch-complex/patches/stub-ingress/kustomization.yaml b/kustomize-patch-complex/patches/stub-ingress/kustomization.yaml deleted file mode 100644 index c190b83..0000000 --- a/kustomize-patch-complex/patches/stub-ingress/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: KustomizationPatch -resources: - - ../stub - - stub-ingress.yaml diff --git a/kustomize-patch/overlays/aggregate/kustomization.yaml b/kustomize-patch/overlays/aggregate/kustomization.yaml deleted file mode 100644 index 8f467b5..0000000 --- a/kustomize-patch/overlays/aggregate/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -resources: - - ../../base - - ../../patches/patch1 - - ../../patches/patch2