This example demonstrates a complete kustomize setup with base/overlays pattern using yq-eval.
base/ # Base resources
deployment.yaml # Deployment with ${APP} variable
ingress.yaml # Ingress with ${APP} and ${DOMAIN} variables
service.yaml # Service with ${APP} variable
kustomization.yaml # Base kustomization with local-config
components/
yq-eval/ # Reusable yq-eval component
yq-eval.yaml # Function configuration
kustomization.yaml
overlays/
dev/ # Development environment
kustomization.yaml # Sets DOMAIN=dev.example
prod/ # Production environment
kustomization.yaml # Sets DOMAIN=prod.example
$ kustomize build --enable-alpha-plugins --enable-exec overlays/devThis will generate resources with:
APP=myapp(from base)DOMAIN=dev.example(from dev overlay)- Ingress host:
myapp.dev.example
$ kustomize build --enable-alpha-plugins --enable-exec overlays/prodThis will generate resources with:
APP=myapp(from base)DOMAIN=prod.example(from prod overlay)- Ingress host:
myapp.prod.example
- Base/Overlays Pattern: Common resources in base, environment-specific config in overlays
- ConfigMap Merging: Overlays merge additional variables into
local-config - Component Reuse: The
yq-evalcomponent is shared across overlays - Variable Substitution: All
${VAR}placeholders are replaced with values fromlocal-config
- Base defines
local-configConfigMap withAPP=myapp - Each overlay merges additional variables (e.g.,
DOMAIN) - The
yq-evalcomponent reads fromlocal-configand applies transformations - All resources with
yq-evalannotation get their variables substituted