Switching to the approach with cleanup by selector

Previously we needed to delete each catalogue separatelly.
After bumping to new kustoimize 3.9.2 it's started to be
possible to use patching of several documents by selector [1],
that can be kind, name, label &etc

[1]
https://github.com/kubernetes-sigs/kustomize/blob/master/examples/patchMultipleObjects.md
+
https://github.com/kubernetes-sigs/kustomize/issues/2945

Change-Id: Ic6a2d2a4716ab0304872c4aad196a7259e58aa53
This commit is contained in:
Alexey Odinokov 2021-03-10 15:26:24 +00:00 committed by Alexey
parent 3d26a7fec3
commit b927934b8c
16 changed files with 47 additions and 95 deletions

View File

@ -0,0 +1,2 @@
resources:
- patch.yaml

View File

@ -0,0 +1,39 @@
apiVersion: builtin
kind: PatchTransformer
metadata:
name: delete-variable-catalogues
target:
kind: VariableCatalogue
patch: |
apiVersion: not-important
kind: not-important
metadata:
name: not-important
$patch: delete
---
apiVersion: builtin
kind: PatchTransformer
metadata:
name: delete-versions-catalogues
target:
kind: VersionsCatalogue
patch: |
apiVersion: not-important
kind: not-important
metadata:
name: not-important
$patch: delete
---
apiVersion: builtin
kind: PatchTransformer
metadata:
name: delete-network-catalogues
target:
kind: NetworkCatalogue
patch: |
apiVersion: not-important
kind: not-important
metadata:
name: not-important
$patch: delete

View File

@ -14,6 +14,4 @@ transformers:
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
# plugin has to be executed once all replacements has been done. Therefore
# we need to load Strategic Merge plugin as an external plugin
- ../../../../../function/hostgenerator-m3/cleanup
- ../../catalogues/cleanup
- ../../../../../function/hardwareprofile-example/cleanup
- ../../../../../function/airshipctl-cleanup/

View File

@ -1,3 +0,0 @@
resources:
- smp.yaml
- ../../../target/generator/results/cleanup/

View File

@ -1,29 +0,0 @@
apiVersion: builtin
kind: PatchStrategicMergeTransformer
metadata:
name: smp
patches: |-
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: host-catalogue
$patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: NetworkCatalogue
metadata:
name: networking
$patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: env-vars-catalogue
$patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VersionsCatalogue
metadata:
name: versions-airshipctl
$patch: delete

View File

@ -14,6 +14,4 @@ transformers:
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
# plugin has to be executed once all replacements has been done. Therefore
# we need to load Strategic Merge plugin as an external plugin
- ../../../../../function/hostgenerator-m3/cleanup
- ../../catalogues/cleanup
- ../../../../../function/hardwareprofile-example/cleanup
- ../../../../../function/airshipctl-cleanup/

View File

@ -7,5 +7,4 @@ resources:
transformers:
- ../../../../function/hostgenerator-m3/replacements
- ../../../../function/hostgenerator-m3/cleanup
- ../../target/catalogues/cleanup
- ../../../../function/airshipctl-cleanup/

View File

@ -4,4 +4,4 @@ resources:
transformers:
- update-target.yaml
- ../target/catalogues/cleanup
- ../../../function/airshipctl-cleanup/

View File

@ -1,3 +0,0 @@
resources:
- smp.yaml
- ../../generator/results/cleanup/

View File

@ -1,29 +0,0 @@
apiVersion: builtin
kind: PatchStrategicMergeTransformer
metadata:
name: smp
patches: |-
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: host-catalogue
$patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: NetworkCatalogue
metadata:
name: networking
$patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: env-vars-catalogue
$patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VersionsCatalogue
metadata:
name: versions-airshipctl
$patch: delete

View File

@ -12,6 +12,4 @@ transformers:
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
# plugin has to be executed once all replacements has been done. Therefore
# we need to load Strategic Merge plugin as an external plugin
- ../../../../../function/hostgenerator-m3/cleanup
- ../../catalogues/cleanup
- ../../../../../function/hardwareprofile-example/cleanup
- ../../../../../function/airshipctl-cleanup/

View File

@ -1,2 +0,0 @@
resources:
- override

View File

@ -1,2 +0,0 @@
resources:
- ../../../../../../../type/gating/target/generator/cleanup/

View File

@ -10,5 +10,4 @@ transformers:
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
# plugin has to be executed once all replacements has been done. Therefore
# we need to load Strategic Merge plugin as an external plugin
- ../../../../../function/hostgenerator-m3/cleanup
- ../../catalogues/cleanup
- ../../../../../function/airshipctl-cleanup/

View File

@ -1,2 +0,0 @@
resources:
- secret-cleanup.yaml

View File

@ -1,11 +0,0 @@
apiVersion: builtin
kind: PatchStrategicMergeTransformer
metadata:
name: smp_cleanup
patches: |-
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: generated-secrets
$patch: delete