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
- Host: GitHub
- URL: https://github.com/spacelift-io/spacelift-operator
- Owner: spacelift-io
- License: mit
- Created: 2024-02-26T13:42:33.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-13T01:15:23.000Z (9 months ago)
- Last Synced: 2025-04-13T02:58:45.496Z (8 months ago)
- Language: Go
- Size: 275 KB
- Stars: 4
- Watchers: 9
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
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.