fix(reconciler): Support default value for RUNNER_NAME_PREFIX from my… #540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…oung34-derivate
Fixes not-in-sync errors between GitHub API and running Pods when the default value for
RUNNER_NAME_PREFIX
is used (and likely also ifRUNNER_NAME_PREFIX
is set).If the environment variable
RUNNER_NAME_PREFIX
is not set, then the default value ofgithub-runner
will be used as a prefix.This shows up in GitHub Runners as such:
The code would originally try to match the runner name by using the name from the custom resource as a prefix, which would be incorrect in the case a
RUNNER_NAME_PREFIX
is not provided (or is the empty string) and the name of the CR is not "github-runner-runner-pool". Furthermore, if this variable is provided as non-empty, the same thing would occur as far as I can see.Example configuration which triggers this is
With the pod template containers spec from sample, namely no
env:
name forRUNNER_NAME_PREFIX
.A workaround is to set the CR name to the same as
RUNNER_NAME_PREFIX
, e.g. bothgithub-runner-runner-pool
, but this duplicates the name and the prefix (because the pod name is templated from CR.name, like"${RUNNER_NAME_PREFIX}-${cr.Name}-${SUFFIX}"
) so you end up with names like "Runners / github-runner-runner-pool-github-runner-runner-pool-pod-wxvvc"