-
Notifications
You must be signed in to change notification settings - Fork 0
fix(chart): inject the release-scoped pull-secret name for training pods (backend#2119) #751
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5f97755
fix(chart): inject the release-scoped pull-secret name for training p…
LukasWodka 0570e32
chore(chart): bump 1.9.46 -> 1.9.47 for the pull-secret injection (ba…
LukasWodka 8b68807
fix(chart): support a pre-made pull Secret, and stop env shadowing th…
LukasWodka b99287b
fix(chart): RBAC names the chart's own Secret, and 1.9.47 was already…
LukasWodka 95f2faa
Merge develop: keep 1.9.48, since develop's 1.9.47 is #750's
LukasWodka f03be28
test(chart): arm the pull-secret tests, and make a missing tool fail …
LukasWodka 4484ff9
test(chart): anchor the schema refusal on text every helm version prints
LukasWodka d0cf519
test(chart): helm-unittest coverage for the injected pull-secret name…
LukasWodka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| suite: the pull Secret jobs-manager stamps on training pods (backend#2119) | ||
| # client-runtime's job.yaml carried `imagePullSecrets: [{name: regcred}]` as a | ||
| # LITERAL. This chart has never created a Secret by that name -- it renders | ||
| # `<release>-regcred` -- so the reference resolved on NO release: every training | ||
| # pod named a Secret the kubelet could not retrieve and fell back to an | ||
| # ANONYMOUS pull of the ~2.7GB training image. On a mirrored install the | ||
| # training pod was the one pod in the release NOT using the operator's | ||
| # credential. | ||
| # | ||
| # Two invariants, the shape global_image_registry_test.yaml uses (@saadqbal on | ||
| # client#751 asked for this coverage; the whole fix is one `{{- if }}`, which is | ||
| # exactly the kind of thing that gets deleted by accident): | ||
| # 1. a pull Secret exists -> the var is injected AND equals the Secret's own | ||
| # name, from the same helper every imagePullSecrets block reads | ||
| # 2. no registry configured -> the var is ABSENT, not empty. client-runtime | ||
| # reads absence as "pull publicly"; an empty value would make it set a | ||
| # pull secret nothing created, i.e. the original defect inverted. | ||
| # | ||
| # `dockerRegistry.existingSecret` is covered too, because it is the path where | ||
| # the name is NOT derivable from the release name -- the case a literal could | ||
| # never have got right. | ||
| templates: | ||
| - templates/jobs-manager-deployment.yaml | ||
| - templates/docker-registry-secret.yaml | ||
| release: | ||
| name: t | ||
| namespace: tracebloc | ||
| set: | ||
| clientId: "test-id" | ||
| clientPassword: "test" | ||
| tests: | ||
| # --------------------------------------------------------------------------- | ||
| # 1. A pull Secret exists -> injected, and it names the real Secret | ||
| # --------------------------------------------------------------------------- | ||
| - it: injects the chart-created Secret's name when the chart creates one | ||
| template: templates/jobs-manager-deployment.yaml | ||
| set: | ||
| dockerRegistry: | ||
| create: true | ||
| server: https://index.docker.io/v1/ | ||
| username: u | ||
| password: p | ||
| email: e@example.com | ||
| asserts: | ||
| - contains: | ||
| path: spec.template.spec.containers[0].env | ||
| content: | ||
| name: IMAGE_PULL_SECRET_NAME | ||
| value: t-regcred | ||
|
|
||
| - it: names the same Secret the release actually pulls with | ||
| # The invariant that was broken: the injected name must be a Secret that | ||
| # EXISTS, not a plausible string. Asserted against the pod's own | ||
| # imagePullSecrets so the two cannot drift apart. | ||
| template: templates/jobs-manager-deployment.yaml | ||
| set: | ||
| dockerRegistry: | ||
| create: true | ||
| server: https://index.docker.io/v1/ | ||
| username: u | ||
| password: p | ||
| email: e@example.com | ||
| asserts: | ||
| - contains: | ||
| path: spec.template.spec.imagePullSecrets | ||
| content: | ||
| name: t-regcred | ||
|
|
||
| - it: renders that Secret in the release namespace | ||
| template: templates/docker-registry-secret.yaml | ||
| documentIndex: 0 | ||
| set: | ||
| dockerRegistry: | ||
| create: true | ||
| server: https://index.docker.io/v1/ | ||
| username: u | ||
| password: p | ||
| email: e@example.com | ||
| asserts: | ||
| - equal: | ||
| path: metadata.name | ||
| value: t-regcred | ||
| - equal: | ||
| path: metadata.namespace | ||
| value: tracebloc | ||
| - equal: | ||
| path: type | ||
| value: kubernetes.io/dockerconfigjson | ||
|
|
||
| - it: injects the operator's own name when they bring their own Secret | ||
| # The case a literal could never have got right, and the reason the name is | ||
| # injected rather than written into client-runtime's job.yaml. | ||
| template: templates/jobs-manager-deployment.yaml | ||
| set: | ||
| dockerRegistry: | ||
| existingSecret: regcred | ||
| asserts: | ||
| - contains: | ||
| path: spec.template.spec.containers[0].env | ||
| content: | ||
| name: IMAGE_PULL_SECRET_NAME | ||
| value: regcred | ||
|
|
||
| - it: renders NO Secret when the operator brought their own | ||
| # Gating the Secret template on "a pull secret exists" instead of "the chart | ||
| # creates it" would have the chart overwrite the operator's Secret using | ||
| # credentials it does not have. | ||
| template: templates/docker-registry-secret.yaml | ||
| set: | ||
| dockerRegistry: | ||
| existingSecret: regcred | ||
| asserts: | ||
| - hasDocuments: | ||
| count: 0 | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # 2. No registry configured -> ABSENT, not empty | ||
| # --------------------------------------------------------------------------- | ||
| - it: omits the variable entirely when no registry is configured | ||
| template: templates/jobs-manager-deployment.yaml | ||
| asserts: | ||
| - notContains: | ||
| path: spec.template.spec.containers[0].env | ||
| content: | ||
| name: IMAGE_PULL_SECRET_NAME | ||
| value: t-regcred | ||
| - notContains: | ||
| path: spec.template.spec.containers[0].env | ||
| content: | ||
| name: IMAGE_PULL_SECRET_NAME | ||
| value: "" | ||
|
|
||
| - it: omits it under create false as well, which is a public pull | ||
| template: templates/jobs-manager-deployment.yaml | ||
| set: | ||
| dockerRegistry: | ||
| create: false | ||
| asserts: | ||
| - notContains: | ||
| path: spec.template.spec.containers[0].env | ||
| content: | ||
| name: IMAGE_PULL_SECRET_NAME | ||
| value: t-regcred | ||
|
|
||
| - it: renders no Secret and no imagePullSecrets on a public pull | ||
| # Absence has to be REAL: client-runtime reads it as "pull publicly", so a | ||
| # dangling reference here is the original defect in the other direction. | ||
| template: templates/jobs-manager-deployment.yaml | ||
| asserts: | ||
| - isNull: | ||
| path: spec.template.spec.imagePullSecrets |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.