Skip to content

CLI

Users can use RCTL to automate the lifecycle of operations associated with cluster blueprints.

Resource Create Get Update Delete
Blueprint YES YES YES YES

Create Blueprint

Imperative

Users can use this to create a custom cluster blueprint assembled with a number of addons from the same project. You can also optionally disable the Managed Ingress Controller and the Log Aggregation addons in the default cluster blueprint if it is not required or will conflict with your preferred ingress controller.

./rctl create blueprint <blueprint-name>

Use the below command to create blueprint version(s)

./rctl create blueprint version <blueprint-name> <blueprint-version-name> <addon1-name>/<addon1-version-name> <addon2-name>/<addon2-version-name>

Declarative

You can also create a blueprint in your project based on a version controlled blueprint spec that you can store in a Git repository. This enables users to develop automation for reproducible infrastructure.

./rctl create blueprint -f blueprint-spec.yml

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

kind: Blueprint
metadata:
  # blueprint name
  name: custom-blueprint
  # Rafay project name
  project: defaultproject

Use this command to create a blueprint version.

./rctl create blueprint version -f blueprint-version-spec.yml

An illustrative example of the blueprint version spec YAML file is shown below. To remove the cluster fleet(s) configuration, do not include the placement parameters (highlighted in yellow) in the YAML file

kind: BlueprintVersion
metadata:
  name: v1
  project: defaultproject
spec:
  blueprint: demo-bp
  addons:
    - name: addon-01
      version: v1.0
    - name: simple-helm-addon
      version: v1.0
  placement:
    autoPublish: true
    fleetValues:
    - fleet-01
    - fleet-02

Enable/Disable Blueprint Versions

  • Use the below command to enable a specific blueprint version
./rctl set blueprintversion <bp-name> <version> enable

An illustrative example is shown below

./rctl set blueprintversion demo-blueprint v1.0 enable
Blueprint demo-blueprint version v1.0 is successfully enabled
  • Enabling a blueprint version which is already enabled shows the output as below
./rctl set blueprintversion demo-blueprint v1.0 enable
Blueprint demo-blueprint version v1.0 is already enabled
  • Use the below command to disable a specific blueprint version
./rctl set blueprintversion <bp-name> <version> disable

An illustrative example is shown below

./rctl set blueprintversion demo-blueprint v1.0 disable
Blueprint demo-blueprint version v1.0 is successfully disabled
  • Disabling a blueprint version which is already disabled shows the output as below
./rctl set blueprintversion demo-blueprint v1.0 disable
Blueprint demo-blueprint version v1.0 is already disabled

List Blueprints

You can retrieve/list the blueprints in the current project.

./rctl get blueprint

An illustrative example is shown below.

./rctl get blueprint
+-------------+----------+----------+--------------+---------------------------+--------------+------------------------------+-----------+
| NAME | VERSIONS | CLUSTERS | FLEET VALUES | LATEST PUBLISHED REVISION | AUTO PUBLISH | MODIFIED AT | OWNERSHIP |
+-------------+----------+----------+--------------+---------------------------+--------------+------------------------------+-----------+
| trial | 0 | 0 | | 0 | false | Wed Mar 9 13:31:04 UTC 2022 | self |
+-------------+----------+----------+--------------+---------------------------+--------------+------------------------------+-----------+
| bp1 | 1 | 0 | fleet-01 | 0 | false | Wed Mar 9 14:09:02 UTC 2022 | self |
+-------------+----------+----------+--------------+---------------------------+--------------+------------------------------+-----------+
| bp2 | 1 | 0 | fleet-02 | 0 | false | Wed Mar 9 14:11:19 UTC 2022 | self |
+-------------+----------+----------+--------------+---------------------------+--------------+------------------------------+-----------+

Get The Specific Blueprint Info

Use this command to retrieve a specific blueprint's detailed information in the configured project.

./rctl get blueprint <blueprint-name>

Below is the illustrative example of the "standard-blueprint" blueprint information:

