Skip to content
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

Validate CRD Spec fields #83

Merged
merged 2 commits into from
Nov 30, 2023
Merged

Validate CRD Spec fields #83

merged 2 commits into from
Nov 30, 2023

Conversation

bigkevmcd
Copy link
Contributor

@bigkevmcd bigkevmcd commented Nov 24, 2023

This configures the CRD to require that we have either a CAPI Cluster ref, or a Secret ref.

GitopsClusters will be rejected if they have neither, or have both.

This will prevent https://github.com/weaveworks/weave-gitops-enterprise/issues/3672

@bigkevmcd bigkevmcd requested a review from yiannistri November 24, 2023 09:46
@bigkevmcd bigkevmcd marked this pull request as draft November 24, 2023 10:22
This configures the CRD to require that we have either a CAPI Cluster
ref, or a Secret ref.

GitopsClusters will be rejected if they have neither, or have both.
@bigkevmcd bigkevmcd marked this pull request as ready for review November 24, 2023 10:41
@bigkevmcd bigkevmcd requested a review from foot November 30, 2023 13:50
@@ -62,6 +64,7 @@ func (in *GitopsCluster) SetConditions(conditions []metav1.Condition) {
// +kubebuilder:printcolumn:name="ClusterConnectivity",type="string",JSONPath=".status.conditions[?(@.type==\"ClusterConnectivity\")].status",description=""

// GitopsCluster is the Schema for the gitopsclusters API
// +kubebuilder:validation:XValidation:rule="has(self.spec)",message="must confgure spec"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// +kubebuilder:validation:XValidation:rule="has(self.spec)",message="must confgure spec"
// +kubebuilder:validation:XValidation:rule="has(self.spec)",message="must configure spec"

@bigkevmcd bigkevmcd merged commit 1d0c71d into main Nov 30, 2023
2 checks passed
@bigkevmcd bigkevmcd deleted the validate-fields branch November 30, 2023 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants