Deployment YAML Patterns¶
TL;DR — Services in
ops-scriptsuse one of two mutually exclusive YAML patterns: flat (same config for all envs) orcustom/{env}/(per-environment YAMLs).deploy_service_jenkins.shon the kops server auto-detects which pattern is in use — no flag required.
K8s only
This applies only to services deployed to Kubernetes (backend microservices, cron jobs). Frontend deploys use a different path — see frontend-architecture.md.
Overview¶
Every service in ops-scripts lives under k8s/{service-name}/ and its K8s YAMLs follow one of two patterns. The Jenkins deploy script handles both transparently — see jenkins-k8s-jobs.md for the full CD flow.
Pattern A — flat yamls (same config for all environments)¶
Use this when the service has identical configuration across all environments.
Pattern B — per-environment yamls¶
k8s/{service}/
.env
yamls/
custom/
dev/
deployment.yaml
service.yaml
rc/
deployment.yaml
service.yaml
sandbox/
deployment.yaml
service.yaml
prod/
deployment.yaml
service.yaml
Use this when environments need different deployment specs (e.g., replicas, resources, env-specific env vars beyond the configmap).
How deploy_service_jenkins.sh detects the pattern¶
The script logic on the kops server is:
- First tries
yamls/*.yaml(flat). If the folder doesn't exist or has no yamls, produces agrep: No such file or directorywarning and continues. - Then applies
yamls/custom/{env}/*.yaml— logs"Applying k8s custom yamls"and runskubectl applyon those files for the current environment.
This is universal for all services — no special flag or Jenkins configuration needed. Any service that adds yamls/custom/{env}/ will automatically get per-environment yamls applied on the next deploy.
Script lives on the kops server, not in git
The actual logic is in /var/local/buildscripts/deploy_service_jenkins.sh on each kops server (one per environment). Not in any git repo — changes must be replicated manually across dev, rc, sandbox, prod kops servers.
Don't mix both in the same service
The script tries flat first then custom — if both exist, both get applied, which can cause unexpected overrides. Pick one pattern per service.
See also¶
- Jenkins K8s Jobs — The full deploy flow that invokes this script.
- Ops Repositories —
ops-scriptsrepo structure and conventions.