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

Fix webhook panic when VPC is nil in IBMPowerVSCluster spec #2038

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

Karthik-K-N
Copy link
Contributor

What this PR does / why we need it:

This PR contains changes to avoid webhook panic

Before change

$ cat template.yaml
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMPowerVSCluster
metadata:
  annotations:
    powervs.cluster.x-k8s.io/create-infra: "true"
  labels:
    cluster.x-k8s.io/cluster-name: capi-powervs-karthik-two
  name: capi-powervs-karthik-two
  namespace: default
spec:
  serviceInstance:
    name: capi-powervs-karthik-two-serviceInstance
    
$ kubectl create -f template.yaml

Error from server (InternalError): error when creating "/Users/karthikkn/karthik-k8-workspace/cluster-api-provider-ibmcloud/templates/new.yaml": Internal error occurred: failed calling webhook "vibmpowervscluster.kb.io": failed to call webhook: Post "https://capi-ibmcloud-webhook-service.capi-ibmcloud-system.svc:443/validate-infrastructure-cluster-x-k8s-io-v1beta2-ibmpowervscluster?timeout=10s": EOF

After this fix

$ kubectl create -f template.yaml

The IBMPowerVSCluster "capi-powervs-karthik-two" is invalid:
* spec.zone: Invalid value: "null": value of zone is empty
* spec.vpc: Invalid value: "null": value of VPC is empty
* spec.resourceGroup: Invalid value: "null": value of resource group is empty

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

/area provider/ibmcloud

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

Fixed webhook panic when VPC is nil in IBMPowerVSCluster spec

@k8s-ci-robot k8s-ci-robot added the area/provider/ibmcloud Issues or PRs related to ibmcloud provider label Nov 5, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 5, 2024
Copy link

netlify bot commented Nov 5, 2024

Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!

Name Link
🔨 Latest commit e2a3d87
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/672a0b9c619cba0008b7fbe8
😎 Deploy Preview https://deploy-preview-2038--kubernetes-sigs-cluster-api-ibmcloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@Amulyam24 Amulyam24 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 5, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Amulyam24, Karthik-K-N, mkumatag

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2024
@k8s-ci-robot k8s-ci-robot merged commit 7fcd3c3 into kubernetes-sigs:main Nov 5, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants