An open API service indexing awesome lists of open source software.

https://github.com/spacelift-io/spacelift-operator

A Kubernetes operator to manage Spacelift resources
https://github.com/spacelift-io/spacelift-operator

Last synced: 8 months ago
JSON representation

A Kubernetes operator to manage Spacelift resources

Awesome Lists containing this project

README

          

# Spacelift Operator

This repository implements a Kubernetes Operator for managing Spacelift resources in a Kubernetes cluster.

## Description

The Controller is responsible for creating and updating resources in Spacelift based on custom resource definitions (CRD). The following resources are supported:

- Stacks
- Runs
- Spaces
- Contexts
- Policies

⚠️ Note: Currently we do not delete resources in Spacelift when the corresponding custom resource is deleted.

## Installing

To install the Spacelift Operator along with its CRDs, run the following command:

```sh
kubectl apply -f https://downloads.spacelift.io/spacelift-operator/latest/manifests.yaml
```

> You can download the manifests yourself from if you would like to inspect them or alter the Deployment configuration for the controller.

### Create the `spacelift-credentials` secret

To authenticate with the Spacelift API, you need to have an [API Key](https://docs.spacelift.io/integrations/api#spacelift-api-key-token) created in Spacelift.

After that, you need to create a secret in your Kubernetes cluster called `spacelift-credentials` with the following keys:

- `SPACELIFT_API_KEY_ENDPOINT` - the endpoint of the Spacelift API (`https://.app.spacelift.io`)
- `SPACELIFT_API_KEY_ID` - the ID of the API key
- `SPACELIFT_API_KEY_SECRET` - the secret of the API key

An example of how to create the secret:

```sh
kubectl create secret generic spacelift-credentials --from-literal=SPACELIFT_API_KEY_ENDPOINT='https://mycorp.app.spacelift.io' --from-literal=SPACELIFT_API_KEY_ID='01HV1GND58KS3MFNWM5BLF33D' --from-literal=SPACELIFT_API_KEY_SECRET='3cbef141b857f40042351c79d6d435b6c1e277662ac828ef3b6cf'
```

### Create a Spacelift resource

You can now create a Spacelift resource in your Kubernetes cluster. For example, to create a Spacelift Stack, you can use the following manifest:

```sh
kubectl apply -f - <
git push origin v
```

This will trigger the release workflow, and will push the latest container image to ECR, upload the Kubernetes manifests, and create a GitHub release.