Skip to content

Fix config/crd/bases vs helm/crds list-marker mismatch (gofmt ordering) - #737

Open
HansG89 wants to merge 1 commit into
aws-controllers-k8s:mainfrom
HansG89:fix/crd-bases-helm-crds-bullet-mismatch
Open

Fix config/crd/bases vs helm/crds list-marker mismatch (gofmt ordering)#737
HansG89 wants to merge 1 commit into
aws-controllers-k8s:mainfrom
HansG89:fix/crd-bases-helm-crds-bullet-mismatch

Conversation

@HansG89

@HansG89 HansG89 commented Aug 19, 2026

Copy link
Copy Markdown

Problem

For any generated field whose Go doc comment contains a Markdown bullet list (e.g. an enum's valid-values doc), config/crd/bases/*.yaml and helm/crds/*.yaml permanently disagree on the list-marker style (* vs -) for identical description text.

Example live on aws-controllers-k8s/glue-controller main today (Job.spec.jobMode doc):

helm/crds/glue.services.k8s.aws_jobs.yaml:2815:                    - SCRIPT - The job was created using the Glue Studio script editor.
config/crd/bases/glue.services.k8s.aws_jobs.yaml:2815:                     * SCRIPT - The job was created using the Glue Studio script editor.

Root cause

config/crd/bases and helm/crds are each produced by their own controller-gen crd call against the same generated apis/<version> source, but on opposite sides of a gofmt pass: scripts/build-controller.sh runs controller-gen crd for config/crd/bases before its end-of-script gofmt -w, while scripts/build-controller-release.sh (run right after, same make build-controller) runs its own controller-gen crd for helm/crds against the now-gofmt'd source. gofmt rewrites *-style Markdown list markers in doc comments to -, so the two targets capture the same comment before/after that rewrite and disagree forever.

Fix

Move the doc-comment-normalizing gofmt -w to run right after ack-generate apis, before either controller-gen crd call. No-op on already-formatted source.

Verification

make build-controller SERVICE=glue twice back-to-back: config/crd/bases and helm/crds now byte-identical for jobMode and the rest of the schema; second run idempotent.

cc @michaelhtm

controller-gen crd runs twice per service across build-controller.sh
(config/crd/bases) and build-controller-release.sh (helm/crds), reading
from the same generated apis/ Go source tree. gofmt's doc-comment
reformatter rewrites Markdown "*" list markers to "-" (Go 1.19+), but
previously only ran once, at the very end of build-controller.sh, after
the config/crd/bases controller-gen call but before the
build-controller-release.sh one. So for any field whose doc comment has
a bullet list, config/crd/bases and helm/crds permanently disagree on
marker style for identical text -- regenerating always flips one file's
CRD YAML relative to the other's.

Move the gofmt call to run immediately after ack-generate produces the
apis/ source, before either controller-gen crd invocation, so both
capture doc comments on the same side of gofmt's rewrite.
@ack-prow
ack-prow Bot requested review from jlbutler and knottnt August 19, 2026 07:56
@ack-prow

ack-prow Bot commented Aug 19, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: HansG89
Once this PR has been reviewed and has the lgtm label, please assign a-hilaly for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 19, 2026
@ack-prow

ack-prow Bot commented Aug 19, 2026

Copy link
Copy Markdown

Hi @HansG89. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

HansG89 added a commit to HansG89/glue-controller that referenced this pull request Aug 19, 2026
Regenerates the controller using aws-controllers-k8s/code-generator#737,
which moves gofmt's doc-comment normalization to run before either
controller-gen crd invocation, instead of only after the first one.

Without this fix, config/crd/bases/*.yaml and helm/crds/*.yaml disagree
on Markdown list-marker style (* vs -) for the same enum description
text (e.g. Job.spec.jobMode), which is what was failing
glue-verify-code-gen on this PR. Both CRD YAML targets now agree.
@HansG89

HansG89 commented Aug 26, 2026

Copy link
Copy Markdown
Author

@a-hilaly @knottnt pinging since this is currently blocking glue-controller#16's CI (glue-verify-code-gen fails without this fix). It's just a formatting-ordering mismatch between config/crd/bases and helm/crds output, no functional change, and hasn't had /ok-to-test yet.

Would appreciate a look when you get a chance, since it's the last thing standing between glue#16 and a mergeable state.

Thank you!

@knottnt

knottnt commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

@HansG89 I don't think this is the root cause of the verify-code-gen failures in aws-controllers-k8s/glue-controller#16. That CI test checks whether or not the CI generated files match what's in the PR and not whether Helm vs config/crd/bases are identical.

@HansG89

HansG89 commented Sep 3, 2026

Copy link
Copy Markdown
Author

@HansG89 I don't think this is the root cause of the verify-code-gen failures in aws-controllers-k8s/glue-controller#16. That CI test checks whether or not the CI generated files match what's in the PR and not whether Helm vs config/crd/bases are identical.

You're right. PR16's failure was code-generator#733, not the list-marker issue this PR fixes. Merging main into PR16 picked up #733 and resynced types.go. Will update this PR's description to drop the glue#16 reference

The bullet-marker divergence is still a real, separate bug. Should we keep this one or close it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants