Skip to content

MachinePools/OpenStack: Fix nil pointer exception#2253

Merged
openshift-merge-bot[bot] merged 2 commits intoopenshift:masterfrom
2uasimojo:HIVE-2476/openstack-npe
Apr 27, 2024
Merged

MachinePools/OpenStack: Fix nil pointer exception#2253
openshift-merge-bot[bot] merged 2 commits intoopenshift:masterfrom
2uasimojo:HIVE-2476/openstack-npe

Conversation

@2uasimojo
Copy link
Member

@2uasimojo 2uasimojo commented Apr 2, 2024

...when MachinePool.Spec.Replicas is unset, as it is when we're doing autoscaling.

The fix was upstream so this PR just revendors to pick it up, and adds unit tests to prove it works.

HIVE-2476

@openshift-ci openshift-ci bot requested review from jstuever and lleshchi April 2, 2024 22:34
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 2, 2024
@2uasimojo
Copy link
Member Author

/hold for QE

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 2, 2024
@codecov
Copy link

codecov bot commented Apr 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.72%. Comparing base (9a5473a) to head (f59f327).
Report is 16 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2253      +/-   ##
==========================================
+ Coverage   58.58%   58.72%   +0.13%     
==========================================
  Files         182      182              
  Lines       25775    25889     +114     
==========================================
+ Hits        15101    15204     +103     
- Misses       9402     9414      +12     
+ Partials     1272     1271       -1     

see 2 files with indirect coverage changes

...to pick up openshift/installer#8227 which
should fix the nil pointer exception described in the referenced card.

HIVE-2476
When MachinePool.Spec.Replicas is unset, as it is when we're doing
autoscaling, this used to trigger a nil pointer exception in the
vendored installer code in the MachineSets function, which used to
assume it would never be nil.

A prior commit revendored installer to pick up a fix whereby that
assumption is no longer relied upon.

Add unit testing to prove that it works.

HIVE-2476
@2uasimojo 2uasimojo force-pushed the HIVE-2476/openstack-npe branch from 8a5c30b to f59f327 Compare April 5, 2024 20:55
Comment on lines +36 to +43
// In installer CLI code paths, the replica number is set to 3 by default
// when install-config does not have any Compute machine-pool, or when the
// Compute machine-pool does not have the `replicas` property.
// However, external consumers of this func may not be so kind...
if pool.Replicas == nil {
pool.Replicas = ptr.To[int64](0)
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Reviewer: Upstream fix here 👀

@2uasimojo
Copy link
Member Author

security fail to be fixed in #2256

@2uasimojo
Copy link
Member Author

/test security
/hold cancel
/assign @lleshchi

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 26, 2024
@lleshchi
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 26, 2024
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 2uasimojo, lleshchi

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

The pull request process is described here

Details 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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 26, 2024

@2uasimojo: all tests passed!

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit fdbfaf0 into openshift:master Apr 27, 2024
@2uasimojo 2uasimojo deleted the HIVE-2476/openstack-npe branch April 29, 2024 15:01
2uasimojo added a commit to 2uasimojo/hive that referenced this pull request Apr 30, 2024
This is *not* a cherry-pick of openshift#2253 / (c6b37ee & f59f327). That
solution revendored installer to pick up the fix from upstream. In older
branches, this would have dragged in too many dependencies, so we
instead fix it "locally" with an explicit nil check.

Note also that the original fix added unit tests. We can't do that here
either because the new tests rely on the OpenStack UT suite being
un-broken [1], which again relied on upstream changes [2][3] we can't pull into
older branches.

[1] openshift#2251
[2] openshift/installer#8187
[3] openshift/installer#8209

HIVE-2476
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/hive that referenced this pull request Aug 8, 2024
This is *not* a cherry-pick of openshift#2253 / (c6b37ee & f59f327). That
solution revendored installer to pick up the fix from upstream. In older
branches, this would have dragged in too many dependencies, so we
instead fix it "locally" with an explicit nil check.

Note also that the original fix added unit tests. We can't do that here
either because the new tests rely on the OpenStack UT suite being
un-broken [1], which again relied on upstream changes [2][3] we can't pull into
older branches.

[1] openshift#2251
[2] openshift/installer#8187
[3] openshift/installer#8209

HIVE-2476
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/hive that referenced this pull request Aug 9, 2024
This is *not* a cherry-pick of openshift#2253 / (c6b37ee & f59f327). That
solution revendored installer to pick up the fix from upstream. In older
branches, this would have dragged in too many dependencies, so we
instead fix it "locally" with an explicit nil check.

Note also that the original fix added unit tests. We can't do that here
either because the new tests rely on the OpenStack UT suite being
un-broken [1], which again relied on upstream changes [2][3] we can't pull into
older branches.

[1] openshift#2251
[2] openshift/installer#8187
[3] openshift/installer#8209

HIVE-2476
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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants