Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(concepts/worker-pools/kubernetes-workers): explain proper formatting for wp_token and wp_private_key #536

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions docs/concepts/worker-pools/kubernetes-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,27 @@ The controller may also work with older versions, but we do not guarantee and pr

### Create a Secret

Next, create a Secret containing the private key and token for your worker pool, generated [earlier in this guide](./README.md#setting-up):
Next, create a Secret containing the private key and token for your worker pool, generated [earlier in this guide](./README.md#setting-up).

First, export the token and private key as base64 encoded strings:

#### Mac

```shell
SPACELIFT_WP_TOKEN=<enter-token>
SPACELIFT_WP_PRIVATE_KEY=<enter-base64-encoded-key>
export SPACELIFT_WP_TOKEN=$(cat ./your-workerpool-config-file.config | base64 -b 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You sure this is right btw? In the example below we're using stringData rather than data. As far as I understand it, stringData automatically handles base64 encoding the values for you, so I think this will result in the token and PK being double encoded (i.e. I think you need to remove the base64 command from the token, and remove one of the base64 commands from the PK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, good catch @adamconnelly I did miss that. Thank you for fixing that this morning.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh whoops - I hadn't even realised this had been merged when I left my review. It was @tomasmik and @0michalsokolowski0 who fixed it.

export SPACELIFT_WP_PRIVATE_KEY=$(cat ./your-private-key.pem | base64 -b 0 | base64 -b 0)
```

#### Linux

```shell
export SPACELIFT_WP_TOKEN=$(cat ./your-workerpool-config-file.config | base64 -w 0)
export SPACELIFT_WP_PRIVATE_KEY=$(cat ./your-private-key.pem | base64 -w 0 | base64 -w 0)
```

Then, create the secret.

```shell
kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
Expand Down
Loading