Kustomize - Revision
yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: prod
namePrefix: prod-
nameSuffix: -v1
labels:
- pairs:
env: prod
includeSelectors: true
includeTemplates: true
commonAnnotations:
environment: production
team: platform
owner: platform-team@company.com
sla-tier: "gold"
resources:
- ../../base
# -------------------------------
# PATCHES (GVK REQUIRED HERE)
# -------------------------------
patches:
- path: patch-replicas.yaml
target:
group: apps
version: v1
kind: Deployment
name: api-deployment
- path: patch-sidecar.yaml
target:
group: apps
version: v1
kind: Deployment
name: api-deployment
- path: patch-worker.json
target:
group: apps
version: v1
kind: Deployment
name: worker-deployment
# Inline JSON6902 patch (monitor container)
- target:
group: apps
version: v1
kind: Deployment
name: worker-deployment
patch: |-
- op: add
path: /spec/template/spec/containers/-
value:
name: monitor
image: busybox:latest
command:
- sh
- -c
- |
while true; do
echo "monitoring worker...";
sleep 30;
done
resources:
requests:
cpu: "10m"
memory: "16Mi"
limits:
cpu: "20m"
memory: "32Mi"
# -------------------------------
# REPLICAS (NO GVK HERE)
# -------------------------------
# replicas:
# - name: api-deployment
# count: 4
# - name: worker-deployment
# count: 4
# -------------------------------
# IMAGE PINNING
# -------------------------------
images:
- name: node:18-alpine
newTag: 18.20.0-alpine
- name: redis:7-alpine
newTag: 7.2.4-alpine
# -------------------------------
# GENERATORS (MERGE + ENV FILES)
# -------------------------------
secretGenerator:
- name: app-secret
behavior: merge
envs:
- prod-secret.txt
literals:
- ROTATION_ENABLED=true
configMapGenerator:
- name: app-config
behavior: merge
envs:
- prod-config.txt
literals:
- ENV_TYPE=production
- FEATURE_FLAG_X=true
# -------------------------------
# GENERATOR OPTIONS
# -------------------------------
generatorOptions:
disableNameSuffixHash: false
labels:
generated-by: kustomize
annotations:
managed-by: platform-team