mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #64191 from stewart-yu/stewart-ctr-codeclean
Automatic merge from submit-queue (batch tested with PRs 59851, 64114, 63912, 64156, 64191). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. smaller code clean for cloud-controller manager **What this PR does / why we need it**: As PR [https://github.com/kubernetes/kubernetes/pull/63283](https://github.com/kubernetes/kubernetes/pull/63283) nits, do some code clean for `cloud-controller manager`. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: /assign @luxas **Release note**: ```release-note NONE ```
This commit is contained in:
commit
d4c314daaa
@ -45,6 +45,11 @@ import (
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
const (
|
||||
// CloudControllerManagerUserAgent is the userAgent name when starting cloud-controller managers.
|
||||
CloudControllerManagerUserAgent = "cloud-controller-manager"
|
||||
)
|
||||
|
||||
// CloudControllerManagerOptions is the main context object for the controller manager.
|
||||
type CloudControllerManagerOptions struct {
|
||||
CloudProvider *cmoptions.CloudProviderOptions
|
||||
@ -165,7 +170,7 @@ func (o *CloudControllerManagerOptions) ApplyTo(c *cloudcontrollerconfig.Config,
|
||||
}
|
||||
|
||||
// sync back to component config
|
||||
// TODO: find more elegant way than synching back the values.
|
||||
// TODO: find more elegant way than syncing back the values.
|
||||
c.ComponentConfig.KubeCloudShared.Port = int32(o.InsecureServing.BindPort)
|
||||
c.ComponentConfig.KubeCloudShared.Address = o.InsecureServing.BindAddress.String()
|
||||
|
||||
@ -213,13 +218,13 @@ func (o *CloudControllerManagerOptions) Validate() error {
|
||||
}
|
||||
|
||||
// Config return a cloud controller manager config objective
|
||||
func (o CloudControllerManagerOptions) Config() (*cloudcontrollerconfig.Config, error) {
|
||||
func (o *CloudControllerManagerOptions) Config() (*cloudcontrollerconfig.Config, error) {
|
||||
if err := o.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c := &cloudcontrollerconfig.Config{}
|
||||
if err := o.ApplyTo(c, "cloud-controller-manager"); err != nil {
|
||||
if err := o.ApplyTo(c, CloudControllerManagerUserAgent); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -230,5 +235,6 @@ func createRecorder(kubeClient kubernetes.Interface, userAgent string) record.Ev
|
||||
eventBroadcaster := record.NewBroadcaster()
|
||||
eventBroadcaster.StartLogging(glog.Infof)
|
||||
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
|
||||
// TODO: remove dependence on the legacyscheme
|
||||
return eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: userAgent})
|
||||
}
|
||||
|
@ -111,7 +111,6 @@ func TestAddFlags(t *testing.T) {
|
||||
"--contention-profiling=true",
|
||||
"--controller-start-interval=2m",
|
||||
"--http2-max-streams-per-connection=47",
|
||||
"--min-resync-period=5m",
|
||||
"--kube-api-burst=100",
|
||||
"--kube-api-content-type=application/vnd.kubernetes.protobuf",
|
||||
"--kube-api-qps=50.0",
|
||||
@ -122,13 +121,12 @@ func TestAddFlags(t *testing.T) {
|
||||
"--leader-elect-resource-lock=configmap",
|
||||
"--leader-elect-retry-period=5s",
|
||||
"--master=192.168.4.20",
|
||||
"--min-resync-period=8h",
|
||||
"--min-resync-period=100m",
|
||||
"--node-status-update-frequency=10m",
|
||||
"--port=10000",
|
||||
"--profiling=false",
|
||||
"--node-status-update-frequency=10m",
|
||||
"--route-reconciliation-period=30s",
|
||||
"--secure-port=10001",
|
||||
"--min-resync-period=100m",
|
||||
"--use-service-account-credentials=false",
|
||||
}
|
||||
f.Parse(args)
|
||||
|
Loading…
Reference in New Issue
Block a user