tenant-namespace

by christianhuth

Helm chartv2.0.7Verified publisher

A Helm Chart to bootstrap a Namespace in a Multi-Tenancy setup

About this chart

tenant-namespace

A Helm Chart to bootstrap a Namespace in a Multi-Tenancy setup

TL;DR;

helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/tenant-namespace

Or install it from the OCI registry:

helm install my-release oci://ghcr.io/christianhuth/helm-charts/tenant-namespace

Introduction

This chart bootstraps a Namespace in a Multi-Tenancy cluster with all the required resources on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.19+

Installing the Chart

To install the chart with the release name my-release:

helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/tenant-namespace

The chart is also published as an OCI artifact which can be installed like this:

helm install my-release oci://ghcr.io/christianhuth/helm-charts/tenant-namespace

These commands deploy the Namespace for the Tenant on the Kubernetes cluster in the default configuration. The Values section lists the values that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall the my-release deployment:

helm uninstall my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Values

KeyTypeDefaultDescription
fullnameOverridestring""String to fully override "tenant-namespace.fullname"
limitRange.additionalAnnotationsobject{}Annotations to be added to the LimitRange
limitRange.additionalLabelsobject{}Labels to be added to the LimitRange
limitRange.enabledboolfalse- create a LimitRange resource
limitRange.limitslist[]define the list of limits
limitRange.namestring""The name of the LimitRange to be created. If left empty will simply use the Release name.
nameOverridestring""Provide a name in place of tenant-namespace
namespace.annotations.additionalAnnotationsobject{}Annotations to be added to the Namespace
namespace.annotations.openShift.descriptionstring""The optional description can be a more detailed description of the project and is visible in the web console.
namespace.annotations.openShift.displayNamestring""The optional displayName is how the project is displayed in the web console (defaults to name).
namespace.annotations.openShift.requesterstring""The optional requesting user.
namespace.annotations.scheduler.defaultTolerationslist[]This annotation requires the PodTolerationRestriction admission controller to be enabled. This annotation key allows assigning tolerations to a namespace and any new pods created in this namespace would get these tolerations added.
namespace.annotations.scheduler.nodeSelectorstring""The PodNodeSelector uses this annotation key to assign node selectors to pods in namespaces.
namespace.annotations.scheduler.tolerationsWhitelistlist[]This annotation requires the PodTolerationRestriction admission controller to be enabled. The annotation value is a JSON document that defines a list of allowed tolerations for the namespace it annotates. When you create a Pod or modify its tolerations, the API server checks the tolerations to see if they are mentioned in the allow list. The pod is admitted only if the check succeeds.
namespace.enabledboolfalse- create a Namespace resource
namespace.labels.additionalLabelsobject{}Labels to be added to the Namespace
namespace.labels.podSecurityAdmission.audit.standardstring""Value must be one of privileged, baseline, or restricted which correspond to Pod Security Standard levels.
namespace.labels.podSecurityAdmission.audit.versionstring""Version label that can be used to pin the policy to the version that shipped with a given Kubernetes minor version (for example v1.27).
namespace.labels.podSecurityAdmission.enforce.standardstring""Value must be one of privileged, baseline, or restricted which correspond to Pod Security Standard levels.
namespace.labels.podSecurityAdmission.enforce.versionstring""Version label that can be used to pin the policy to the version that shipped with a given Kubernetes minor version (for example v1.27).
namespace.labels.podSecurityAdmission.warning.standardstring""Value must be one of privileged, baseline, or restricted which correspond to Pod Security Standard levels.
namespace.labels.podSecurityAdmission.warning.versionstring""Version label that can be used to pin the policy to the version that shipped with a given Kubernetes minor version (for example v1.27).
namespace.namestring""The Name of the newly created namespace. Uses the Release name be default.
networkPolicies.additionalAnnotationsobject{}Annotations to be added to the NetworkPolicies
networkPolicies.additionalLabelsobject{}Labels to be added to the NetworkPolicies
networkPolicies.egress.allow.dns.enabledbooltruecreate a NetworkPolicy that allows outgoing traffic to the Kubernetes DNS
networkPolicies.egress.allow.dns.namespacestring"kube-system"The namespace where the Kubneretes DNS is running
networkPolicies.egress.allow.dns.podLabelsobject{"k8s-app":"kube-dns"}The labels of the Kubernetes DNS
networkPolicies.egress.allow.dns.podSelectorobject{}define a PodSelector that should be used. Uses all Pods by default
networkPolicies.egress.deny.all.enabledbooltruecreate a NetworkPolicy that denies all outgoing traffic
networkPolicies.egress.deny.all.podSelectorobject{}define a PodSelector that should be used. Uses all Pods by default
networkPolicies.enabledboolfalse- create NetworkPolicy resources to limit the allowed traffic
networkPolicies.ingress.allow.openShift.ingressController.enabledbooltruecreate a NetworkPolicy that allows incoming traffic from the OpenShift Ingress Controller
networkPolicies.ingress.allow.openShift.ingressController.podSelectorobject{}define a PodSelector that should be used. Uses all Pods by default
networkPolicies.ingress.allow.openShift.monitoring.enabledbooltruecreate a NetworkPolicy that allows incoming traffic from the OpenShift Monitoring
networkPolicies.ingress.allow.openShift.monitoring.podSelectorobject{}define a PodSelector that should be used. Uses all Pods by default
networkPolicies.ingress.deny.all.enabledbooltruecreate a NetworkPolicy that denies all incoming traffic
networkPolicies.ingress.deny.all.podSelectorobject{}define a PodSelector that should be used. Uses all Pods by default
networkPolicies.openShift.enabledboolfalseenabled the creation of NetworkPolicies for OpenShift like Ingress and Monitoring
resourceQuotasobject{"additionalAnnotations":{},"additionalLabels":{},"enabled":false,"quotas":[]}define a list of ResourceQuotas that should be created
resourceQuotas.additionalAnnotationsobject{}Annotations to be added to the LimitRange
resourceQuotas.additionalLabelsobject{}Labels to be added to the LimitRange

Specify each parameter using the --set key=value[,key=value] argument to helm install.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

helm install my-release -f values.yaml christianhuth/tenant-namespace

Deploy tenant-namespace with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has tenant-namespace 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 charttenant-namespace is pinned at v2.0.7 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