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:
parent
3d26a7fec3
commit
b927934b8c
2
manifests/function/airshipctl-cleanup/kustomization.yaml
Normal file
2
manifests/function/airshipctl-cleanup/kustomization.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
resources:
|
||||||
|
- patch.yaml
|
39
manifests/function/airshipctl-cleanup/patch.yaml
Normal file
39
manifests/function/airshipctl-cleanup/patch.yaml
Normal 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
|
||||||
|
|
@ -14,6 +14,4 @@ transformers:
|
|||||||
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
|
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
|
||||||
# plugin has to be executed once all replacements has been done. Therefore
|
# plugin has to be executed once all replacements has been done. Therefore
|
||||||
# we need to load Strategic Merge plugin as an external plugin
|
# we need to load Strategic Merge plugin as an external plugin
|
||||||
- ../../../../../function/hostgenerator-m3/cleanup
|
- ../../../../../function/airshipctl-cleanup/
|
||||||
- ../../catalogues/cleanup
|
|
||||||
- ../../../../../function/hardwareprofile-example/cleanup
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
resources:
|
|
||||||
- smp.yaml
|
|
||||||
- ../../../target/generator/results/cleanup/
|
|
@ -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
|
|
@ -14,6 +14,4 @@ transformers:
|
|||||||
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
|
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
|
||||||
# plugin has to be executed once all replacements has been done. Therefore
|
# plugin has to be executed once all replacements has been done. Therefore
|
||||||
# we need to load Strategic Merge plugin as an external plugin
|
# we need to load Strategic Merge plugin as an external plugin
|
||||||
- ../../../../../function/hostgenerator-m3/cleanup
|
- ../../../../../function/airshipctl-cleanup/
|
||||||
- ../../catalogues/cleanup
|
|
||||||
- ../../../../../function/hardwareprofile-example/cleanup
|
|
||||||
|
@ -7,5 +7,4 @@ resources:
|
|||||||
|
|
||||||
transformers:
|
transformers:
|
||||||
- ../../../../function/hostgenerator-m3/replacements
|
- ../../../../function/hostgenerator-m3/replacements
|
||||||
- ../../../../function/hostgenerator-m3/cleanup
|
- ../../../../function/airshipctl-cleanup/
|
||||||
- ../../target/catalogues/cleanup
|
|
||||||
|
@ -4,4 +4,4 @@ resources:
|
|||||||
|
|
||||||
transformers:
|
transformers:
|
||||||
- update-target.yaml
|
- update-target.yaml
|
||||||
- ../target/catalogues/cleanup
|
- ../../../function/airshipctl-cleanup/
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
resources:
|
|
||||||
- smp.yaml
|
|
||||||
- ../../generator/results/cleanup/
|
|
@ -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
|
|
@ -12,6 +12,4 @@ transformers:
|
|||||||
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
|
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
|
||||||
# plugin has to be executed once all replacements has been done. Therefore
|
# plugin has to be executed once all replacements has been done. Therefore
|
||||||
# we need to load Strategic Merge plugin as an external plugin
|
# we need to load Strategic Merge plugin as an external plugin
|
||||||
- ../../../../../function/hostgenerator-m3/cleanup
|
- ../../../../../function/airshipctl-cleanup/
|
||||||
- ../../catalogues/cleanup
|
|
||||||
- ../../../../../function/hardwareprofile-example/cleanup
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
resources:
|
|
||||||
- override
|
|
@ -1,2 +0,0 @@
|
|||||||
resources:
|
|
||||||
- ../../../../../../../type/gating/target/generator/cleanup/
|
|
@ -10,5 +10,4 @@ transformers:
|
|||||||
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
|
# NOTE We can not use patchesStrategicMerge directive since Strategic Merge
|
||||||
# plugin has to be executed once all replacements has been done. Therefore
|
# plugin has to be executed once all replacements has been done. Therefore
|
||||||
# we need to load Strategic Merge plugin as an external plugin
|
# we need to load Strategic Merge plugin as an external plugin
|
||||||
- ../../../../../function/hostgenerator-m3/cleanup
|
- ../../../../../function/airshipctl-cleanup/
|
||||||
- ../../catalogues/cleanup
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
resources:
|
|
||||||
- secret-cleanup.yaml
|
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user