Kubee Helmet Chart Dev
This page contains information for developer that wants to develop Kubee chart
Charts that ends up with crds are CRDS charts.
These charts are dedicated Helm Chart
that follows
the Helm CRD Method 2.
Cluster Chart
Section titled “Cluster Chart”Cluster chart drives the provisioning of cluster. They use the templating capability of Helm to create a dynamic configuration based on the cluster configuration values file.
Library
Section titled “Library”A library chart is a chart that has common values and function.
It is not meant to be installed. As of today, kubee has only one library chart, the kubee-cluster chart.
All other charts are app charts.
Annotations
Section titled “Annotations”You add the kubee-cluster chart as dependency to get the library in Chart.yaml
dependencies: - name: kubee-cluster version: 0.0.1 repository: file://../cluster alias: clusterYou set in Chart.yaml the app name with the app.kubernetes.io/name annotation.
annotations: app.kubernetes.io/name: my-app-nameThen in the manifest:
- on metadata, you can use the
kubee-manifest-labelsfunction
metadata: labels: {{- include "kubee-manifest-labels" . | nindent 4 }}- on select label the
kubee-pod-labelsfunction
selector: # example on service {{- include "kubee-pod-labels" . | nindent 2 }} # example on template for deployment/statefulset matchLabels: {{- include "kubee-pod-labels" . | nindent 6 }}Chart Meta (Kind, Status, …)
Section titled “Chart Meta (Kind, Status, …)”Example:
annotations: chart.kubee/status: "stable" # "stable" - can be installed # "incubator" - been developed # "deprecated" - no more maintained # A lead, the description in Chart.yaml is a short description chart.kubee/lead: "A big lead" chart.kubee/category: monitoring chart.kubee/kind: "crds" # "app" - apps # "crds" - crds # "cluster" - cluster driver # "internal" - internal # "library" - lib and shared values chart.kubee/engines: | - helm - jsonnet - kustomizeCRD Dependency Charts
Section titled “CRD Dependency Charts”You can define a CRD chart with the chart.kubee/crds annotations in the Chart.yaml.
Example:
- On a
kubee crds chart
annotations: chart.kubee/crds: | - name: kubee-prometheus-crds version: 0.79.2 repository: file://../prometheus-crds- On a
external crds chart
annotations: chart.kubee/crds: | - name: mariadb-operator/mariadb-operator-crds repository: https://helm.mariadb.com/mariadb-operator version: 0.37.1FAQ: Why not multiple sub-chart by umbrella chart?
Section titled “FAQ: Why not multiple sub-chart by umbrella chart?”SubChart cannot by default be installed in another namespace than the umbrella chart. This is a known issue with helm and sub-charts
That’s why:
- the unit of execution is one sub-chart by umbrella chart
kubee-clusteris a common sub-chart of all umbrella chart
Dev: Cross dependency
Section titled “Dev: Cross dependency”Cross Dependency are only used to share values.
When developing a Chart, you should:
- add them in
Chart.ymland disable them with a condition
- name: kubee-traefik version: 0.0.1 alias: traefik condition: kubee_internal.install_cross_dependency- Install them locally
# with the installed version (f means force)kubee helmet update-dependencies -f chart-name# with the next version./bin/kubee helmet update-dependencies -f chart-name# ortask depExample: The chart kubee-dex depends on the kubee-oauth2-proxy that depends on the kubee-dex chart
creating a recursion.
To avoid this recursion, we delete all dependency in the charts/dep/Chart.yaml file
Dev Command (tpl, dep, lint, …)
Section titled “Dev Command (tpl, dep, lint, …)”# Generate the templatetask tpl# Install the dependencies charttask deptask dep-force# Generate the values.schema.jsontask schema# Generate the readme from README.md.gotmpltask helm-docs- Lint
helm lint .# check the linktask docs-lintWhy the CRDs are in the template directory and not in the CRDs directory
Section titled “Why the CRDs are in the template directory and not in the CRDs directory”The crd are not in the crds directory
because we want this manifests to be able to upgrade.
The home of Kubee Charts
Helm Schema
Section titled “Helm Schema”We filter on the current chart because if we change a schema of a dependency, we need to regenerate all dependent schema, and it does not work for now.
helm schema --helm-docs-compatibility-mode -k additionalProperties --dependencies-filter kubee-mailpitWhy?
- because empty default value are seen as required and some dependent chart such as Traefik are out of control
To make it work, we need to create a script that make a custom call for each chart.
Support
Section titled “Support”Helm Schema: no schema found error
Section titled “Helm Schema: no schema found error”Just FYI. With the error:
If you'd like to use helm-schema on your chart dependencies as well, you have to build and unpack them before.You'll avoid the "missing dependency" error message.What they mean is when you have all your chart dependency in the charts/, you need to un-tar:
# go where your Chart.lock/yaml is locatedcd <chart-name>
# build dependencies and un-tar themhelm dep buildls charts/*.tgz |xargs -n1 tar -C charts/ -xzfWe tackle this problem with the helmet update-dependency command