common

by gildas

Helm chartv1.0.0App 1.0.0MITVerified publisher

A Helm Chart Library of common helpers to write charts

About this chart

common-charts

Helm toolbox providing common chart templates

Installation

In your Chart.yaml, just add the following dependencies:

dependencies:
  ...
  - name: common
    repository: https://gildas.github.io/charts
    version: ~1.0.0

Then enjoy the template definitions in your own templates!

Usage

For example, adding the usual names, labels, and selectors to a Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "common.names.fullname" . }}
  labels:
    {{- include "common.labels" | nindent 4 }}
spec:
  selector:
    matchLabels:
      {{- include "common.selectorLabels" | nindent 6 }}
    template:
      metadata:
         ...
         labels:
           {{- include "common.selectorLabels" | nindent 8 }}
      spec:
        ...
        serviceAccountName: {{ include "common.names.serviceaccount" . }}
        containers:
          - ...
            image: {{ include "common.names.image" . | quote }}
            ...
            env:
              {{- include "common.logging.environment" . | nindent 12 }}
              - name:  MYVAR
                value: "myvalue"

Configuration

Many template macro will be configuration via the values.yaml file of your chart. When using umbrella charts, some macros will allow global overriding of their configuration. The global provided values will override the local values of each sub-chart.

Here is a list of these macros:

  • common.names.image
    Global value: imageRegistry, will contain the registry to pull all images from
  • common.logging.level
    Global value: logging.level, will set the log of all programs using gildas/go-logger
    This macro is used by the general macro common.logging.environment
  • common.logging.flush-frequency
    Global value: logging.flushFrenquency, will set the flush frequency of all programs using gildas/go-logger
    This macro is used by the general macro common.logging.environment
  • common.logging.source-info
    Global value: logging.sourceInfo, will set the file source logging of all programs usung gildas/go-logger
    This macro is used by the general macro common.logging.environment
  • common.logging.converter
    Global value: logging.converter, will set the log converter of all programs usung gildas/go-logger This macro is used by the general macro common.logging.environment`

Deploy common with OpenTenant

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