helmet

by Company.info

Helm chartv0.15.0App 0.15.0Verified publisher

Helmet is a library Helm Chart for grouping common logics. This chart is not deployable by itself.

About this chart

Helmet

The Helmet is a Helm Library Chart that defines many chart templates like Deployment, Service, Ingress, etc which can used in other application charts.

Background

In Helm 3, their team introduced the concept of a Library chart.

A library chart is a type of Helm chart that defines chart primitives or definitions which can be shared by Helm templates in other charts. This allows users to share snippets of code that can be re-used across charts, avoiding repetition and keeping charts DRY.

The Helmet library was created because we saw many charts requiring only a few select configuration options in their Helm charts.

In order to stay somewhat DRY (Don't Repeat Yourself) and keeping with Helm 3 usage for a Library chart, we saw this pattern and decided it was worth it for us to create a library. This means each one of application charts has a dependency on what we call the Helmet library.

Prerequisites

  • Kubernetes 1.23+
  • Helm 3.9.0+

Getting started

  1. Add the Helmet as a dependency to your chart.
# file: Chart.yaml

dependencies:
  - name: helmet
    version: 0.12.0
    repository: https://charts.companyinfo.dev
    import-values: # <== It is mandatory if you want to import the Helmet default values.
      - defaults
  1. Update the Helm dependencies:
$ helm dependency update
  1. Include the app template:
# file: templates/app.yaml

{{ include "helmet.app" . }}
  1. Configure your chart
# file: values.yaml

image:
  repository: nginx

ports:
  - name: http
    containerPort: 80
    protocol: TCP

ingress:
  enabled: true
  1. Install the chart:
$ helm install nginx .

Gateway API

helmet.app includes helmet.gateway automatically. Routes default to empty, so existing deployments are unchanged. You can also include {{ include "helmet.gateway" . }} directly when composing individual templates.

Helmet manages application Routes. Infrastructure configuration owns GatewayClass, Gateway, ListenerSet, and ReferenceGrant resources; Helmet does not create them.

Install the Gateway API CRDs and a compatible Gateway controller separately. Helmet creates resources, not the CRDs or controller. Each resource's features must be supported by your controller. The default API version is gateway.networking.k8s.io/v1. HTTPRoute, GRPCRoute and TLSRoute are served at v1 from Gateway API 1.5; TCPRoute and UDPRoute only from 1.6. For older installations, set apiVersion on each entry to a version served by your CRDs, for example gateway.networking.k8s.io/v1alpha2 for older TCPRoute/UDPRoute/TLSRoute.

To attach your application to an existing shared Gateway:

route:
  main:
    enabled: true # Optional; defaults to true.
    kind: HTTPRoute
    parentRefs:
      - name: shared-gateway
        namespace: infrastructure
        sectionName: https
    hostnames:
      - app.example.com
    rules:
      - matches:
          - path:
              type: PathPrefix
              value: /
        backendRefs:
          - identifier: app
            port: http

route is a map keyed by a meaningful identifier such as main, api, or redirect. Each entry supports enabled, which defaults to true when omitted. Set enabled: false to omit that Route's Kubernetes resource. This applies to all supported Route kinds, independently of other entries. For example, keep main enabled while disabling a configured redirect in an environment override:

route:
  main:
    enabled: true
  redirect:
    enabled: false

This override assumes the full route definitions are supplied by your base values. Setting a previously deployed Route to enabled: false removes it from the Helm release on upgrade. Companion resources in extraObjects are configured separately; disabling a Route does not disable its policies or filters automatically.

The default kind is HTTPRoute; supported kinds are HTTPRoute, GRPCRoute, TLSRoute, TCPRoute, and UDPRoute.

Resource names default to <application-fullname>-<route-key>. The route key is truncated so the result stays within 63 characters, keeping the application prefix intact; keys must be non-empty. Set name to override this and avoid truncation. Entries also accept namespace (defaults to Helmet's namespace), apiVersion, labels, and annotations. All remaining fields become the native Route spec, including parentRefs, hostnames, and rules. Route values support templates evaluated in the consuming chart's context. Resource metadata merges with commonLabels and commonAnnotations, with resource values taking precedence. Keep route keys and names stable across upgrades.

Application Service references

Helmet creates one application Service, identified by app. In rules[].backendRefs, use identifier: app to resolve its generated name and Service port. port accepts a name from service.ports, a numeric Service port, or a template resolving to either. If the Service has one port, port can be omitted; with multiple ports it is required. This uses Service ports rather than container ports or targetPort.

For example, identifier: app with port: http renders as:

backendRefs:
  - name: my-release-my-app
    port: 80

The identifier cannot be combined with a backend name, namespace, non-Service kind, or non-core group. Missing Services, unknown identifiers, and unknown ports produce rendering errors. If the Route is deployed in another namespace, Helmet sets the backend namespace to the application's Service namespace. The Service owner must provision any required ReferenceGrant separately.

Explicit native backend references remain available:

backendRefs:
  - identifier: app
    port: http
    weight: 90
  - name: canary
    port: 8080
    weight: 10

Explicit references use numeric Service ports and can include native group, kind, namespace, and filters. The identifier shorthand applies only to rules[].backendRefs; other references, such as request-mirror backends, use native Kubernetes syntax. There is no implicit backend or rule: configure backendRefs explicitly, or use filters for a redirect-only rule. Native fields support path/header/method matches, traffic weights, redirects, rewrites, and controller-supported timeouts.

See the HTTPRoute example for an application using a shared Gateway. The infrastructure manages the Gateway's HTTPS listener and certificate. TLS settings on ingress apply only to Ingress.

For cross-namespace Route attachment, the Gateway listener's allowedRoutes must permit the Route namespace. Cross-namespace backend or certificate references require a ReferenceGrant in the target namespace, managed by that resource's owner outside Helmet. A client application must not grant itself access to another application's resources. Attaching a Route to a Gateway in another namespace uses allowedRoutes, not a ReferenceGrant.

Ingress and Routes can coexist during migration; enable them independently.

Extra objects and controller extensions

extraObjects renders additional Kubernetes manifests without coupling Helmet to a controller or CRD schema. It accepts a list or map of complete objects or YAML strings; map keys only identify entries and are not added to the manifests. All entries are evaluated as Helm templates in the consuming application's context. helmet.app includes them automatically, or you can include {{ include "helmet.extraObjects" . }} directly.

For example, with NGINX Gateway Fabric and its RateLimitPolicy CRD installed, attach a local rate limit to route.main:

extraObjects:
  - apiVersion: gateway.nginx.org/v1alpha1
    kind: RateLimitPolicy
    metadata:
      name: '{{ include "common.names.fullname" . }}-rate-limit'
      namespace: '{{ include "common.names.namespace" . }}'
    spec:
      targetRefs:
        - group: gateway.networking.k8s.io
          kind: HTTPRoute
          name: '{{ include "common.names.fullname" . }}-main'
      rateLimit:
        local:
          rules:
            - key: $binary_remote_addr
              zoneSize: 10m
              rate: 10r/s

Match targetRefs[].name and the policy namespace to your Route, including any explicit name or namespace overrides. This example assumes the default generated name is shorter than 63 characters; otherwise use the Route's truncated name or an explicit Route name. These settings are interpreted by NGINX Gateway Fabric, not by Helmet. Other controllers can use their own policy resources through the same extraObjects field. See the NGINX RateLimitPolicy documentation for version requirements and behavior.

For filter-based extensions, supply the companion custom resource through extraObjects and reference its name from the Route's native filter:

# Within route.main.rules[]:
filters:
  - type: ExtensionRef
    extensionRef:
      group: gateway.nginx.org
      kind: SnippetsFilter
      name: app-cache

The example filter requires a separately defined SnippetsFilter named app-cache in the Route namespace and snippet support enabled in the controller. Helmet passes the filter through unchanged. Infrastructure configuration owns controller enablement, shared cache storage and zones, and Gateway-wide policies.

Supply all required metadata yourself; Helmet does not inject names, namespaces, common labels, or annotations into extra objects. The library does not install CRDs or validate controller-specific specs. Extra objects are part of the Helm release and follow its normal upgrade and uninstall lifecycle.

More extra object examples

Choose the examples matching your installed controller. When combining examples, put their entries in a single extraObjects list.

Envoy Gateway: local rate limit targeting route.main.

extraObjects:
  - apiVersion: gateway.envoyproxy.io/v1alpha1
    kind: BackendTrafficPolicy
    metadata:
      name: '{{ include "common.names.fullname" . }}-envoy-rate-limit'
      namespace: '{{ include "common.names.namespace" . }}'
    spec:
      targetRefs:
        - group: gateway.networking.k8s.io
          kind: HTTPRoute
          name: '{{ include "common.names.fullname" . }}-main'
      rateLimit:
        local:
          rules:
            - limit:
                requests: 10
                unit: Second

Requires Envoy Gateway and its BackendTrafficPolicy CRD. This limit is local to each Envoy instance, rather than a shared quota across replicas. As in the NGINX example, match the target name and namespace to your Route overrides. See Envoy Gateway local rate limiting.

Traefik: Middleware referenced by an HTTPRoute ExtensionRef filter.

extraObjects:
  - apiVersion: traefik.io/v1alpha1
    kind: Middleware
    metadata:
      name: '{{ include "common.names.fullname" . }}-prefix'
      namespace: '{{ include "common.names.namespace" . }}'
    spec:
      addPrefix:
        prefix: /api

Creating a Middleware does not attach it automatically. Add this filter to the application Route rule in the same namespace:

# Add to the appropriate rule under route.main.rules:
filters:
  - type: ExtensionRef
    extensionRef:
      group: traefik.io
      kind: Middleware
      name: '{{ include "common.names.fullname" . }}-prefix'

Traefik must have both its Gateway and Kubernetes CRD providers enabled, with the Middleware CRD installed. See Traefik Gateway API middleware filters.

Standard Kubernetes ConfigMap supplied as a YAML string (no extra CRDs).

extraObjects:
  - |
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: '{{ include "common.names.fullname" . }}-settings'
      namespace: '{{ include "common.names.namespace" . }}'
    data:
      settings.yaml: |
        logLevel: info
        featureEnabled: true

This demonstrates a multiline YAML string and Helm template evaluation. Mount or reference the ConfigMap explicitly in your application when needed; rendering an extra object does not automatically wire it into the Deployment.

Parameters

Global parameters

NameDescriptionValue
global.imageRegistryGlobal Docker image registry""
global.imagePullSecretsGlobal Docker registry secret names as an array[]
global.storageClassGlobal StorageClass for Persistent Volume(s)""

Common parameters

NameDescriptionValue
kubeVersionForce target Kubernetes version (using Helm capabilities if not set)""
nameOverrideString to partially override common.names.fullname template with a string (will maintain the release name)""
fullnameOverrideString to fully override common.names.fullname template with a string""
namespaceOverrideString to fully override common.names.namespace template with a string""
clusterDomainKubernetes Cluster Domai

Deploy helmet with OpenTenant

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