Skip to content

Examples

Infra GitOps using RCTL

Here are some of the examples to scale an existing cluster through Infra GitOps using RCTL

Below is a sample yaml file with Auto create CNI option.

kind: Cluster
metadata:
  name: demo-eks1
  project: defaultproject
spec:
  blueprint: default
  blueprintversion: 1.13.0
  cloudprovider: gk-eks
  cniparams:
    customCniCidr: 100.0.0.0/24
  cniprovider: aws-cni
  proxyconfig: {}
  type: eks
---
apiVersion: rafay.io/v1alpha5
kind: ClusterConfig
metadata:
  name: demo-eks1
  region: us-west-1
  version: "1.19"
nodeGroups:
- amiFamily: AmazonLinux2
  desiredCapacity: 2
  iam:
    withAddonPolicies:
      autoScaler: true
      imageBuilder: true
  instanceType: t3.xlarge
  maxSize: 2
  minSize: 1
  name: self-mn
  volumeSize: 80
  volumeType: gp3
- amiFamily: AmazonLinux2
  desiredCapacity: 1
  iam:
    withAddonPolicies:
      autoScaler: true
      imageBuilder: true
  instanceType: t3.xlarge
  maxSize: 2
  minSize: 1
  name: ng-72199bd8
  volumeSize: 80
  volumeType: gp3
vpc:
  cidr: 192.168.0.0/16
  clusterEndpoints:
    privateAccess: true
    publicAccess: false
  nat:
    gateway: Single

For Manual CNI configuration, provide the below details in the Yaml file for CNI Parameters

cniparams:
  customCniCrdSpec:
    us-west-2a:
    - securityGroups:
      - sg-05a75c401bd421a7f
      - sg-07a65c401bd543a7f
      subnet: subnet-041166d6499651fdc
    us-west-2b:
    - securityGroups:
      - sg-05a75c765bd421a9f
      - sg-05a75c323de421a9e
      subnet: subnet-08dfb5d33b80d2b17

Update Cloud Provider

Use the command ./rctl apply -f demo-eks1.yaml

Expected output (with a task id):

Cluster: demo-eks1
{
  "taskset_id": "d2w0em8",
  "operations": [
    {
      "operation": "CloudProviderUpdation",
      "resource_name": "demo-eks1",
      "status": "PROVISION_TASK_STATUS_PENDING"
    }
  ],
  "comments": "The status of the operations can be fetched using taskset_id",
  "status": "PROVISION_TASKSET_STATUS_PENDING"
}

To know the status of the cloud provider apply operation, enter the below command with the generated task id

./rctl status apply d2w0em8

Expected Output

{
  "taskset_id": "d2w0em8",
  "operations": [
    {
      "operation": "CloudProviderUpdation",
      "resource_name": "demo-eks1",
      "status": "PROVISION_TASK_STATUS_SUCCESS"
    }
  ],
  "comments": "Configuration is applied to the cluster successfully",
  "status": "PROVISION_TASKSET_STATUS_COMPLETE"

Update Blueprint

Use the command ./rctl apply -f demo-eks1.yaml

Expected output (with a task id):

Cluster: eks-ap-eks1
{
  "taskset_id": "dk34v2n",
  "operations": [
    {
      "operation": "BlueprintUpdation",
      "resource_name": "demo-eks1",
      "status": "PROVISION_TASK_STATUS_INPROGRESS"
    }
  ],
  "comments": "Configuration is being applied to the cluster",
  "status": "PROVISION_TASKSET_STATUS_INPROGRESS"
}

To know the status of the blueprint apply operation, enter the below command with the generated task id

./rctl status apply dk34v2n

Expected Output

{
  "taskset_id": "dk34v2n",
  "operations": [
    {
      "operation": "BlueprintUpdation",
      "resource_name": "demo-eks1",
      "status": "PROVISION_TASK_STATUS_SUCCESS"
    }
  ],
  "comments": "Configuration is applied to the cluster successfully",
  "status": "PROVISION_TASKSET_STATUS_COMPLETE""

Changes in Controller

On successful Blueprint apply operation, user can view the changes reflecting in Controller

Apply Blueprint


Change Cluster Endpoint

Use the command ./rctl apply -f demo-eks1.yaml

Expected output (with a task id):

Cluster: eks-ap-eks1
{
  "taskset_id": "j2q48k9",
  "operations": [
    {
      "operation": "UpdatingClusterEndpoints",
      "resource_name": "demo-eks1",
      "status": "PROVISION_TASK_STATUS_PENDING"
    }
  ],
  "comments": "The status of the operations can be fetched using taskset_id",
  "status": "PROVISION_TASKSET_STATUS_PENDING"
}

To know the status of the change cluster endpoint apply operation, enter the below command with the generated task id

./rctl status apply dk34v2n

Expected Output

{
  "taskset_id": "j2q48k9",
  "operations": [
    {
      "operation": "ClusterEndpointsUpdation",
      "resource_name": "demo-eks1",
      "status": "PROVISION_TASK_STATUS_SUCCESS"
    }
  ],
  "comments": "Configuration is applied to the cluster successfully",
  "status": "PROVISION_TASKSET_STATUS_COMPLETE""

Changes in Controller

On successful Cluster Endpoint apply operation, user can view the changes reflecting in Controller

Apply Blueprint


Node group Labels and Tags

Post Cluster provisioning, users can update Managed Node group Labels and Tags via RCTL using the Cluster Configuration Yaml file. An illustrative example of the cluster spec YAML file with managed node group is shown below

apiVersion: rafay.io/v1alpha5
kind: ClusterConfig
metadata:
  name: demo-eks1
  region: us-west-1
  version: "1.20"
managedNodeGroups:
- amiFamily: AmazonLinux2
  name: managed-ng-1
  desiredCapacity: 1
  maxSize: 2
  minSize: 1
  instanceType: t3.xlarge
  labels:
    role: worker
  tags:
    nodegroup-role: worker

Update Node group Labels

Modify the managed Node group lables as per the requirement and use the below command to apply the changes

./rctl apply -f demo-eks1.yaml

Example

./rctl apply -f demo-eks1.yaml

Output

Cluster: demo-eks1
{
 "taskset_id": "lk5xw2e",
 "operations": [
  {
   "operation": "NodegroupUpdateLabels",
   "resource_name": "ng-b0ac64e3",
   "status": "PROVISION_TASK_STATUS_PENDING"
  }
 ],
 "comments": "The status of the operations can be fetched using taskset_id",
 "status": "PROVISION_TASKSET_STATUS_PENDING"
}

Update Node group Tags

Modify the managed Node group tags as per the requirement and use the below command to apply the changes

./rctl apply -f demo-eks1.yaml

Example

./rctl apply -f demo-eks1.yaml

Output

Cluster: demo-eks1
{
 "taskset_id": "pz24nmy",
 "operations": [
  {
   "operation": "NodegroupUpdateTags",
   "resource_name": "ng-b0ac64e3",
   "status": "PROVISION_TASK_STATUS_PENDING"
  }
 ],
 "comments": "The status of the operations can be fetched using taskset_id",
 "status": "PROVISION_TASKSET_STATUS_PENDING"
}