Skip to content

Pass in cloud config file to initialize cloud provider - #164

Merged
k8s-ci-robot merged 2 commits into
kubernetes:masterfrom
nicolehanjing:nicoleh-pass-cloud-config-file
Dec 12, 2020
Merged

Pass in cloud config file to initialize cloud provider#164
k8s-ci-robot merged 2 commits into
kubernetes:masterfrom
nicolehanjing:nicoleh-pass-cloud-config-file

Conversation

@nicolehanjing

Copy link
Copy Markdown
Contributor

pass the value from --cloud-config flag for reading the clusterName value
initialize cloud provider with the cloud provider name and config file provided

What type of PR is this?
/kind feature
What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 11, 2020
@nicolehanjing

Copy link
Copy Markdown
Contributor Author

/assign @andrewsykim

}

cloudConfigFlag := cmd.Flags().Lookup("cloud-config")
if cloudConfigFlag.Value.String() == "" {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that the cloud config file would actually be available as c.ComponentConfig.KubeCloudShared.CloudProvider.CloudConfigFile after we run s.Config() on line 119.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so no need to use cmd to look up the flag value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see!

os.Exit(1)
}

cloudConfigFile := c.ComponentConfig.KubeCloudShared.CloudProvider.CloudConfigFile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@andrewsykim updated! I think it would be good to warn when the file path is empty, wdyt?

@andrewsykim andrewsykim Dec 11, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the warning isn't needed if the process would exit and fail if it was empty. But we would need to double check if that's the case. If --cloud-config is optional the warning is probably not needed either.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

gotcha, I think the configuration file path is optional by checking the code, so I remove the warning here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The examples should probably be updated as well instead of using a hardcoded path https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/cloud-provider/sample/basic_main.go#L66

@nicolehanjing
nicolehanjing force-pushed the nicoleh-pass-cloud-config-file branch from bb2e03b to 3b384bb Compare December 11, 2020 23:51

@andrewsykim andrewsykim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/approve
/lgtm

Thanks @nicolehanjing

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 12, 2020
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewsykim, nicolehanjing

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

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants