Skip to content

Instantly share code, notes, and snippets.

@peterjanes
Created March 30, 2020 21:19
Show Gist options
  • Save peterjanes/ab76834e9889d9be9c2aef7cfcf5c995 to your computer and use it in GitHub Desktop.
Save peterjanes/ab76834e9889d9be9c2aef7cfcf5c995 to your computer and use it in GitHub Desktop.
Curious kustomize behaviour - `kustomize build use` will apply the transformer to the generated secret but not to the local service
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
generators:
- my-generator.yaml
transformers:
- my-transformer.yaml
---
apiVersion: builtin
kind: SecretGenerator
metadata:
name: mySecret
namespace: whatever
behaviour: merge
literals:
- FRUIT=apple
- VEGETABLE=carrot
---
apiVersion: builtin
kind: PrefixSuffixTransformer
metadata:
name: notImportantHere
prefix: baked-
suffix: -pie
fieldSpecs:
- path: metadata/name
---
apiVersion: v1
kind: Service
metadata:
name: apple
spec:
ports:
- port: 7002
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../shared/
- apple.yaml
@peterjanes
Copy link
Author

Makes sense now that I look at it again: the transformation is performed before the resource is "imported" into the other kustomization, rather than being a shared configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment