Skip to content

Conversation

@kthurman59
Copy link

@kthurman59 kthurman59 commented Nov 23, 2025

Summary

Align source.toolkit.fluxcd.io/v1 CRD validation with the existing v1beta2 behavior and documentation.

Changes

HelmChart

  • Add XValidation so .spec.verify is only allowed when .spec.sourceRef.kind is "HelmRepository", consistent with v1beta2 semantics.

No controller logic changes, only schema-level validation so invalid specs fail at admission instead of at reconciliation.

Testing

On an Ubuntu VM:

  • make manifests
  • cd api && go test ./...
  • export KUBEBUILDER_ASSETS=/home/kevin/src/github.com/kthurman59/source-controller/build/testbin/k8s/1.34.1-linux-amd64
  • go test ./...

Copy link
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@stefanprodan
Copy link
Member

stefanprodan commented Nov 24, 2025

Setting defaults for optional values will cause drift and etcd mutation, also all the CLI tests will fail as we don't expect for optional values to come back from etcd if they are not in the desired state.

@stefanprodan stefanprodan added the hold Issues and pull requests put on hold label Nov 24, 2025
@kthurman59
Copy link
Author

Thanks Stefan! I am on it!

@kthurman59 kthurman59 force-pushed the feature/crd-validation-source-v1 branch from 1a445f9 to f2508bd Compare November 24, 2025 15:37
@kthurman59
Copy link
Author

Thanks for the feedback. I’ve removed the defaults from the optional fields in GitRepository and HelmRepository and regenerated the CRDs, so this PR now only adds the HelmChart XValidation.

Testing:

  • make manifests
  • cd api && go test ./...
  • export KUBEBUILDER_ASSETS=/home/kevin/src/github.com/kthurman59/source-controller/build/testbin/k8s/1.34.1-linux-amd64
  • go test ./...

@kthurman59 kthurman59 force-pushed the feature/crd-validation-source-v1 branch from f2508bd to 1d52fa7 Compare November 24, 2025 16:02
@kthurman59
Copy link
Author

I also fixed the missing DCO signing for my commits.

@matheuscscp
Copy link
Member

Also squash please 🙏

@kthurman59 kthurman59 force-pushed the feature/crd-validation-source-v1 branch from 1d52fa7 to 4646ca6 Compare November 24, 2025 16:17
@kthurman59
Copy link
Author

Squashed!!

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

Labels

hold Issues and pull requests put on hold

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants