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

Bug 1880443: fix Openstack machinesets #1141

Merged

Conversation

joelddiaz
Copy link
Contributor

  • vendor in new installer with ability to provide our own OpenStack credentials fetching functions
  • provide custom credentials fetching functions that use the contents of the ClusterDeployment's secret as the credentials source
  • provide an empty (non-nil) list of Zones when creating MachinePools to MachineSets for OpenStack

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 17, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 17, 2020
@joelddiaz
Copy link
Contributor Author

this depends on the changes in openshift/installer#4196

Comment on lines 10 to 11

"github.com/gophercloud/utils/openstack/clientconfig"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"github.com/gophercloud/utils/openstack/clientconfig"
"github.com/gophercloud/utils/openstack/clientconfig"


credsSecret := &corev1.Secret{}
if err := kubeClient.Get(context.TODO(), credsSecretKey, credsSecret); err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return nil, err
return nil, errors.Wrap(err, "failed to get OpenStack credentials")


cloudsYaml, ok := credsSecret.Data[constants.OpenStackCredentialsName]
if !ok {
return nil, errors.New("did not find credentials in the ClusterDeployment's secret")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return nil, errors.New("did not find credentials in the ClusterDeployment's secret")
return nil, errors.New("did not find credentials in the OpenStack credentials secret")

Comment on lines +178 to +181
var clouds clientconfig.Clouds
if err := yaml.Unmarshal(cloudsYaml, &clouds); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

How stable is clientconfig.Clouds? Do you anticipate any issues with supporting older OpenShift versions that may use an older version of this type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good question. Outside of this PR I've never dealt with this package before.
Now that you ask, I would worry not so much about versions of OpenShift but the version of OpenStack that this package will be making calls into. Is there someone more familiar with OpenStack that can perhaps answer this?

As far as OpenShift releases, older versions of the installer made you specify whether this "trunk" support was available, and now it is dynamic. And we mark the field as optional in Hive https://github.com/openshift/hive/blob/master/pkg/apis/hive/v1/openstack/platform.go#L19. This feels like we've just automated detection of what you previously had to specify.

Comment on lines 195 to 196
var secureClouds clientconfig.Clouds
return secureClouds.Clouds, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this just an nil map?

Suggested change
var secureClouds clientconfig.Clouds
return secureClouds.Clouds, nil
return nil, nil

@@ -76,6 +76,7 @@ func (a *OpenStackActuator) GenerateMachineSets(cd *hivev1.ClusterDeployment, po
computePool := baseMachinePool(pool)
computePool.Platform.OpenStack = &installertypesosp.MachinePool{
FlavorName: pool.Spec.Platform.OpenStack.Flavor,
Zones: []string{""},
Copy link
Contributor

Choose a reason for hiding this comment

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

The commit message is not quite right. It states that Hive is providing "an empty (but non-nil) list of zones." However, Hive is actually providing a list with a single empty entry.

I also think it is worth a comment in the code to explain what is happening here.

@@ -76,6 +76,7 @@ func (a *OpenStackActuator) GenerateMachineSets(cd *hivev1.ClusterDeployment, po
computePool := baseMachinePool(pool)
computePool.Platform.OpenStack = &installertypesosp.MachinePool{
FlavorName: pool.Spec.Platform.OpenStack.Flavor,
Zones: []string{""},
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Created a Jira card on our backlog.

@staebler
Copy link
Contributor

Is there any chance that we can re-enable the unit test for the OpenStack actuator as part of this PR? Or are we still far away from that since we have no way of mocking out the call to OpenStack that is baked into the installer?

@joelddiaz joelddiaz changed the title WIP: fix Openstack machinesets WIP: Bug 1880443: fix Openstack machinesets Sep 18, 2020
@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. label Sep 18, 2020
@openshift-ci-robot
Copy link

@joelddiaz: This pull request references Bugzilla bug 1880443, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

WIP: Bug 1880443: fix Openstack machinesets

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.

@openshift-ci-robot openshift-ci-robot added the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Sep 18, 2020
@joelddiaz joelddiaz force-pushed the openstack-machinesets branch 2 times, most recently from c4f3120 to a8da86e Compare September 18, 2020 15:02
@joelddiaz
Copy link
Contributor Author

Is there any chance that we can re-enable the unit test for the OpenStack actuator as part of this PR? Or are we still far away from that since we have no way of mocking out the call to OpenStack that is baked into the installer?

Not yet. We would need more reworking of the installer repo to allow us to stub out the OpenStack client.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 26, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 28, 2020
@twiest twiest removed their request for review October 1, 2020 18:19
@joelddiaz joelddiaz changed the title WIP: Bug 1880443: fix Openstack machinesets Bug 1880443: fix Openstack machinesets Oct 23, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 23, 2020
@joelddiaz
Copy link
Contributor Author

/assign @staebler
/cc @akhil-rane

this PR pre-dates us explicitly assigning and CCing people...

Joel Diaz added 2 commits November 10, 2020 09:36
Use the new ability of the installer to provide OpenStack client options to allow use to provide the contents of the ClusterDeployment's credentials Secret as the "clouds.yaml" file.
The installer machineset generator will distribute all the replicas across the list of zones. If we do not provide a list of zones, we get back an empty list of machinesets. Follow what the installer does, and provide list of zones with exactly one member consisting of the empty string.
@joelddiaz
Copy link
Contributor Author

staebler's hive watch has ended..
/assign @dgoodwin

@dgoodwin
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 18, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dgoodwin, joelddiaz

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

@joelddiaz
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. labels Nov 19, 2020
@openshift-ci-robot
Copy link

@joelddiaz: This pull request references Bugzilla bug 1880443, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

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.

@openshift-ci-robot openshift-ci-robot removed the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Nov 19, 2020
@openshift-merge-robot openshift-merge-robot merged commit cb41795 into openshift:master Nov 23, 2020
@openshift-ci-robot
Copy link

@joelddiaz: All pull requests linked via external trackers have merged:

Bugzilla bug 1880443 has been moved to the MODIFIED state.

In response to this:

Bug 1880443: fix Openstack machinesets

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 Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants