Skip to content

[OCPCLOUD-1070] Add observe external switch to cloudpovider observer#895

Merged
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
Danil-Grigorev:observe-external
Jul 2, 2021
Merged

[OCPCLOUD-1070] Add observe external switch to cloudpovider observer#895
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
Danil-Grigorev:observe-external

Conversation

@Danil-Grigorev
Copy link
Copy Markdown

@Danil-Grigorev Danil-Grigorev commented Sep 16, 2020

This method is used in KCMO and KAPIO to set the cloud-provider flags.

FeatureGate "ExternalCloudProvider" will short-circuit logic to "external" for supported platforms.

This PR is the main blocker for work on CCM integration in Openshift: https://issues.redhat.com/browse/OCPCLOUD-1070

@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 16, 2020
@Danil-Grigorev Danil-Grigorev force-pushed the observe-external branch 2 times, most recently from 909099b to 036f815 Compare September 17, 2020 09:52
@openshift-ci-robot
Copy link
Copy Markdown

@Danil-Grigorev: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/unit 036f815 link /test unit

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-bot
Copy link
Copy Markdown

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 16, 2020
@openshift-bot
Copy link
Copy Markdown

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci-robot openshift-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 15, 2021
@Danil-Grigorev Danil-Grigorev force-pushed the observe-external branch 3 times, most recently from 45293b7 to 8fc60e1 Compare February 14, 2021 20:09
@Danil-Grigorev
Copy link
Copy Markdown
Author

/remove-lifecycle rotten

@openshift-ci-robot openshift-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Feb 15, 2021

external, err := cloudprovider.IsCloudProviderExternal(infrastructure.Status.Platform, featureGate)
if err != nil {
recorder.Eventf("ObserveCloudProviderNames", "Invalid featuregate.%s/cluster format: %v", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This error description seems oddly specific given its for a call IsCloudProviderExternal, would it not make more sense for it to say something like Could not determine external cloud provider state: %v?

@Danil-Grigorev Danil-Grigorev changed the title [WIP] Add observe external switch to cloudpovider observer Add observe external switch to cloudpovider observer Feb 17, 2021
@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 Feb 17, 2021
@JoelSpeed
Copy link
Copy Markdown
Contributor

/lgtm

Code changes look ok to me, how has this been tested?

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 17, 2021
@Danil-Grigorev
Copy link
Copy Markdown
Author

/lgtm

Code changes look ok to me, how has this been tested?

cluster-bot allows to do that, with revendored change in openshift/cluster-kube-controller-manager-operator#450 I was using my branch until this moment.

if err := unstructured.SetNestedStringSlice(observedConfig, []string{"external"}, c.cloudProviderNamePath...); err != nil {
errs = append(errs, err)
}
return observedConfig, errs
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You need to set if err := listers.ResourceSyncer().SyncConfigMap to the correct (empty I think) value, in this case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That is right, but #994 requires this cloud-config to be copied even for external cloud-config option, as there still will be a consumer in some cases, like for KCM.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That is right, but #994 requires this cloud-config to be copied even for external cloud-config option, as there still will be a consumer in some cases, like for KCM.

Coding by side-effect is bad practice. As I see it, if you want to rely on the same configmap, it makes sense to produce a separate configobserver function which both of these methods can rely upon.

As coded here, you aren't doing any copy when you start external anyway, so this broke the active resource sync.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You are right, sorry for confusion. We definitely don't need a side effect on configobserver which will copy cloud-config to destination for the --external-cloud-provider-plugin flag in another PR, it will do this separately. But we should not remove it from there as well, so I think that this part is currently correct. It won't remove cloud-config which some other observer might place there. #994 will address that.

Comment thread pkg/operator/configobserver/cloudprovider/observe_cloudprovider.go Outdated
Comment thread pkg/operator/configobserver/cloudprovider/observe_cloudprovider.go Outdated
Comment thread pkg/operator/configobserver/cloudprovider/observe_cloudprovider.go Outdated
@mfojtik
Copy link
Copy Markdown
Contributor

mfojtik commented Jun 14, 2021

validCloudProviders := sets.NewString("aws", "azure", "gce", "openstack", "vsphere")

how this change affects ^ ?

@JoelSpeed
Copy link
Copy Markdown
Contributor

how this change affects ^ ?

We discussed this with Stefan on a call. For now, the observer has a side effect where for certain platforms, it will synchronise the configmap as part of the config observation. We have created this PR so that we don't change the logic here and this side effect is still in place.

In the longer term, anything that actually needs the configmap to be synced will have to do this explicitly. Eg using the resourcesynccontroller directly in their own sync loops. Because we still need the configmap for KCM, we will implement the sync there as part of 4.9. Then the plan is to remove this sync so that this method is side effect free. We will also be syncing it directly in our CCCMO. I think by the time we fully migrate, only CCCMO and storage will actually need this and KCM/KAS/MCO will no longer need them.

@Danil-Grigorev
Copy link
Copy Markdown
Author

validCloudProviders := sets.NewString("aws", "azure", "gce", "openstack", "vsphere")

how this change affects ^ ?

This list is unaffected, until IsCloudProvider says otherwise.

This method is used in KCMO and KAPIO to set the cloud-provider flags.
FeatureGate will short-circuit logic to "external" for supported
platforms.

- Adds fg dependency in cloudprovider observer
@Danil-Grigorev Danil-Grigorev requested review from elmiko and mfojtik June 14, 2021 16:10
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 14, 2021
Copy link
Copy Markdown

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

looks good to me @Danil-Grigorev , given our discussion with the team today will we add another patch on top of this for the upcoming changes to IsCloudProviderExternal ?
/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 14, 2021
@Danil-Grigorev
Copy link
Copy Markdown
Author

looks good to me @Danil-Grigorev , given our discussion with the team today will we add another patch on top of this for the upcoming changes to IsCloudProviderExternal ?
/lgtm

Yes, there will be a signature change coming short after for Azure and Azure Stack Hub support, but this PR depends on API change which didn't merge yet, so it could wait. This PR could merge first, and then #1077 could also update the usage in cloud provider observer.

@Fedosin
Copy link
Copy Markdown
Contributor

Fedosin commented Jun 15, 2021

/lgtm

@lobziik
Copy link
Copy Markdown
Contributor

lobziik commented Jun 15, 2021

/lgtm

@Danil-Grigorev Danil-Grigorev changed the title Add observe external switch to cloudpovider observer [OCPCLOUD-1070] Add observe external switch to cloudpovider observer Jun 16, 2021
Copy link
Copy Markdown

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm
/assign @deads2k
for approval

@sttts
Copy link
Copy Markdown
Contributor

sttts commented Jul 2, 2021

/approve

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jul 2, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Danil-Grigorev, elmiko, Fedosin, JoelSpeed, lobziik, soltysh, sttts

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 openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 2, 2021
@openshift-merge-robot openshift-merge-robot merged commit 886aa35 into openshift:master Jul 2, 2021
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.