dex: render the authcodes CustomResourceDefinition from templates - #3574
Draft
danish9039 wants to merge 2 commits into
Draft
dex: render the authcodes CustomResourceDefinition from templates#3574danish9039 wants to merge 2 commits into
danish9039 wants to merge 2 commits into
Conversation
Helm never upgrades or deletes anything in a chart crds directory, so the definition kept its first-install schema forever and a plain helm template emitted no CustomResourceDefinition at all. Render it from templates/crds.yaml with helm.sh/resource-policy: keep, gated by crds.enabled. The template is hand-written because a copied file cannot carry the annotation, so the synchronization script and a new test both fail when it drifts from common/dex/base/upstream/crds.yaml. Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
The comparison skips the retention check entirely for a component with no EXPECTED_HELM_CRD_RESOURCE_POLICIES entry, so moving the definition into a crds directory went unnoticed. Declaring dex makes that regression fail the comparison. Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
3 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The problem
Rendering the Dex chart with
helm templateproduced no CustomResourceDefinition at all:authcodes.dex.coreos.comlived in the chart'scrds/directory, which Helm only installs with--include-crds. Rendering the chart and applying the output — a documented installation path — therefore installed a Dex that cannot store OAuth authorization codes.Two further consequences of that directory:
--dry-run, so custom resources cannot be validated against it.The change
The definition is now rendered from
common/dex/helm/templates/crds.yaml, carryinghelm.sh/resource-policy: keep, gated bycrds.enabled(defaulttrue).helm upgradeupdates the schema;helm uninstallkeeps the definition and theAuthCodeobjects. Setcrds.enabled=falsewhen an administrator manages CustomResourceDefinitions separately.This deliberately deviates from Helm's published recommendation to use
crds/, matching whatapplications/dashboard/helmalready does forprofiles.kubeflow.organdpoddefaults.kubeflow.org. The chart README states the deviation and its reason.Why the template is hand-written
scripts/synchronize-dex-manifests.shpreviously copied the upstream file into the chart. A copied file cannot carry the retention annotation, so the chart copy is now hand-written — and two independent checks fail if it drifts from the upstream definition synchronized intocommon/dex/base/upstream/crds.yaml:tests/test_dex_helm_crd_lifecycle.pyruns the same check in continuous integration.Verified by deliberately changing
singular: authcodein the template, which fails with:Making the fix stick
validate_helm_crd_resource_policiesskips any component absent fromEXPECTED_HELM_CRD_RESOURCE_POLICIES, which is why this regression passed the comparison unnoticed. Declaringdexturns it into enforcement — reverting the fix now fails the comparison:Verification
Parity is unaffected:
helm.sh/*annotations are normalized away on both sides, and the rendered resource set is unchanged.