Skip to content

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.

4 participants