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

feat: support reloading the cloud controller manager based on the changes of the config file #769

Merged
merged 1 commit into from Aug 25, 2021

Conversation

nilo19
Copy link
Contributor

@nilo19 nilo19 commented Aug 25, 2021

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Release note:

feat: support reloading the cloud controller manager based on the changes of the config file

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 25, 2021
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 25, 2021
@coveralls
Copy link

coveralls commented Aug 25, 2021

Coverage Status

Coverage remained the same at 80.584% when pulling 36c1635 on nilo19:feat/inotify into 5db2bdc on kubernetes-sigs:master.

klog.Infof("RunFileWatcherOrDie: found file update event: %v", event)
updateChan <- struct{}{}

if strings.EqualFold(event.Name, path) && event.Op&fsnotify.Remove == fsnotify.Remove {
Copy link
Member

Choose a reason for hiding this comment

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

it's better to have a retry (e.g. try 5 times with 1 second interval) to avoid rapid die on the config file changes manually (for example, cluster operator may want to delete the file and copy it to the same filename again)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

fs.StringVar(&o.CloudConfigSecretNamespace, "cloud-config-secret-namespace", "kube-system", "The k8s namespace of the cloud config secret, default to 'kube-system'")
fs.StringVar(&o.CloudConfigKey, "cloud-config-key", "cloud-config", "The key of the config data in the cloud config secret, default to 'cloud-config'")
fs.BoolVar(&o.EnableDynamicReloading, "enable-dynamic-reloading", false, "Enable re-configuring cloud controller manager from secret without restarting.")
//fs.StringVar(&o.CloudConfigFilePath, "cloud-config-file-path", "", "The absolute path to the cloud config file.")
Copy link
Member

Choose a reason for hiding this comment

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

is this test only? let's remove it if so

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -64,7 +65,7 @@ func (o *DynamicReloadingOptions) Validate() []error {
func defaultDynamicReloadingOptions() *DynamicReloadingOptions {
return &DynamicReloadingOptions{
EnableDynamicReloading: false,
CloudConfigSecretName: "azure-cloud-provider",
CloudConfigSecretName: "",
Copy link
Member

Choose a reason for hiding this comment

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

could we keep the default secret name same as before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah we could keep it since it won't break the logic.

@feiskyer
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 25, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feiskyer, nilo19

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

@k8s-ci-robot k8s-ci-robot merged commit 370810d into kubernetes-sigs:master Aug 25, 2021
@nilo19 nilo19 deleted the feat/inotify branch August 25, 2021 13:04
k8s-ci-robot added a commit that referenced this pull request Aug 26, 2021
Cherry pick of #769: feat: reloading ccm when the config file changes
k8s-ci-robot added a commit that referenced this pull request Aug 26, 2021
Cherry pick of #769: feat: reloading ccm when the config file changes
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 Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants