AddOns
The table below describes the list of actions that can be performed on "addons" using the RCTL CLI Utility.
Resource | Create | Get | Update | Delete |
---|---|---|---|---|
Addon | YES | YES | YES | YES |
Create Addon¶
Both "imperative" and "declarative" approaches are supported for management of addons. A declarative approach to lifecycle management of addons is strongly recommended backed by the addon payloads version controlled in your SCM/Git repository.
Note
Starting v1.3.8 of RCTL, lifecycle of addons is managed as a 2-step process ensuring that users can explicitly manage versioning of addon payloads.
Step 1
Create the addon object in the Controller. At this time, the addon object has no payload attached to it.
Step 2
Publish a version of the addon with the k8s YAML or Helm chart. Once published, the addon is instantly active and can be immediately used in cluster blueprints. New versions of addons can be published anytime and historic versions are maintained on the controller.
Imperative¶
With this approach, you can create addons in the specified project context. Once the object has been created, you need to provide the payload (k8s YAML or Helm chart) and a version.
./rctl create addon [helm|helm3|yaml] <addon-name> [flags]
Helm Addon Example¶
In the example below, we are using the following command to create an addon for New Relic with the following information
- Type: Helm3
- Helm Chart: nri-bundle-1.7.1.tgz
- Values File: nri-bundle-custom-values.yaml
- Namespace: newrelic
- Version Name: v1.7.1
./rctl create addon helm3 newrelic --chart-file nri-bundle-1.7.1.tgz --values-file nri-bundle-custom-values.yaml -n newrelic -s v1.7.1
YAML Addon Example¶
For example, use the following command to create an addon for Kubeless from the official k8s YAML file into an existing namespace called "kubeless" providing the version name to publish the addon after creation
./rctl create addon yaml kubeless --yaml-input kubeless.yaml -n kubeless -s v1.0.7
Declarative¶
You can also create an addon into Rafay 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 create addon -f addon-spec.yml
An illustrative example of the addon spec YAML file is shown below
kind: Addon
metadata:
# set addon name
name: kubeless
# set Rafay project name
project: defaultproject
spec:
# addon namespace
namespace: kubeless
template:
# type helm or yaml
type: yaml
# If type is yaml, specific addon yaml file below
#
yamlFile: ./kubeless.yaml
# If type is helm, specific the chartFile and valuesFile below
# chartFile required and valuesFile optional for type helm
# chartFile: ./helm/nginx-chart-0.1.0.tgz
# valuesFile: ./helm/nginx-chart-0.1.0.tgz
# optional version name to publish on creation
versionName: v1.0.7
List Addons¶
Use this command to retrieve the list of addons in the configured Project. 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 in the project "Demo".
./rctl get addon --project Demo
+-----------------------------+-----------------------+------------------------------+-------------------+
| NAME | TYPE | MODIFIED AT | NAMESPACE |
+-----------------------------+-----------------------+------------------------------+-------------------+
| NGINXPlus | Helm | Fri Sep 11 19:38:25 UTC 2020 | gitlab |
+-----------------------------+-----------------------+------------------------------+-------------------+
| alert-opsgenie-demo | System [Alertmanager] | Tue Nov 10 22:22:18 UTC 2020 | rafay-infra |
+-----------------------------+-----------------------+------------------------------+-------------------+
| cert-manager | NativeYaml | Thu Sep 10 01:52:36 UTC 2020 | cert-manager |
+-----------------------------+-----------------------+------------------------------+-------------------+
| custom-alert | System [Alertmanager] | Mon Nov 2 22:20:17 UTC 2020 | rafay-infra |
+-----------------------------+-----------------------+------------------------------+-------------------+
| custom-alertmanager | System [Alertmanager] | Mon Nov 2 23:46:04 UTC 2020 | rafay-infra |
+-----------------------------+-----------------------+------------------------------+-------------------+
| datadog-helm3 | Helm3 | Sun Oct 18 18:05:54 UTC 2020 | datadog |
+-----------------------------+-----------------------+------------------------------+-------------------+
Get The Specific Addon Info¶
Use this command to retrieve the a specific addon information in the configured project.
./rctl get addon <addon-name>
Below is the illustrative example for the addon called "datadog-helm3"
./rctl get addon datadog-helm3
+--------------+------------------------------+
| VERSION NAME | CREATED AT |
+--------------+------------------------------+
| v2-4-10 | Sun Oct 18 18:05:54 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
Publish Addon¶
Addons need to be published (i.e. committed) before it can be used in a cluster blueprint. It is highly recommended that you provide a "version" when you publish the addon.
./rctl publish addon <addon-name> <version-name>
Update Addon¶
You can update already published addons in the configured project. For example, you have a new version of the Helm chart/yaml file or need to provide an updated "values.yaml" file for the Helm chart.
Imperative¶
./rctl update addon helm <addon-name> --chart-file chart.tgz --values-file values.yaml
./rctl update addon yaml <addon-name> --yaml-input addon.yaml
Declarative¶
./rctl update addon -f addon-spec.yml
Important
Once you have updated the addon, ensure that you publish it so that it can be used.
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 <addon-name>