./rctl get blueprint demo-blueprint
OWNERSHIP:  self
DETAILS:    not shared
FLEET VALUES: fleet-1, fleet-2
LAST PUBLISHED JOB ID: 1
AUTO PUBLISH: DISABLED
+------------------------+--------------------------------+------------------------------+---------+
| BLUEPRINT VERSION NAME | COMPONENTS                     | CREATED AT                   | ENABLED |
+------------------------+--------------------------------+------------------------------+---------+
| v1.0                   | v1-edge-client,                | Tue Apr 19 13:21:36 UTC 2022 | true    |
|                        | v1-logging-infra,              |                              |         |
|                        | v2-alertmanager,               |                              |         |
|                        | v2-relay-agent,                |                              |         |
|                        | v2-infra, v2-ingress-infra,    |                              |         |
|                        | rafay-prometheus,              |                              |         |
|                        | aws-node-termination-handler   |                              |         |
+------------------------+--------------------------------+------------------------------+---------+
| v1.1                   | v1-edge-client,                | Tue Apr 19 13:22:42 UTC 2022 | false   |
|                        | v1-logging-infra,              |                              |         |
|                        | v2-alertmanager,               |                              |         |
|                        | v2-relay-agent,                |                              |         |
|                        | v2-infra, v2-ingress-infra,    |                              |         |
|                        | rafay-prometheus,              |                              |         |
|                        | aws-node-termination-handler   |                              |         |
+------------------------+--------------------------------+------------------------------+---------+
| v1.2                   | v1-edge-client,                | Tue Apr 19 13:56:58 UTC 2022 | true    |
|                        | v1-logging-infra,              |                              |         |
|                        | v2-alertmanager,               |                              |         |
|                        | v2-relay-agent,                |                              |         |
|                        | v2-infra, v2-ingress-infra,    |                              |         |
|                        | rafay-prometheus,              |                              |         |
|                        | aws-node-termination-handler   |                              |         |
+------------------------+--------------------------------+------------------------------+---------+

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

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


Publish Blueprint

Use the below command to publish the blueprints

./rctl publish blueprint <bp-name> v1

Important

If the autoPublish parameter is set to true, the new version is automatically published to the fleet(s). When the autoPublish parameter is set to false, the publish command is mandatory.


autoPublish Blueprint

autoPublish is always enabled when a user create blueprint creates via v3 along with the fleet values

Below is an illustrative example of Blueprint v3 spec file

apiVersion: infra.k8smgmt.io/v3
kind: Blueprint
metadata:
  name: rctlv3-autopublish
  project: qa
spec:
  base:
    name: default
    version: 1.11.0
  customAddons:
  - name: demoaddon4
    version: v1.0
  - name: demoaddon5
    version: v1.0
  defaultAddons:
    enableIngress: true
    enableLogging: true
    enableMonitoring: true
    enableVM: false
    monitoring:
      helmExporter:
        discovery: {}
        enabled: true
      kubeStateMetrics:
        discovery: {}
        enabled: true
      metricsServer:
        enabled: true
      nodeExporter:
        discovery: {}
        enabled: true
      prometheusAdapter:
        enabled: true
      resources: {}
  drift:
    enabled: false
  placement:
    autoPublish: true
    fleetValues:
    - v3-fleet-rctlv3-a1-f
    - v3-fleet-rctlv3-a2-f
  sharing:
    enabled: false
  version: v5

Delete Blueprint

Delete a cluster blueprint in the configured project. This is a destructive operation and will delete all versions of the blueprint.

./rctl delete blueprint <blueprint name>

Important

It is not possible to delete a blueprint that is actively being used on clusters.


Blueprint Status

You can view the blueprints status in the current project.

./rctl status blueprint <bp-name>

An illustrative example of the output is shown below

