> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# rafaysystems/rafay

Deploy a Kubernetes Cluster from CircleCI using the Rafay Systems Platform. Rafay’s turnkey SaaS platform automates the highly complex deployment and operational workflows that DevOps and SRE teams implement to operate Kubernetes clusters and Kubernetes-resident apps across clusters in cloud and data center environments. The platform accelerates organizations’ respective application modernization journeys by abstracting away the complexities of Kubernetes and other open-source container management tools. Learn more: https://rafay.co/enterprise-integrations/circleci


## Commands

### init

Initializes Rafay CLI.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `rctl_api_key` | env_var_name | RCTL_API_KEY | Env variable storing your API key |
| `rctl_secret_key` | env_var_name | RCTL_API_SECRET | Env variable storing your API Secret |
| `rctl_rest_endpoint` | env_var_name | RCTL_REST_ENDPOINT | Env Variable storing your Rafay Rest Endpoint |
| `rctl_project` | env_var_name | RCTL_PROJECT | Env Variable storing your Rafay Project |
| `rafay_username` | env_var_name | RAFAY_USERNAME | Env variable storing your Username |
| `rafay_registry` | env_var_name | RAFAY_REGISTRY_ENDPOINT | Env Variable storing your Rafay Registry |
| `rctl_ops_endpoint` | env_var_name | RCTL_OPS_ENDPOINT | Env Variable storing your Rafay Ops Endpoint |
| `rafay_registry_secret` | env_var_name | RAFAY_REGISTRY_SECRET | Env Variable storing your Rafay Registry Secret |
| `rafay_organization_label` | env_var_name | RAFAY_ORGANIZATION_LABEL | Env Variable storing your Rafay Organization Label |
| `rafay_cli_log` | env_var_name | RAFAY_CLI_LOG_FILE_LOCATION | Env Variable storing your Rafay CLI Log |

### add_workload

Adds a workload to Rafay Platform.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `yaml_file` | string |  | Yaml file consisting of the workload config |

### set_workload_image

Sets an image to a container in a workload

| Parameter | Type | Default | Description |
|---|---|---|---|
| `workload` | string |  | Name of the workload |
| `container` | string |  | Name of the container in a workload |
| `image` | string |  | Name of the Image |
| `tag` | string |  | Tag of the Image |

### update_workload

Updates an already created workload on Rafay Platform.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `yaml_file` | string |  | Yaml file consisting of the workload config |

### publish_workload

Publish a workload on Rafay Platform.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `workload` | string |  | Name of the workload |

### delete_workload

Deletes a workload on Rafay Platform.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `workload` | string |  | Name of the workload |

### check_workload_status

Check the publish status of a workload on Rafay Platform.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `workload` | string |  | Name of the workload |

### configure_workload

Configure the workload on Rafay Platform.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `yaml_file` | string |  | Yaml file consisting of the workload config |
| `workload` | string |  | Name of the workload |

## Executors

### default

This is a machine executor.


## Examples

### build_and_deploy_workload_to_rafay

Builds the source code from your repo as a container image and deploys it as a workload to rafay platform.


```yaml
orbs:
  rafay: rafaysystems/rafay@x.y.z
version: 2.1
jobs:
  build-job:
    executor: rafay/default
    steps:
      - run: echo "Run your build steps here"
  Publish-Workload:
    executor: rafay/default
    steps:
      - checkout
      - rafay/init
      - rafay/add_workload:
          yaml_file: workload.yml
      - rafay/set_workload_image:
          workload: demo-circleci
          container: httpbin
          image: $RAFAY_REGISTRY_ENDPOINT/$RAFAY_ORGANIZATION_LABEL/httpbin
          tag: $CIRCLE_SHA1
      - rafay/publish_workload:
          workload: demo-circleci
      - rafay/check_workload_status:
          workload: demo-circleci
  Test-Workload:
    executor: rafay/default
    steps:
      - run: echo "Run your tests here"
  Delete-Workload:
    executor: rafay/default
    steps:
      - rafay/init
      - rafay/delete_workload:
          workload: demo-circleci
workflows:
  version: 2
  build-and-publish-workload-to-rafay:
    jobs:
      - build-job
      - Publish-Workload:
          requires:
            - build-job
      - Test-Workload:
          requires:
            - build-job
            - Publish-Workload
      - Delete-Workload:
          requires:
            - build-job
            - Publish-Workload
            - Test-Workload
```