Skip to main content

Repository: govuk-helm-charts

Helm charts for the GOV.UK website and publishing platform (content management system). Cluster turnup automation is in https://github.com/alphagov/govuk-infrastructure.

Category
Utilities

README

Getting started

See Helm’s documentation to get started with Helm.

See the GOV.UK Kubernetes cluster docs for an introduction to the cluster or ask #govuk-platform-engineering in Slack.

Versioned vs unversioned charts

Most of the charts in this repository are designed to be deployed via Argo CD rather than by helm install. For these charts, we don’t use Chart.Version or Helm’s packaging system.

A few charts are still installed via helm install (via Terraform). Those charts are automatically packaged and pushed to our Helm repository when a change to Chart.Version is merged.

Local development

Prerequisites

  1. Install Helm and yq

    brew install helm yq
    
  2. Clone the repository

    git clone git@github.com:alphagov/govuk-helm-charts.git
    
  3. Configure git hooks

    cd govuk-helm-charts &&
    git config core.hooksPath git-hooks
    

Installing an application chart without Argo CD

Inspect the template output of your application chart:

cd charts/app-config

ENVIRONMENT=integration
APP=content-publisher
helm template $USER-${APP?} ../generic-govuk-app --values <(
  helm template . --values values-${ENVIRONMENT}.yaml |
  yq e '.|select(.metadata.name=="'$APP'").spec.source.helm.values'
) --set sentry.enabled=false --set rails.createKeyBaseSecret=false

To deploy it, run helm install $USER-... instead of helm template $USER.... You should see your deployed pod(s) in the list at kubernetes get pods, and be able to interact with it as normal.

Use helm uninstall $USER-${APP?} to uninstall your chart when you’ve finished.

Chart repository

Some of the charts in this git repository are published via GitHub Actions to a chart repository hosted on GitHub Pages.

To add the chart repo to Helm:

helm repo add govuk-helm-charts https://alphagov.github.io/govuk-helm-charts/

You can then run helm search repo <alias> to see the charts. helm repo update retrieves the latest versions of the packages.

Schemas

We have several Custom Resource Definitions (CRDs) installed in our Kubernetes clusters, and referenced by the Helm charts in this repository.

We use kubeconform to validate our Kubernetes manifests against schemas for those resources. This helps us ensure that our Helm charts are correct.

kubeconform runs in a GitHub Action as a pre-merge check and can also be run locally.

You can run the validation tests locally by installing kubeconform and running

mkdir helm-dist
for c in charts/*; do
  helm template "$(basename "$c")" "$c" --output-dir helm-dist
done

kubeconform -schema-location default \
-schema-location "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json" \
-summary helm-dist

Team

GOV.UK Platform Engineering team looks after this repo. If you’re inside GDS, you can find us in #govuk-platform-engineering or view our kanban board.

Licence

MIT License