Lesson 04 of 10 · Charts for a platform
Library and umbrella charts
Build a platform library chart so a service needs about five lines of values while the platform supplies labels, probes, resources, security context and a PodDisruptionBudget. The example here was built and rendered for real. Then compare umbrella charts and decide when each fits.
The goal: a five-line values file
A developer should describe what is unique about their service; the platform supplies how it runs safely:
name: orders
image: { repository: ghcr.io/stefanprodan/podinfo, tag: "6.7.1" }
port: 9898
tier: tier-2
replicas: 3
Every class's project folder uses the school's ready-printed cover and safety page. Pupils only write their name, topic and three facts. If the safety rules change, the school prints new covers once, and every folder gets them at the next swap.
The library chart
# platform-lib/Chart.yaml
apiVersion: v2
name: platform-lib
type: library
version: 1.2.0
Its templates/_deployment.tpl defines named templates (platform.labels, platform.deployment, platform.service, platform.pdb). An excerpt of the Deployment template:
{{- define "platform.deployment" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.name }}
labels:
{{- include "platform.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas | default 2 }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Values.name }}
template:
metadata:
labels:
{{- include "platform.labels" . | nindent 8 }}
spec:
securityContext:
runAsNonRoot: true
runAsUser: 10001
seccompProfile: { type: RuntimeDefault }
containers:
- name: app
image: "{{ required "image.repository is required" .Values.image.repository }}:{{ .Values.image.tag }}"
ports:
- { name: http, containerPort: {{ .Values.port }} }
readinessProbe: { httpGet: { path: /readyz, port: http } }
livenessProbe: { httpGet: { path: /healthz, port: http } }
resources:
{{- toYaml (.Values.resources | default (dict "requests" (dict "cpu" "50m" "memory" "64Mi") "limits" (dict "memory" "128Mi"))) | nindent 12 }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: { drop: [ALL] }
{{- end }}
The service chart
# orders/Chart.yaml
apiVersion: v2
name: orders
version: 0.1.0
dependencies:
- name: platform-lib
version: 1.2.0
repository: oci://registry.example.com/charts # file://../platform-lib while developing
{{/* orders/templates/all.yaml */}}
{{ include "platform.deployment" . }}
---
{{ include "platform.service" . }}
---
{{ include "platform.pdb" . }}
Rendering it (helm dependency update orders && helm template orders orders) produced a Deployment with three replicas, all labels, both probes, default requests and limits, a restricted security context, plus the Service and a PodDisruptionBudget, from the five-line values file. Add the schema from the previous lesson to the service chart so bad input fails early.
Escape hatches and versioning
- Offer optional values for real needs (extra env vars, extra ports, resource overrides), validated by the schema. Avoid exposing everything.
- Teams with unusual needs can add their own templates next to the library calls; policy still enforces the non-negotiables.
- Version the library with semantic versioning; publish release notes; let Renovate open bump PRs in every service repository; roll out through rings.
Umbrella charts
An umbrella chart lists other charts as dependencies to install a whole system together (an app plus its Redis plus a worker). Parent values configure each subchart under its name; global values are shared.
| Library chart | Umbrella chart | |
|---|---|---|
| Purpose | Share template logic | Install several charts as one release |
| Renders on its own | No | Yes |
| Release coupling | None: each service releases independently | All parts upgrade together |
| Good for | Platform defaults for many services | A product made of tightly coupled parts |
Try it
Build platform-lib and orders as shown (with repository: file://../platform-lib), run helm dependency update and helm template. Then change the library's default memory limit, bump it to 1.3.0, update orders to depend on 1.3.0 and render again. That bump is exactly what an automated PR would do for 200 services.
Recap
- A library chart holds named templates with platform defaults; service charts call them and supply a few values.
- Validate inputs with a schema; offer limited escape hatches; enforce the rest with policy.
- Version the library and carry fixes with automated bumps; use umbrella charts only for parts released together.
This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.