Skip to content

fix(helm/provisioner): prefer provisioner key if both psk and key are set #15417

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

Merged
merged 5 commits into from
Nov 7, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Nov 6, 2024

Relates to #15416

This PR modifies the provisioner helm chart logic when both PSK and key are set.
Previously, we would fail to install the chart.
Now we will set CODER_PROVISIONER_DAEMON_KEY if both keySecretName and pskSecretName are set.
Otherwise we will fall back to the existing behaviour of setting CODER_PROVISIONER_DAEMON_PSK.

This removes the requirement for a previous workaround of having to set pskSecretName to an empty string if using keySecretName / keySecretKey.

UPDATE: after consulting with @spikecurtis I have modified the above logic slightly.
We will now prefer CODER_PROVISIONER_DAEMON_KEY only if CODER_PROVISIONER_DAEMON_PSK is unchanged from its default value. Attempting to set both explicitly will still result in a failure to install the chart.

Additionally, a separate 'gotcha' exists around provisionerDaemon.tags -- specifying both CODER_PROVISIONER_DAEMON_KEY and CODER_PROVISIONERD_TAGS will result in the deployment failing to start. This is now detected upfront at helm install time.

@johnstcn johnstcn self-assigned this Nov 6, 2024
@@ -111,7 +111,7 @@ spec:
valueFrom:
secretKeyRef:
key: psk
name: coder-provisionerd-psk
Copy link
Member Author

@johnstcn johnstcn Nov 7, 2024

Choose a reason for hiding this comment

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

review: renamed this to be clearer that it is not the default value

Comment on lines +61 to +64
{
name: "provisionerd_key_psk_empty_workaround",
expectedError: "",
},
Copy link
Member Author

Choose a reason for hiding this comment

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

review: adding an explicit test for the old workaround

@johnstcn johnstcn merged commit 6781b0f into main Nov 7, 2024
26 checks passed
@johnstcn johnstcn deleted the cj/provisioner-helm-key-psk-override branch November 7, 2024 12:34
bpmct pushed a commit that referenced this pull request Nov 8, 2024
… set (#15417)

Relates to #15416

This PR modifies the provisioner helm chart logic:
- Previously, when both provisionerDaemon.keySecretName and provisionerDaemon.pskSecretName
  were both set, we would fail to install the chart. This required users to have an obnoxious workaround
  in place where setting provisionerDaemon.pskSecretName="" was required in order to use provisioner
  keys. We now check for pskSecretName being set to the default value when keySecretName is also specified,
  and switch to provisioner key authentication instead of PSK. The previous workaround is still supported.
- We also had omitted to check for provisionerd.Tags being set along with provisionerDaemon.keySecretName.
  This would result in a crashlooping provisioner deployment, as setting both of these configuration options is
  not allowed. We now fast-fail the Helm deployment if we detect this scenario.

(cherry picked from commit 6781b0f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants