CLI
Users can use RCTL to automate the lifecycle of operations associated with Resource Blueprints/Templates, Environment Blueprints/Templates, Contexts, and Environments.
Context¶
Create Context¶
To create a config context, use the below command.
./rctl apply -f <demo-context.yaml>
Below is an example of a Context Config YAML file:
apiVersion: eaas.envmgmt.io/v1
kind: ConfigContext
metadata:
name: demo-context
project: defaultproject
description: demo-description
spec:
envs:
- key: RCTL_REST_ENDPOINT
options:
description: demo-description
override:
restrictedValues:
- qc-console.stage.rafay.dev
- console-user1-env1.dev.rafay-edge.net
- console.stage.rafay.dev
- console.rafay.dev
type: restricted
required: true
value: qc-console.stage.rafay.dev
- key: RCTL_API_KEY
options:
override:
type: allowed
required: true
sensitive: true
value: rctl_api_key
- key: RCTL_API_SECRET
options:
override:
type: notallowed
sensitive: true
value: rctl_api_secret
- key: DRIVER_DEBUG
options:
override:
restrictedValues:
- "true"
- "false"
type: restricted
value: "false"
files:
- data: dmFsdWU=
name: config.json
options:
description: config file
override:
type: allowed
required: true
variables:
- name: rafay_config_file
value: config.json
valueType: text
Get Config Context¶
Use the below command to retrieve/list the Config Contexts in the current project.
./rctl get configcontext
Example
./rctl get configcontext
+--------------------+--------------------------------+---------+
| CONFIGCONTEXT NAME | MODIFIED AT | SHARING |
+--------------------+--------------------------------+---------+
| config-context-1 | 2024-06-20 09:28:40.441923 | - |
| | +0000 UTC | |
+--------------------+--------------------------------+---------+
| demo-context-1 | 2024-06-20 08:28:40.441923 | - |
| | +0000 UTC | |
+--------------------+--------------------------------+---------+
Get Specific Config Context
Use this command to retrieve a specific config context detailed information.
./rctl get configcontext <context_name>
Example
./rctl get configcontext demo-context-1
+--------------------+--------------------------------+---------+
| CONFIGCONTEXT NAME | MODIFIED AT | SHARING |
+--------------------+--------------------------------+---------+
| demo-context-1 | 2024-06-20 08:28:40.441923 | - |
| | +0000 UTC | |
+--------------------+--------------------------------+---------+
Delete Config Context¶
Use the below command to delete a specific config context
./rctl delete configcontext <demo-context>
Resource Template¶
Create Resource Template¶
To create a resource template, use the below command.
./rctl apply -f <resource-template.yaml>
Below is an example of a Resource Template YAML file:
apiVersion: eaas.envmgmt.io/v1
kind: ResourceTemplate
metadata:
description: This is a resource template
name: demo-resource-temp
project: demo-project
spec:
agents:
- name: sp-agent1
contexts:
- name: demo-context
provider: opentofu
providerOptions:
driver:
name: demo-driver
openTofu:
backendConfigs:
- key=tmp3
- bucket=demo-eaas1
- region=us-west-2
- encrypt=true
backendType: custom
repositoryOptions:
branch: main
directoryPath: terraform-guides/infrastructure-as-code/aws-ec2-instance
name: demo-envmgr
version: v1
Get Resource Templates¶
Use the below command to retrieve/list the resource templates in the current project.
./rctl get resourcetemplate
Example
./rctl get resourcetemplate
+--------------------------+-----------------------+------------------+--------------------------------+---------+
| RESOURCE TEMPLATE NAME | LATEST ACTIVE VERSION | RESOURCE TYPE | MODIFIED AT | SHARING |
+--------------------------+-----------------------+------------------+--------------------------------+---------+
| sample-resource-template | version-1 | ResourceTemplate | 2024-06-20 09:33:57.615714 | - |
| | | | +0000 UTC | |
+--------------------------+-----------------------+------------------+--------------------------------+---------+
| demo-resource-template | version-2 | ResourceTemplate | 2024-06-20 08:33:57.615714 | - |
| | | | +0000 UTC | |
+--------------------------+-----------------------+------------------+--------------------------------+---------+
Get a Specific Resource Template
Use this command to retrieve a specific resource template detailed information.
rctl get resourcetemplate <resourcetemp_name>
Example
./rctl get resourcetemplate sample-resource-template
+--------------------------+-----------------------+------------------+--------------------------------+---------+
| RESOURCE TEMPLATE NAME | LATEST ACTIVE VERSION | RESOURCE TYPE | MODIFIED AT | SHARING |
+--------------------------+-----------------------+------------------+--------------------------------+---------+
| sample-resource-template | version-1 | ResourceTemplate | 2024-06-20 09:33:57.615714 | - |
| | | | +0000 UTC | |
+--------------------------+-----------------------+------------------+--------------------------------+---------+
Delete Resource Template¶
Use the below command to delete a specific Resource Template
./rctl delete resourcetemplate <demo-resource-temp>
Environment Template¶
Create Environment Template¶
To create an environment template, use the below command.
./rctl apply -f <environment-template.yaml>
Below is an example of an Environment Template YAML file:
apiVersion: eaas.envmgmt.io/v1
kind: EnvironmentTemplate
metadata:
description: This is an environment template
name: demo-env-temp
project: defaultproject
displayName: demo-displayname
spec:
iconURL: url
readme: |-
readme line1
readme line2
readme line3
agents:
- name: demo-agent
resources:
- kind: resourcetemplate
name: demo-eks
resourceOptions:
version: v1
type: dynamic
version: v1
versionState: active
Get Environment Template¶
Use the below command to retrieve/list the Environment Templates in the current project.
./rctl get environmenttemplate
Example
./rctl get environmenttemplate
+---------------------------+-----------------------+----------------+--------------------------------+---------+
| ENVIRONMENT TEMPLATE NAME | LATEST ACTIVE VERSION | RESOURCE COUNT | MODIFIED AT | SHARING |
+---------------------------+-----------------------+----------------+--------------------------------+---------+
| sample-test-template | v1 | 1 | 2024-06-20 04:46:31.130737 | - |
| | | | +0000 UTC | |
+---------------------------+-----------------------+----------------+--------------------------------+---------+
| demo-template | v2 | 1 | 2024-06-20 03:46:31.130737 | - |
| | | | +0000 UTC | |
+---------------------------+-----------------------+----------------+--------------------------------+---------+
Use this command to retrieve a specific environment template detailed information.
./rctl get environmenttemplate <envtemp_name>
Example
./rctl get environmenttemplate demo-template
+---------------------------+-----------------------+----------------+--------------------------------+---------+
| ENVIRONMENT TEMPLATE NAME | LATEST ACTIVE VERSION | RESOURCE COUNT | MODIFIED AT | SHARING |
+---------------------------+-----------------------+----------------+--------------------------------+---------+
| demo-template | v2 | 1 | 2024-06-20 03:46:31.130737 | - |
| | | | +0000 UTC | |
+---------------------------+-----------------------+----------------+--------------------------------+---------+
Delete Environment Template¶
Use the below command to delete a specific Environment Template
./rctl delete environmenttemplate <demo-env-temp>
Environment¶
Create Environment¶
To create an environment, use the below command
./rctl apply -f environment.yaml
Below is an example of an Environment YAML file:
apiVersion: eaas.envmgmt.io/v1
kind: Environment
metadata:
description: This is an environment
name: demo-env
project: defaultproject
spec:
template:
name: demo-env1
version: v1
Get Environment¶
Use the below command to retrieve/list the Environments in the current project.
./rctl get environment
Example
./rctl get environment
+----------------------------+----------------------+------------------+----------+
| ENVIRONMENT NAME | ENVIRONMENT TEMPLATE | TEMPLATE VERSION | STATUS |
+----------------------------+----------------------+------------------+----------+
| eks-em-testing | sample-test-template | v5 | StatusOK |
+----------------------------+----------------------+------------------+----------+
| demo-env | demo-template | v4 | StatusOK |
+----------------------------+----------------------+------------------+----------+
Get a Specific Environment
Use this command to retrieve an environment detailed information.
./rctl get environment <env_name>
Example
./rctl get environment eks-em-testing
+----------------------------+----------------------+------------------+----------+
| ENVIRONMENT NAME | ENVIRONMENT TEMPLATE | TEMPLATE VERSION | STATUS |
+----------------------------+----------------------+------------------+----------+
| eks-em-testing | sample-test-template | v5 | StatusOK |
+----------------------------+----------------------+------------------+----------+
Deploy Environment¶
To deploy an environment created using the template(s) and other configurations, use the command below
./rctl deploy environment <demo-env>
Destroy Environment¶
Use the command below to remove the environment resources; however, this will not delete the environment
./rctl destroy environment demo-env
Delete Environment¶
To delete an environment completely, use the command below
./rctl delete environment demo-env