namespaces-and-docker-auth

by Das Meta

Helm chartv0.1.3App 0.1.0

A Helm chart for Kubernetes to create/configure app namespaces and docker image registry secrets

About this chart

This helm chart allows to create kubernetes namespaces and configure docker registries(for example dockerhub) images pull credentials secret in namespaces

Public values: values.yaml. Examples: examples/namespaces-and-docker-auth/. From repo root: helm template test charts/namespaces-and-docker-auth -f examples/namespaces-and-docker-auth/minimal.yaml.

Key values

KeyDescriptionDefault / Example
listList of namespace names to create[]
labelsLabels to set on created namespaces{}
dockerAuth.enabledEnable Docker registry auth (ExternalSecrets from AWS Secret Manager)false
dockerAuth.serviceAccountRoleArnIAM role ARN for Secret Manager accessrequired when dockerAuth enabled
dockerAuth.secretManagerSecretNameAWS Secret Manager secret nameaccount
dockerAuth.regionAWS regioneu-central-1
dockerAuth.externalSecretsApiVersionAPI version of the generated ClusterSecretStore/ClusterExternalSecret. Set to external-secrets.io/v1beta1 if the cluster's external secret operator does not serve v1external-secrets.io/v1

to install the chart use the command

helm upgrade --install -n default app-namespaces dasmeta/namespaces-and-docker-auth -f path-of-values.yaml

examples of values.yaml files

create namespaces

list:
  - dev
  - stage

create namespace and attach custom labels

list:
  - dev
labels:
  mylabel: myvalue

create external secrets for docker hub auth, the namespaces where 'docker-registry-auth' will be placed by default are ones having docker-auth: enabled label set

dockerAuth:
  enabled: true
  refreshInterval: "1m" # default value is 1h, we set some small value to sync the aws secret manager changes quickly, but it is worth to set back to 1h after sync to not get frequent aws secret reads, which can generate some cost
  secretManagerSecretName: "docker-hub-credentials" # the default secret is `account`, but we can store the docker auth credentials also in custom secret like this one

create namespace and docker auth secret in

list:
  - dev
dockerAuth: # there should be secret in `eu-central-1` region named `account` and DOCKER_HUB_USERNAME/DOCKER_HUB_PASSWORD should be set in that secret
  enabled: true

Deploy namespaces-and-docker-auth with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has namespaces-and-docker-auth on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartnamespaces-and-docker-auth is pinned at v0.1.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply