common

by duyet

Helm chartv0.7.1App 0.7.1

A Library Helm Chart for grouping common logic between bitnami charts. This chart is not deployable by itself.

About this chart

Bitnami Common Library Chart

A Helm Library Chart for grouping common logic between bitnami charts.

TL;DR

dependencies:
  - name: common
    version: 0.x.x
    repository: https://charts.bitnami.com/bitnami
$ helm dependency update
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "common.names.fullname" . }}
data:
  myvalue: "Hello World"

Introduction

This chart provides a common template helpers which can be used to develop new charts using Helm package manager.

Bitnami charts can be used with Kubeapps for deployment and management of Helm Charts in clusters. This Helm chart has been tested on top of Bitnami Kubernetes Production Runtime (BKPR). Deploy BKPR to get automated TLS certificates, logging and monitoring for your applications.

Prerequisites

  • Kubernetes 1.12+
  • Helm 2.12+ or Helm 3.0-beta3+

Parameters

The following table lists the helpers available in the library which are scoped in different sections.

Affinities

Helper identifierDescriptionExpected Input
common.affinities.node.softReturn a soft nodeAffinity definitiondict "key" "FOO" "values" (list "BAR" "BAZ")
common.affinities.node.hardReturn a hard nodeAffinity definitiondict "key" "FOO" "values" (list "BAR" "BAZ")
common.affinities.pod.softReturn a soft podAffinity/podAntiAffinity definitiondict "component" "FOO" "context" $
common.affinities.pod.hardReturn a hard podAffinity/podAntiAffinity definitiondict "component" "FOO" "context" $

Capabilities

Helper identifierDescriptionExpected Input
common.capabilities.deployment.apiVersionReturn the appropriate apiVersion for deployment.. Chart context
common.capabilities.ingress.apiVersionReturn the appropriate apiVersion for ingress.. Chart context

Errors

Helper identifierDescriptionExpected Input
common.errors.upgrade.passwords.emptyIt will ensure required passwords are given when we are upgrading a chart. If validationErrors is not empty it will throw an error and will stop the upgrade action.dict "validationErrors" (list $validationError00 $validationError01) "context" $

Images

Helper identifierDescriptionExpected Input
common.images.imageReturn the proper and full image namedict "imageRoot" .Values.path.to.the.image "global" $, see ImageRoot for the structure.
common.images.pullSecretsReturn the proper Docker Image Registry Secret Namesdict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global

Labels

Helper identifierDescriptionExpected Input
common.labels.standardReturn Kubernetes standard labels. Chart context
common.labels.matchLabelsReturn the proper Docker Image Registry Secret Names. Chart context

Names

Helper identifierDescriptionExpected Inpput
common.names.nameExpand the name of the chart or use .Values.nameOverride. Chart context
common.names.fullnameCreate a default fully qualified app name.. Chart context
common.names.chartChart name plus version. Chart context

Secrets

Helper identifierDescriptionExpected Input
common.secrets.nameGenerate the name of the secret.dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $ see ExistingSecret for the structure.
common.secrets.keyGenerate secret key.dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName" see ExistingSecret for the structure.

Storage

Helper identifierDescriptionExpected Input
common.affinities.node.softReturn a soft nodeAffinity definitiondict "persistence" .Values.path.to.the.persistence "global" $, see Persistence for the structure.

TplValues

Helper identifierDescriptionExpected Input
common.tplvalues.renderRenders a value that contains templatedict "value" .Values.path.to.the.Value "context" $, value is the value should rendered as template, context frecuently is the chart context $ or .

Utils

Helper identifierDescriptionExpected Input
common.utils.fieldToEnvVarBuild environment variable name given a field.dict "field" "my-password"
common.utils.secret.getvaluePrint instructions to get a secret value.dict "secret" "secret-name" "field" "secret-value-field" "context" $

Validations

Helper identifierDescriptionExpected Input
common.validations.values.single.emptyValidate a value must not be empty.dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "context" $ secret and field are optional. In case they are given, the helper will generate a how to get instruction. See ValidateValue
common.validations.values.multiple.emptyValidate a multiple values must not be empty. It returns a shared error for all the values.dict "required" (list $validateValueConf00 $validateValueConf01) "context" $. See ValidateValue
common.validations.values.mariadb.passwordsWhen a chart is using bitnami/mariadb as subchart you should use this to validate required password are not empty. It returns a shared error for all the values.dict "secret" "mariadb-secret" "context" $
common.validations.values.postgresql.passwordsThis helper will ensure required password are not empty. It returns a shared error for all the values.dict "secret" "postgresql-secret" "subchart" "true" "context" $ subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper.

Warnings

Helper identifierDescriptionExpected Input
common.warnings.rollingTagWarning about using rolling tag.ImageRoot see ImageRoot for the structure.

Special input schemas

ImageRoot

registry:
  type: string
  description: Docker registry where the image is located
  example: docker.io

repository:
  type: string
  description: Repository and image name
  example: bitnami/nginx

tag:
  type: string
  description: image tag
  example: 1.16.1-debian-10-r63

pullPolicy:
  type: string
  description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'

pullSecrets:
  type: array
  items:
    type: string
  description: Optionally specify an array of imagePullSecrets.

debug:
  type: boolean
  description: Set to true if you would like to see extra information on logs
  example: false

## An instance would be:
# registry: docker.io
# repository: bitnami/nginx
# tag: 1.16.1-debian-10-r63
# pullPolicy: IfNotPresent
# debug: false

Persistence

enabled:
  type: boolean
  description: Whether enable persistence.
  example: true

storageClass:
  type: string
  description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning.
  example: "-"

accessMode:
  type: string
  description: Access mode for the Persistent Volume Storage.
  example: ReadWriteOnce

size:
  type: string
  description: Size the Persistent Volume Storage.
  example: 8Gi

path:
  type: string
  description: Path to be persisted.
  example: /bitnami

## An instance would be:
# enabled: true
# storageClass: "-"
# accessMode: ReadWriteOnce
# size: 8Gi
# path: /bitnami

ExistingSecret

name:
  type: string
  description: Name of the existing secret.
  example: mySecret
keyMapping:
  description: Mapping between the expected key name and the name of the key in the existing secret.
  type: object

## An instance would be:
# name: mySecret
# keyMapping:
#   password: myPasswordKey

Example of use

Wh

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 v0.7.1 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