Skip to content

Commit 8fd2085

Browse files
committed
fixup! feat(CU-869av0xyh): add kubernetes auto worker pool registration
1 parent 90b4bfb commit 8fd2085

File tree

1 file changed

+21
-29
lines changed

1 file changed

+21
-29
lines changed

docs/concepts/worker-pools/kubernetes-workers.md

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,24 @@ If you are using OpenShift, additional steps are required to allow the controlle
112112
113113
## Create a WorkerPool
114114
115-
The recommended approach for deploying worker pools is to use auto-registration.
116-
117-
With auto-registration, the controller automatically creates and manages worker pools in Spacelift without requiring manual setup steps in the UI. When you create a WorkerPool resource without token and privateKey credentials, the controller handles the complete lifecycle: it registers the pool with Spacelift, generates the required credentials, stores them securely in Kubernetes secrets, and manages ongoing operations.
118-
119-
This approach enables true GitOps workflows where worker pools can be provisioned declaratively alongside other infrastructure.
120-
There's no need to coordinate between the Spacelift UI and your Kubernetes deployment, eliminating potential errors and simplifying automation.
115+
The recommended approach for deploying worker pools is to use [auto-registration](#auto-registration).
121116
122117
With OIDC secret configuration, you can also avoid storing static Spacelift credentials in the cluster.
123118
124-
You can also create the WorkerPool manually on Spacelift, and save its secrets on the cluster. That's still a perfectly valid approach if you do not want to use auto registration.
119+
You can also [create the WorkerPool manually](#manual-registration) on Spacelift, and save its secrets on the cluster. That's still a perfectly valid approach if you do not want to use auto registration.
125120

126121
### Auto-Registration
127122

123+
With auto-registration, the controller automatically creates and manages worker pools in Spacelift without requiring manual setup steps in the UI.
124+
When you create a WorkerPool resource without token and privateKey credentials, the controller handles the complete lifecycle: it registers the pool with Spacelift, generates the required credentials, stores them securely in Kubernetes secrets, and manages ongoing operations.
125+
126+
This approach enables true GitOps workflows where worker pools can be provisioned declaratively alongside other infrastructure.
127+
There's no need to coordinate between the Spacelift UI and your Kubernetes deployment, eliminating potential errors and simplifying automation.
128+
128129
!!! warning
129130
When using auto registration, it's impossible to update and reset the workerpool from the Spacelift UI. The reason for that is to make obvious that the pool is managed from the cluster, and avoid conflicts by forcing a single source of truth.
130131

131-
#### Create a Secret
132+
#### Create an API Key
132133

133134
For auto registration to work, you need to create a Spacelift API key to allow the controller to manage worker pools in Spacelift. This key should be granted the `Worker pool controller` role for the space that your worker pool will be created in, and needs to be stored in a secret called `spacelift-api-credentials` in the same namespace as the Kubernetes controller (by default `spacelift-worker-controller-system`).
134135

@@ -142,8 +143,8 @@ For auto registration to work, you need to create a Spacelift API key to allow t
142143
143144
```shell
144145
kubectl create secret generic spacelift-api-credentials \
145-
--from-literal=key-id=<your-api-key-id> \
146-
--from-literal=key-secret=<your-api-key-secret> \
146+
--from-literal=keyId=<your-api-key-id> \
147+
--from-literal=keySecret=<your-api-key-secret> \
147148
--from-literal=endpoint=https://<your-account>.app.spacelift.io \
148149
--namespace spacelift-worker-controller-system
149150
```
@@ -159,7 +160,7 @@ For auto registration to work, you need to create a Spacelift API key to allow t
159160

160161
```shell
161162
kubectl create secret generic spacelift-api-credentials \
162-
--from-literal=key-id=<your-oidc-api-key-id> \
163+
--from-literal=keyId=<your-oidc-api-key-id> \
163164
--from-literal=endpoint=https://<your-account>.app.spacelift.io \
164165
--namespace spacelift-worker-controller-system
165166
```
@@ -180,7 +181,8 @@ When creating the Spacelift OIDC API key, use:
180181

181182
- **Issuer**: The OIDC issuer URL from above
182183
- **Client ID (audience)**: `https://kubernetes.default.svc`
183-
- **Subject Expression**: `^system:serviceaccount:NAMESPACE:SERVICE_ACCOUNT_NAME$`
184+
- **Subject Expression**: `^system:serviceaccount:NAMESPACE:SERVICE_ACCOUNT_NAME$` (replace `NAMESPACE` and `SERVICE_ACCOUNT_NAME` with yours)
185+
184186

185187
The controller's service account token contains these claims, allowing it to authenticate with Spacelift without any static credentials.
186188
@@ -196,23 +198,10 @@ metadata:
196198
name: auto-registered-pool
197199
spec:
198200
poolSize: 2
199-
200-
# You can also eventually configure the following optional Spacelift-related attributes
201-
202-
# Specify which Spacelift space to create the pool in
203-
space: production
204-
205-
# Add a description for documentation purposes
206-
description: Production worker pool for infrastructure deployments
207-
208-
# Configure drift detection limits
209-
driftDetectionRunLimits:
210-
# Set maximum number of concurrent drift detection runs
211-
maxRuns: 5
212201
EOF
213202
```
214203
215-
You can refer to the `WorkerPool` CRD for more details.
204+
You can refer to the [`WorkerPool`](#configuration) CRD for all optional fields. There are fields specific for auto registration that configures how your pool is setup in Spacelift.
216205
217206
### Manual Registration
218207
@@ -314,8 +303,11 @@ If you installed the controller using the Helm chart, the RBAC permissions are a
314303
The same applies if you installed using kubectl with raw manifests. The updated permissions are included in the manifests.
315304

316305
No action is required for existing manually registered worker pools, they will continue to work exactly as before.
317-
The new auto-registration feature is opt-in and only activates when you create WorkerPool resources without token and privateKey credentials,
318-
and if a Spacelift credentials secret is configured.
306+
307+
The new auto-registration feature is opt-in, and only activates when the following conditions are both true:
308+
309+
- You create a WorkerPool resource without specifying the `token` and `privateKey`.
310+
- You provide a `spacelift-api-credentials` secret in the same namespace as your controller containing your API credentials.
319311

320312
### Upgrading to controller v0.0.17 - or Helm chart v0.33.0
321313

@@ -537,7 +529,7 @@ spec:
537529
# space allows you to specify which Spacelift space to create the pool in.
538530
# Only applies to auto-registered pools.
539531
# Optional
540-
space: production
532+
space: production-01ARZ3NDEKTSV4RRFFQ69G5FAV
541533
542534
# description sets a description for the worker pool.
543535
# Useful for documentation and organization in the Spacelift UI.

0 commit comments

Comments
 (0)