Skip to content

AddOns

Info

Add-ons are optional components of a Cluster Blueprint. Click to learn about add-ons.


Create/Update Addon

A declarative approach to lifecycle management of addons is strongly recommended backed by the addon payloads version controlled in your SCM/Git repository.

Use the below command to create/update an addon in the controller based on a version controlled addon spec that you can store in a Git repository. This enables users to develop automation for reproducible infrastructure.

./rctl apply -f addon-spec.yml

An illustrative example of the addon spec YAML file is shown below

apiVersion: infra.k8smgmt.io/v3
kind: AddonVersion
metadata:
  # version name
  name: v1.0.7
  # project name. optional
  project: defaultproject
spec:
  # addon name
  addon: kubeless
  # template for different addon types
  template:
    # type of addon
    type: yaml
    # path of yaml manifest
    yamlFile: ./kubeless.yaml

Helm Add-Ons from Different Repos

Below is an example config file to create an add-on with Helm Chart and values from different repositories

apiVersion: infra.k8smgmt.io/v3
kind: AddonVersion
metadata:
  name: v1
  project: project1
  description: description for v1
spec:
  addon: demorctladdon-new4
  namespace: rctl
  template:
    type: Helm3
    repository_ref: default-bitnami
    repo_artifact_meta:
      helm:
        chartName: apache
        tag: 8.5.4
    value_repository_ref: testrepo1
    additional_reference:
      git:
        revision: main
        repoArtifactFiles:
        - name: apache-values
          relPath: apache-values.yaml
          fileType: HelmValuesFile

List Addons

Use this command to retrieve the list of addons. The name of the addons, the type of payload and publish status are returned. An illustrative example is shown below where RCTL retrieves the list of addons

./rctl get addon --v3
./rctl get addon --v3
+--------------------------------------------+--------------+---------------------------+-------------------------+
| ADDON NAME                                 | TYPE         | NAMESPACE                 | ADDON VERSION           |
+--------------------------------------------+--------------+---------------------------+-------------------------+
| acr-new-addon-helm3                        | Helm         | namespace-12              | v2                      |
+--------------------------------------------+--------------+---------------------------+-------------------------+
| acr-new-addon-yaml                         | Yaml         | namespace-12              | v3                      |
+--------------------------------------------+--------------+---------------------------+-------------------------+
| addon1                                     | Yaml         | nov-ns                    |                         |
+--------------------------------------------+--------------+---------------------------+-------------------------+
| addon2                                     | Yaml         | nov-ns                    |                         |
+--------------------------------------------+--------------+---------------------------+-------------------------+
| arm-only                                   | Yaml         | new-namespce              | v1                      |
+--------------------------------------------+--------------+---------------------------+-------------------------+

Get Specific Addon Info

Use this command to retrieve a specific addon's details in the configured project.

./rctl get addon <addon-name> --v3

Below is the illustrative example for the addon called "datadog-helm3"

./rctl get addon datadog-helm3 --v3
+--------------+------------------------------+
| VERSION NAME | CREATED AT                   |
+--------------+------------------------------+
| v1           | Mon Jun 29 04:41:11 UTC 2020 |
+--------------+------------------------------+

Or you can use below command to get more information of the addon in json or yaml format

./rctl get addon <addon-name> -o json
./rctl get addon <addon-name> -o yaml

Example:

./rctl get addon acr-new-addon-helm3 -o yaml --v3
apiVersion: infra.k8smgmt.io/v3
kind: Addon
metadata:
  name: acr-new-addon-helm3
  project: prod-test
spec:
  artifact:
    artifact:
      chartPath:
        name: file://artifacts/acr-new-addon-helm3/nginx-9.5.8.tgz
      valuesPaths:
      - name: file://artifacts/acr-new-addon-helm3/values.yml
    options:
      maxHistory: 10
      timeout: 5m0s
    type: Helm
  namespace: namespace-12
  sharing: {}
  version: v2

Create/Update Addon Version(s)

To create/update a new version of an existing addon, use the below command. Ensure that you specify the version number for your addon in the specification file.

./rctl apply -f <addon-spec.yml>

For example, the version for this addon update is highlighted below.

apiVersion: infra.k8smgmt.io/v3
kind: AddonVersion
metadata:
  # version name
  name: v0.9.1
  # project name. optional
  project: defaultproject
spec:
  # addon name
  addon: vault-server
  # template for different addon types
  template:
    # type of addon
    type: helm3
    chartFile: addon/examples/vault-0.9.1.tgz
    # values file is optional
    valuesFile: addon/examples/vault-values.yaml

Delete Addon

You can delete an addon in the configured project. Note that addons in active use in a cluster blueprint cannot be deleted and the caller will be provided with an error message.

./rctl delete addon -f config.yaml --v3

Templating

Users can also create multiple add-on(s) with a set of defined configurations. The template file contains a list of objects that helps to create multiple add-on(s) from a single template.

Below is an example of add-on template file

# Generated: {{now.UTC.Format "2006-01-02T15:04:05UTC"}}
#      With: {{command_line}}
{{ $envName := environment "PWD" | basename}}
{{ $glbCtx := . }}{{ range $i, $project := .ProjectNames }}
apiVersion: infra.k8smgmt.io/v3
kind: Addon
metadata:
  name: apache
  project: {{$envName}}-{{$project}}
  labels:{{$q := $glbCtx}}{{range $k, $label := $glbCtx.Labels}}
    {{ $label.Key }}: {{ $label.Value }}{{end}}
    environment: {{$envName}}
spec:
  artifact:
    artifact:
      chartName: apache
      chartVersion: 8.0.3
      repository: default-bitnami
    options:
      maxHistory: 10
      timeout: 5m0s
    type: Helm
  namespace: common
  sharing:
    enabled: false
  version: {{$glbCtx.Version}}

---
apiVersion: infra.k8smgmt.io/v3
kind: Addon
metadata:
  name: logstash
  project: {{$envName}}-{{$project}}
  labels:{{$q := $glbCtx}}{{range $k, $label := $glbCtx.Labels}}
    {{ $label.Key }}: {{ $label.Value }}{{end}}
    environment: {{$envName}}
spec:
  artifact:
    artifact:
      catalog: default-bitnami
      chartName: logstash
      chartVersion: 5.0.18
    options:
      maxHistory: 10
      timeout: 5m0s
    type: Helm
  namespace: logstash
  sharing:
    enabled: false
  version: {{$glbCtx.Version}}

---
{{end}}

Users can create one or more add-ons with the required configuration defined in the template file. Below is an example of an add-on value file. This file helps to create add-on with version v1.0 along with the specified label key values

Labels:
  - Key: app
    Value: addon
Version: v1.0

Important

Only the objects defined in the template must be present in the value files

Use the command below to create add-on(s) with the specified configuration once the value file(s) are prepared with the necessary objects.

 ./rctl apply -t addon.tmpl -v values.yaml

where, - addon.tmpl: template file - value.yaml: value file

Refer Templating for more details on Templating flags and examples


Share Addons

Use the below command to share an addon with one or more project(s)

  • Share with all projects
./rctl share addon addon_name --all-projects --v3
  • Share with specific project(s)
./rctl share addon addon_name --projects <prj1>,<prj2> --v3

Unshare AddOns

Use the below command to unshare an addon with one or more project(s)

  • Unshare with all Projects
./rctl share addon addon_name --none --v3
  • Unshare with specific project(s)
./rctl share addon addon_name --unassign-projects prj1,prj2 --v3

Users can also update the below sharing parameters in the addon config spec and run the apply command to share/unshare addons

sharing:
  enabled: true/false

Important

Refer here for the deprecated RCTL Commands