./rctl status b demo-bp
+-------------+---------+--------------------------------+--------+--------------------------------+--------------------------------+-----------------------------------+
| BLUEPRINT  | VERSION | FLEET VALUES          | JOB ID | ASSIGNED CLUSTERS       | READY CLUSTERS         | FAILED CLUSTERS          |
+-------------+---------+--------------------------------+--------+--------------------------------+--------------------------------+-----------------------------------+
| demo-bp | voper  | test-qc-rctlwed1,       | 13   |                |                |                  |
|       |     | test-qc-rctlwed2        |    |                |                |                  |
+-------------+---------+--------------------------------+--------+--------------------------------+--------------------------------+-----------------------------------+
| demo-bp | v12   | test-qc-rctlwed1,       | 12   | demoeks2-stage2, demoaks1  | demoaks1           |                  |
|       |     | test-qc-rctlwed2        |    |                |                |                  |
+-------------+---------+--------------------------------+--------+--------------------------------+--------------------------------+-----------------------------------+
| demo-bp | v11   | test-qc-rctlwed1,       | 11   | demoaks1, demoeks2-stage2  | demoaks1           |                  |
|       |     | test-qc-rctlwed2        |    |                |                |                  |
+-------------+---------+--------------------------------+--------+--------------------------------+--------------------------------+-----------------------------------+

To view the status of a job, use the below command with the job id

./rctl status blueprint <bp-name> <job-id>

Example

./rctl status b demo-b 1
+-------------+---------+--------------------------------+--------+--------------------------------+------------------+-----------------+
| BLUEPRINT  | VERSION | FLEET VALUES   | JOB ID | ASSIGNED CLUSTERS       | READY CLUSTERS  | FAILED CLUSTERS |
+-------------+---------+--------------------------------+--------+--------------------------------+------------------+-----------------+
| demo-b     | v2   | test-qc-rctlwed1,   | 1   | demoeks2-stage2, demoaks1,  | demoeks1-stage1 |         |
|            |      | test-qc-rctlwed2    |     | demoeks1-stage1             |                 |         |
+-------------+---------+--------------------------------+--------+--------------------------------+------------------+-----------------+

Templating

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

Below is an example of a blueprint config template

# 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: Blueprint
metadata:
  name: bluebird
  project: {{$envName}}-{{$project}}
spec:
  base:
    name: default
    version: {{$glbCtx.BaseVersion}}
  customAddons:
  - name: logstash
    version: {{$glbCtx.AddonLogStashVersion}}
  defaultAddons:
    csiSecretStoreConfig:
      providers: {}
    enableIngress: {{$glbCtx.SystemAddonEgress}}
    enableLogging: false
    enableMonitoring: {{$glbCtx.SystemAddonMonitoring}}
    enableVM: false
  drift:
    enabled: {{$glbCtx.Drift}}
  networkPolicy: {}
  placement: {}
  sharing:
    enabled: false
  version: {{$glbCtx.Version}}

---

apiVersion: infra.k8smgmt.io/v3
kind: Blueprint
metadata:
  name: kingfish
  project: {{$envName}}-{{$project}}
spec:
  base:
    name: default
    version: {{$glbCtx.BaseVersion}}
  customAddons:
  - name: apache
    version: {{$glbCtx.AddonApacheVersion}}
  defaultAddons:
    csiSecretStoreConfig:
      providers: {}
    enableIngress: false
    enableLogging: false
    enableMonitoring: false
    enableVM: false
  drift:
    enabled: false
  networkPolicy: {}
  opaPolicy: {}
  placement: {}
  sharing:
    enabled: false
  version: {{$glbCtx.Version}}
---
{{end}}

Users can create one or more blueprint(s) with the required configuration defined in the template file. Below is an example of a blueprint value file. This file helps to create blueprint with the specified objects

BaseVersion: 1.16.0
AddonLogStashVersion: v1.0
AddonApacheVersion: v1.0
SystemAddonEgress: false
SystemAddonMonitoring: false
Drift: false
Version: v1.0

Important

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

Use the command below to create blueprint(s) with the specified configuration once the value file(s) are prepared with the necessary objects

 ./rctl apply -t blueprint.tmpl --values values.yaml

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

Refer Templating for more details on Templating flags and examples