Skip to content

Commit

Permalink
chore: update controller and add minimal example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eliecharra committed Apr 12, 2024
1 parent f53f36d commit ec3bae9
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 9 deletions.
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
# Setup
# Run minimal example

## Install the operator

Create a secret in your cluster to allow the controller to perform changes on spacelift backend.
It's simpler to configure a token the dedicated space on spacelift preprod because everything is configured.
The secret should be created in the same namespace as Stack and Run resources that we are going to create afterward.

```shell
kubectl create secret generic spacelift-credentials\
--from-literal=SPACELIFT_API_KEY_ENDPOINT='https://CHANGEME.app.spacelift.io'\
--from-literal=SPACELIFT_API_KEY_ID='CHANGEME'\
--from-literal=SPACELIFT_API_KEY_SECRET='CHANGEME'
```

Then install the operator in the cluster with

```shell
kubectl apply -f controller
```

## Create a stack

```shell
kubectl apply -f examples/stack.yaml
```

See if the stack has been created on spacelift, if not you can inspect the controller logs to see what happened.

```shell
kubectl logs -f -n spacelift-operator-system deploy/spacelift-operator-controller-manager
```

## Trigger a run

```shell
kubectl create -f examples/run.yaml
```

# Setup the kubecon demo

## (optional) Configure org

Expand Down
20 changes: 12 additions & 8 deletions controller/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ spec:
managesStateFile:
description: In our API managesStateFile is not part of StackInput
type: boolean
namespace:
type: string
projectRoot:
type: string
protectFromDeletion:
Expand Down Expand Up @@ -320,18 +318,26 @@ spec:
workerPool:
type: string
required:
- administrative
- branch
- repository
type: object
required:
- commitSHA
- name
- settings
type: object
status:
description: StackStatus defines the observed state of Stack
properties:
argo:
description: Argo is a status that could be used by argo health check
to sync on health
properties:
health:
description: ArgoHealth is a string type to represent the argo
health of a resource More info on the argo doc here https://argo-cd.readthedocs.io/en/stable/operator-manual/health/
type: string
required:
- health
type: object
id:
description: State is the stack state
type: string
Expand Down Expand Up @@ -361,8 +367,6 @@ spec:
type: string
url:
type: string
required:
- ready
type: object
type: object
served: true
Expand Down Expand Up @@ -692,7 +696,7 @@ spec:
- --leader-elect
command:
- /spacelift-operator
image: ghcr.io/spacelift-io/spacelift-operator:7434b15ea0f1cbd3a1cfe040f77b3ed4f9c8ab5d
image: ghcr.io/spacelift-io/spacelift-operator:86f340892108377f2a20dd0697626339339e77ed
livenessProbe:
httpGet:
path: /healthz
Expand Down
6 changes: 6 additions & 0 deletions examples/run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: app.spacelift.io/v1beta1
kind: Run
metadata:
generateName: spacelift-operator-demo
spec:
stackName: spacelift-operator-demo
8 changes: 8 additions & 0 deletions examples/stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: app.spacelift.io/v1beta1
kind: Stack
metadata:
name: spacelift-operator-demo
spec:
name: spacelift-operator-demo
settings:
repository: eliecharra/terraform-sample

0 comments on commit ec3bae9

Please sign in to comment.