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 panic when datacenter obj is not found #8494

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

rahulbabu95
Copy link
Member

@rahulbabu95 rahulbabu95 commented Jul 17, 2024

Description of changes:
When the config parser is unable to find a object such as Datacenter/MachineConfig due to a typo in the DatacenterRef name (or if it was never passed in the spec), parser just doesn't set that object and doesn't do any validations around it. Accessing those objects later leads to a panic at runtime.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x148 pc=0x103493f20]

This change adds validations on the config, around the Datacenter obj if it's not found in the config to explicitly error out.

Error: unable to get cluster config from file: invalid cluster config: VSphereDatacenterConfig name rahul-130-br-tst1 not found

Fixes #7531

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot eks-distro-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 17, 2024
Copy link

codecov bot commented Jul 17, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.50%. Comparing base (31c6854) to head (c07f0f5).

Files Patch % Lines
pkg/cluster/cloudstack.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8494   +/-   ##
=======================================
  Coverage   73.49%   73.50%           
=======================================
  Files         578      578           
  Lines       36504    36514   +10     
=======================================
+ Hits        26829    26840   +11     
+ Misses       7956     7954    -2     
- Partials     1719     1720    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eks-distro-bot eks-distro-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 17, 2024
Signed-off-by: Rahul Ganesh <rahulgab@amazon.com>
@rahulbabu95
Copy link
Member Author

/approve

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rahulbabu95

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

@eks-distro-bot eks-distro-bot merged commit ec6f0d3 into aws:main Jul 17, 2024
12 checks passed
@rahulbabu95
Copy link
Member Author

/cherrypick release-0.20

@rahulbabu95
Copy link
Member Author

/cherrypick release-0.19

@eks-distro-pr-bot
Copy link
Contributor

@rahulbabu95: new pull request created: #8495

In response to this:

/cherrypick release-0.20

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/test-infra repository.

@eks-distro-pr-bot
Copy link
Contributor

@rahulbabu95: new pull request created: #8496

In response to this:

/cherrypick release-0.19

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix panic when there is a datacenterRef mismatch
4 participants