Skip to content

fix: validates CONTROL_PLANE_ENDPOINT_IP and NUTANIX_ENDPOINT are distinct #1002

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 4 commits into from
Dec 18, 2024

Conversation

manoj-nutanix
Copy link
Contributor

What problem does this PR solve?:
webhook errors out if NUTANIX_ENDPOINT IP is same as PC IP. It only implements dumb check which compares PC IP with control-plane IP.

Which issue(s) this PR fixes:
Fixes #
https://jira.nutanix.com/browse/NCN-102626

How Has This Been Tested?:

Special notes for your reviewer:

 clusterctl generate cluster ${CLUSTER_NAME} \   
  --from ${CLUSTER_FILE} \
  --kubernetes-version ${KUBERNETES_VERSION} \
  --worker-machine-count 1 | \
  kubectl apply --server-side -f -
secret/nutanix-cluster-cilium-helm-addon-dockerhub-credentials serverside-applied
secret/nutanix-cluster-cilium-helm-addon-pc-creds-for-csi serverside-applied
Warning: Detected changes to resource nutanix-cluster-cilium-helm-addon-pc-creds which is currently being deleted.
secret/nutanix-cluster-cilium-helm-addon-pc-creds serverside-applied
Error from server (Forbidden): admission webhook "cluster-validator.caren.nutanix.com" denied the request: prism central and control plane endpoint cannot have the same IP "10.47.10.4"

Copy link
Contributor

@dkoshkin dkoshkin left a comment

Choose a reason for hiding this comment

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

Looking good, just a few comments

Copy link
Contributor

@dkoshkin dkoshkin left a comment

Choose a reason for hiding this comment

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

Thanks!

func (s NutanixPrismCentralEndpointSpec) ParseIP() (netip.Addr, error) {
pcHostname, _, err := s.ParseURL()
if err != nil {
return netip.Addr{}, err
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: returning an empty struct here instead of nil kinda smells

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, looks weird at first.. I just followed net/netip pkg semantic, maybe Addr struct doesn't hold much data so they return empty struct instead of nil everywhere.

@manoj-nutanix manoj-nutanix merged commit 6e96d3c into NCN-102628 Dec 18, 2024
21 checks passed
@manoj-nutanix manoj-nutanix deleted the NCN-102626 branch December 18, 2024 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants