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(nodegroup): add nil pointer check for nodegroup version #5019

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nueavv
Copy link

@nueavv nueavv commented Jun 13, 2024

Added a check to ensure that the nodegroup version is not nil before dereferencing it. This prevents potential runtime panics due to nil pointer dereference.

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR adds a nil pointer check for the nodegroup version in the reconcileNodegroupVersion function. This prevents potential runtime panics caused by dereferencing a nil pointer when the nodegroup version is not set.

Which issue(s) this PR fixes:
Fixes #5018

Special notes for your reviewer:

This change is essential to ensure the stability of the reconcileNodegroupVersion function by preventing nil pointer dereference issues.

Checklist:

  • squashed commits
  • includes documentation
  • includes emojis
  • adds unit tests
  • adds or updates e2e tests

Release note:

Fix nil pointer dereference in reconcileNodegroupVersion by adding a check for nodegroup version.

@k8s-ci-robot
Copy link
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 13, 2024
Copy link

linux-foundation-easycla bot commented Jun 13, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: nueavv / name: 1102 (50c23fb)

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-priority labels Jun 13, 2024
@k8s-ci-robot k8s-ci-robot requested a review from faiq June 13, 2024 04:12
@k8s-ci-robot
Copy link
Contributor

Welcome @nueavv!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-aws 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-provider-aws has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 13, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @nueavv. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 13, 2024
@nueavv
Copy link
Author

nueavv commented Jun 13, 2024

I have built and tested the updated code, and it seems that the panic no longer occurs. Here are the updated logs.
It seems the panic issue has been resolved

