templates

by KvalitetsIT

Helm chartv2.2.0App 2.2.0Verified publisher

Generic Helm chart for rendering Kubernetes resources from values. The chart renders nothing by default; resources are created only when explicitly configured.

About this chart

templates

Generic Helm chart for rendering Kubernetes resources from values. The chart renders nothing by default; resources are created only when explicitly configured.

Homepage: https://github.com/KvalitetsIT

Maintainers

NameEmailUrl
KvalitetsIT[email protected]https://github.com/KvalitetsIT/helm-repo

Source Code

Values

Sealed Secrets

KeyTypeDefaultDescription
sealedSecretsobject{}Map of SealedSecret resources. Each key becomes the SealedSecret name. See Sealed Secrets examples for usage.
sealedSecrets.<example-secret>.metadata.namestring""Optional. Override the rendered SealedSecret name.
sealedSecrets.<example-secret>.metadata.namespacestring""Optional. Override the rendered SealedSecret namespace.
sealedSecrets.<example-secret>.encryptedData.<secret-key>string{}Required. Encrypted secret data.
sealedSecrets.<example-secret>.template.typestring"Opaque"Optional. Kubernetes Secret type.
sealedSecrets.<example-secret>.template.metadata.labelsobject{}Optional. Additional labels for the Secret template. Common labels are always included.
sealedSecrets.<example-secret>.template.metadata.annotationsobject{}Optional. Annotations for the Secret template metadata.
sealedSecrets.<example-secret>.template.data.<data-key>string{}Optional. Additional data fields for the Secret template.

Network Policies

KeyTypeDefaultDescription
networkPolicies.<example-network-policy>.podSelectorobject{}Required. Pod selector for the policy. Use {} to select all pods.
networkPolicies.<example-network-policy>.policyTypeslist[]Optional. Policy types for the NetworkPolicy.
networkPolicies.<example-network-policy>.ingresslist[]Optional. Ingress rules for the policy.
networkPolicies.<example-network-policy>.egresslist[]Optional. Egress rules for the policy.

Cilium Network Policies

KeyTypeDefaultDescription
ciliumNetworkPoliciesobject{}Map of CiliumNetworkPolicy resources to render (Cilium CRDs). See Cilium Network Policies examples for usage.
ciliumNetworkPolicies.<example-cnp>.metadata.namestring""Optional. Override the rendered CiliumNetworkPolicy name.
ciliumNetworkPolicies.<example-cnp>.metadata.namespacestring""Optional. Override the rendered CiliumNetworkPolicy namespace.
ciliumNetworkPolicies.<example-cnp>.descriptionstring""Optional. Description of the Cilium Network Policy.
ciliumNetworkPolicies.<example-cnp>.endpointSelectorobject{}Required. Endpoint selector for the policy. Use {} to select all endpoints.
ciliumNetworkPolicies.<example-cnp>.ingresslist[]Optional. Ingress rules for the policy.
ciliumNetworkPolicies.<example-cnp>.egresslist[]Optional. Egress rules for the policy.

Resources

KeyTypeDefaultDescription
resourcesobject{}Map of Kubernetes resources to render as-is. Each key becomes the default metadata.name if not provided.
resources.example.metadata.namestring""Optional. Override the rendered resource name.
resources.example.metadata.namespacestring""Optional. Override the rendered resource namespace.

Other Values

KeyTypeDefaultDescription
networkPoliciesobject{}Map of Kubernetes NetworkPolicy resources to render. Each top-level key becomes the NetworkPolicy name.

Usage

This is a generic resource chart. By default, it renders nothing.

Define resources like the sections below to enable rendering.

Sealed Secrets

Renders Bitnami SealedSecret resources. Each entry requires encryptedData. The template block is optional. You can override the rendered resource name and namespace via metadata.name and metadata.namespace.

Examples:

sealedSecrets:
  first-secret:
    encryptedData:
      ENV_VAR_ONE: dmVyeS1zZWNyZXQtZW52MDEyMzQ1Njc4OQ==

  second-secret:
    encryptedData:
      ENV_VAR_TWO: dmVyeS1zZWNyZXQtZW52MDEyMzQ1Njc4OQ==
    template:
      type: Opaque
      metadata:
        labels:
          app.kubernetes.io/name: app-two
          team: platform
        annotations:
          app.kubernetes.io/managed-by: "sealed-secrets"
          config.kubernetes.io/version: "1"

  third-secret:
    encryptedData:
      tls.crt: dmVyeS1zZWNyZXQtdGxzLWNydDAxMjM0NTY3ODk=
      tls.key: dmVyeS1zZWNyZXQtdGxzLWtleTAxMjM0NTY3ODk=
    template:
      type: kubernetes.io/tls

  fourth-secret:
    encryptedData:
      password: dmVyeS1zZWNyZXQtZW52MDEyMzQ1Njc4OQ==
    template:
      data:
        conn_string: "postgresql://user:{{ .password }}@localhost/mydatabase"

  fifth-secret:
    encryptedData:
      ENV_VAR_FIVE: dmVyeS1zZWNyZXQtZW52MDEyMzQ1Njc4OQ==
    metadata:
      name: custom-secret-name
      namespace: custom-namespace

Cilium Network Policies

Renders Cilium CiliumNetworkPolicy resources. Each entry requires endpointSelector. The other fields is optional. You can override the rendered resource name and namespace via metadata.name and metadata.namespace.

Examples:

ciliumNetworkPolicies:
  default-deny:
    description: "Default deny all ingress and egress traffic"
    endpointSelector: {}
    ingress:
      - {}
    egress:
      - {}

  app-1-netpol:
    endpointSelector:
      matchLabels:
        app: app-2
    ingress:
      - fromEndpoints:
          - matchLabels:
              app: app-1
    egress:
      - toEndpoints:
          - matchLabels:
              app: app-3
        toPorts:
          - ports:
              - port: "80"

  app-2-netpol:
    endpointSelector:
      matchLabels:
        app: app-3
    ingress:
      - fromEndpoints:
          - matchLabels:
              app: app-1
          - matchLabels:
              app: app-2
    egress:
      - toEndpoints:
          - matchLabels:
              app: app-1
        toPorts:
          - ports:
              - port: 5321
                protocol: UDP

  dns-policy:
    description: "Allow egress DNS traffic to kube-dns"
    endpointSelector: {}
    egress:
      - toEndpoints:
          - matchLabels:
              "k8s:io.kubernetes.pod.namespace": kube-system
              "k8s:k8s-app": kube-dns
        toPorts:
          - ports:
              - port: "53"
                protocol: UDP
              - port: "53"
                protocol: TCP
            rules:
              dns:
                - matchPattern: "*"

  custom-namespace:
    metadata:
      name: custom-namespace-policy
      namespace: custom-namespace
    description: "Allow all traffic within the custom namespace"
    endpointSelector:
      matchLabels:
        "k8s:io.kubernetes.pod.namespace": custom-namespace
    ingress:
      - fromEndpoints:
          - matchLabels:
              "k8s:io.kubernetes.pod.namespace": custom-namespace
    egress:
      - toEndpoints:
          - matchLabels:
              "k8s:io.kubernetes.pod.namespace": custom-namespace

Network Policies

Renders Kubernetes NetworkPolicy resources. Each entry requires podSelector. The other fields are optional. You can override the rendered resource name and namespace via metadata.name and metadata.namespace.

Examples:

networkPolicies:
  default-deny:
    podSelector: {}
    policyTypes:
      - Ingress
      - Egress

  app-1-netpol:
    podSelector:
      matchLabels:
        app: app-1
    ingress:
      - from:
          - podSelector:
              matchLabels:
                app: app-2
          - podSelector:
              matchLabels:
                app: app-3
    egress:
      - {}

  app-2-netpol:
    podSelector:
      matchLabels:
        app: app-2
    ingress:
      - from:
          - podSelector:
              matchLabels:
                app: app-1
    egress:
      - to:
          - podSelector:
              matchLabels:
                app: app-3
        ports:
          - port: 80

  app-3-netpol:
    podSelector:
      matchLabels:
        app: app-3
    ingress:
      - from:
          - podSelector:
              matchLabels:
                app: app-1
          - podSelector:
              matchLabels:
                app: app-2
    egress:
      - to:
          - podSelector:
              matchLabels:
                app: app-1
        ports:
          - port: 5321
            protocol: UDP

  custom-namespace-and-labels:
    metadata:
      name: custom-netpol
      namespace: custom-namespace
      labels:
        custom-label: custom-value
    podSelector:
      matchLabels:
        app: app-1
    ingress:
      - from:
          - podSelector:
              matchLabels:
                app: app-2
    egress:
      - to:
          - podSelector:
              matchLabels:
                app: app-3
        ports:
          - port: 80

Resources

Renders arbitrary resources from a map keyed by resource name. The key is used as the default metadata.name if not provided. Override the rendered resource name and namespace with metadata.name and metadata.namespace.

resources:
  example:
    apiVersion: v1
    kind: ConfigMap
    data:
      value: hello

  another:
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: custom-name
      namespace: custom-namespace
    data:
      value: world

Template expressions in values

All resource types support Go template expressions in their value fields, including metadata.name. This lets you reference Helm variables such as {{ .Release.Name }}, {{ .Release.Namespace }}, or any .Values path. Strings containing template expressions must be quoted in YAML.

Note: sealedSecrets.*.encryptedData and sealedSecrets.*.template.data are excluded — those fields use the Sealed Secrets controller's own templating and would conflict.

Example:

resources:
  release-configmap:
    apiVersion: v1
    kind: ConfigMap
    data:
      release-name: "{{ .Release.Name }}"
      namespace: "{{ .Release.Namespace }}"
      app-url: "https://{{ .Release.Name }}.{{ .Release.Namespace }}.svc.cluster.local"

metadata.name supports the same expressions, letting you derive the rendered resource name from release context:

ciliumNetworkPolicies:
  release-frontend-netpol:
    description: "Allow ingress to the release frontend from its own backend"
    endpointSelector:
      matchLabels:
        app: "{{ .Release.Name }}-frontend"
    ingress:
      - fromEndpoints:
          - matchLabels:
              app: "{{ .Release.Name }}-backend"
    egress:
      - toEndpoints:
          - matchLabels:
              app: "{{ .Release.Name }}-backend"
        toPorts:
          - ports:
              - port: "8080"

  release-backend-netpol:
    endpointSelector:
      matchLabels:
        app: "{{ .Release.Name }}-backend"
    ingress:
      - fromEndpoints:
          - matchLabels:
              app: "{{ .Release.Name }}-frontend"
          - matchLabels:
              app: "{{ .Release.Name }}-worker"

  release-worker-netpol:
    metadata:
      name: "{{ .Release.Name }}-worker-netpol"
    endpointSelector:
      matchLabels:
        app: "{{ .Release.Name }}-worker"
    ingress:
      - fromEndpoints:
          - matchLabels:
              app: "{{ .Release.Name }}-backend"

Two ways to use this chart

1. Value-driven (subchart)

Add templates as a dependency and populate the value maps (networkPolicies, ciliumNetworkPolicies, sealedSecrets, resources). The chart renders every entry automatically. This is the usage shown in all the examples above and is unchanged.

2. Named-template composition (parent owns the toggle)

Every renderer is also exposed as a named template you can include from a parent chart. This lets the parent own a single conditional that gates a whole group of resources — useful when one feature flag should switch several related resources on or off together, and you want them rendered through the same generic logic rather than hand-written manifests.

Named templateRendersRequired field in value
templates.resourceany manifest (ConfigMap, Gateway, …)— (enabled is stripped)
templates.networkPolicyone NetworkPolicypodSelector
templates.ciliumNetworkPolicyone CiliumNetworkPolicyendpointSelector
templates.sealedSecretone SealedSecretencryptedData

Each takes a dict: root (the chart root $), name (default metadata.name), and value (the resource map). Collection variants — templates.resources, templates.networkPolicies, templates.ciliumNetworkPolicies, templates.sealedSecrets — take the chart root . and render every entry of the matching values map (this is what mode 1 uses under the hood).

Example — a single feature.enabled flag gating a bundle of resources in a parent chart:

# parent chart: templates/feature.yaml
{{- if .Values.feature.enabled }}
{{- include "templates.resource"            (dict "root" $ "name" "feature-config"  "value" .Values.feature.configMap) }}
{{- include "templates.resource"            (dict "root" $ "name" "feature-secret"  "value" .Values.feature.secret) }}
{{- include "templates.networkPolicy"       (dict "root" $ "name" "feature"         "value" .Values.feature.netpol) }}
{{- include "templates.ciliumNetworkPolicy" (

Deploy templates with OpenTenant

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