I0613 04:01:44.064508       1 reconcile.go:39] "Reconciling kube-proxy DaemonSet in cluster" controller="awsmanagedcontrolplane" controllerGroup="controlplane.cluster.x-k8s.io" controllerKind="AWSManagedControlPlane" AWSManagedControlPlane="capi-managed-cluster/[REDACTED]" namespace="capi-managed-cluster" name="[REDACTED]" reconcileID="a4ce3943-5cdb-4467-aba9-18a759fd6cb2" awsManagedControlPlane="capi-managed-cluster/[REDACTED]" cluster="capi-managed-cluster/[REDACTED]"
I0613 04:01:44.065051       1 reconcile.go:39] "Reconciling aws-iam-authenticator configuration" controller="awsmanagedcontrolplane" controllerGroup="controlplane.cluster.x-k8s.io" controllerKind="AWSManagedControlPlane" AWSManagedControlPlane="capi-managed-cluster/[REDACTED]" namespace="capi-managed-cluster" name="[REDACTED]" reconcileID="a4ce3943-5cdb-4467-aba9-18a759fd6cb2" awsManagedControlPlane="capi-managed-cluster/[REDACTED]" cluster="capi-managed-cluster/[REDACTED]"
E0613 04:01:44.386103       1 controller.go:329] "Reconciler error" err="failed to reconcile machine pool for AWSManagedMachinePool capi-managed-cluster/[REDACTED]: failed to reconcile nodegroup version: nodegroup version is nil" controller="awsmanagedmachinepool" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="AWSManagedMachinePool" AWSManagedMachinePool="capi-managed-cluster/[REDACTED]" namespace="capi-managed-cluster" name="[REDACTED]" reconcileID="3e0c724f-236b-4262-9c06-e22f83b0eacd"
I0613 04:01:44.386891       1 awsmanagedmachinepool_controller.go:200] "Reconciling AWSManagedMachinePool"
I0613 04:01:44.387068       1 launchtemplate.go:73] "checking for existing launch template"
I0613 04:01:44.439150       1 reconcile.go:90] "Reconciled aws-iam-authenticator configuration" controller="awsmanagedcontrolplane" controllerGroup="controlplane.cluster.x-k8s.io" controllerKind="AWSManagedControlPlane" AWSManagedControlPlane="capi-managed-cluster/[REDACTED]" namespace="capi-managed-cluster" name="[REDACTED]" reconcileID="a4ce3943-5cdb-4467-aba9-18a759fd6cb2" awsManagedControlPlane="capi-managed-cluster/[REDACTED]" cluster="[REDACTED]"
E0613 04:01:44.858183       1 controller.go:329] "Reconciler error" err="failed to reconcile machine pool for AWSManagedMachinePool capi-managed-cluster/[REDACTED]: failed to reconcile nodegroup version: nodegroup version is nil" controller="awsmanagedmachinepool" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="AWSManagedMachinePool" AWSManagedMachinePool="capi-managed-cluster/[REDACTED]" namespace="capi-managed-cluster" name="[REDACTED]" reconcileID="9bec8c74-79d0-4b39-bd40-607a5d899630"
I0613 04:01:44.859110       1 awsmanagedmachinepool_controller.go:200] "Reconciling AWSManagedMachinePool"
I0613 04:01:44.859320       1 launchtemplate.go:73] "checking for existing launch template"
E0613 04:01:45.297763       1 controller.go:329] "Reconciler error" err="failed to reconcile machine pool for AWSManagedMachinePool capi-managed-cluster/[REDACTED]: failed to reconcile nodegroup version: nodegroup version is nil" controller="awsmanagedmachinepool" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="AWSManagedMachinePool" AWSManagedMachinePool="capi-managed-cluster/[REDACTED]" namespace="capi-managed-cluster" name="[REDACTED]" reconcileID="91a7cb58-d6f8-4e8f-aa06-62acce826b74"
I0613 04:01:45.298635       1 awsmanagedmachinepool_controller.go:200] "Reconciling AWSManagedMachinePool"
I0613 04:01:45.298821       1 launchtemplate.go:73] "checking for existing launch template"
E0613 04:01:45.743834       1 controller.go:329] "Reconciler error" err="failed to reconcile machine pool for AWSManagedMachinePool capi-managed-cluster/[REDACTED]: failed to reconcile nodegroup version: nodegroup version is nil" controller="awsmanagedmachinepool" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="AWSManagedMachinePool" AWSManagedMachinePool="capi-managed-cluster/[REDACTED]" namespace="capi-managed-cluster" name="[REDACTED]" reconcileID="ef2c12c6-5c2b-4553-a62e-f69ce561d6d9"
I0613 04:01:45.744691       1 awsmanagedmachinepool_controller.go:200] "Reconciling AWSManagedMachinePool"
I0613 04:01:45.744882       1 launchtemplate.go:73] "checking for existing launch template"
E0613 04:01:46.178107       1 controller.go:329] "Reconciler error" err="failed to reconcile machine pool for AWSManagedMachinePool capi-managed-cluster/[REDACTED]: failed to reconcile nodegroup version: nodegroup version is nil" controller="awsmanagedmachinepool" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="AWSManagedMachinePool" AWSManagedMachinePool="capi-managed-cluster/[REDACTED]" namespace="capi-managed-cluster" name="[REDACTED]" reconcileID="a0c1977f-6e74-499e-805c-147fe74d8e39"
I0613 04:01:46.178945       1 awsmanagedmachinepool_controller.go:200] "Reconciling AWSManagedMachinePool"
I0613 04:01:46.179150       1 launchtemplate.go:73] "checking for existing launch template"

@nueavv nueavv changed the title fix(nodegroup): add nil pointer check for nodegroup version 🐛 fix(nodegroup): add nil pointer check for nodegroup version Jun 13, 2024
@richardcase
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 1, 2024
@nueavv
Copy link
Author

nueavv commented Sep 17, 2024

Hi @faiq @vincepri Could you please review this PR when you have time?

Signed-off-by: nueavv <nuguni@kakao.com>
@nueavv nueavv reopened this Oct 1, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign richardcase for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/bug Categorizes issue or PR as related to a bug. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
3 participants