mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
Fresh dep ensure
This commit is contained in:
4
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/BUILD
generated
vendored
4
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/BUILD
generated
vendored
@ -24,9 +24,7 @@ go_library(
|
||||
"//pkg/util/reflector/prometheus:go_default_library",
|
||||
"//pkg/util/workqueue/prometheus:go_default_library",
|
||||
"//pkg/version/prometheus:go_default_library",
|
||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/logs:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/logs:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
3
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/OWNERS
generated
vendored
3
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/OWNERS
generated
vendored
@ -2,6 +2,7 @@ approvers:
|
||||
- deads2k
|
||||
- lavalamp
|
||||
- mikedanese
|
||||
- sttts
|
||||
reviewers:
|
||||
- '249043822'
|
||||
- a-robinson
|
||||
@ -63,3 +64,5 @@ reviewers:
|
||||
- thockin
|
||||
- timothysc
|
||||
- wojtek-t
|
||||
labels:
|
||||
- sig/api-machinery
|
||||
|
68
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/BUILD
generated
vendored
68
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/BUILD
generated
vendored
@ -29,7 +29,7 @@ go_library(
|
||||
"//pkg/apis/autoscaling/install:go_default_library",
|
||||
"//pkg/apis/batch/install:go_default_library",
|
||||
"//pkg/apis/certificates/install:go_default_library",
|
||||
"//pkg/apis/componentconfig:go_default_library",
|
||||
"//pkg/apis/coordination/install:go_default_library",
|
||||
"//pkg/apis/core/install:go_default_library",
|
||||
"//pkg/apis/events/install:go_default_library",
|
||||
"//pkg/apis/extensions/install:go_default_library",
|
||||
@ -38,12 +38,13 @@ go_library(
|
||||
"//pkg/apis/scheduling/install:go_default_library",
|
||||
"//pkg/apis/settings/install:go_default_library",
|
||||
"//pkg/apis/storage/install:go_default_library",
|
||||
"//pkg/cloudprovider:go_default_library",
|
||||
"//pkg/cloudprovider/providers:go_default_library",
|
||||
"//pkg/controller:go_default_library",
|
||||
"//pkg/controller/apis/config:go_default_library",
|
||||
"//pkg/controller/bootstrap:go_default_library",
|
||||
"//pkg/controller/certificates/approver:go_default_library",
|
||||
"//pkg/controller/certificates/cleaner:go_default_library",
|
||||
"//pkg/controller/certificates/rootcacertpublisher:go_default_library",
|
||||
"//pkg/controller/certificates/signer:go_default_library",
|
||||
"//pkg/controller/clusterroleaggregation:go_default_library",
|
||||
"//pkg/controller/cronjob:go_default_library",
|
||||
@ -68,14 +69,15 @@ go_library(
|
||||
"//pkg/controller/serviceaccount:go_default_library",
|
||||
"//pkg/controller/statefulset:go_default_library",
|
||||
"//pkg/controller/ttl:go_default_library",
|
||||
"//pkg/controller/ttlafterfinished:go_default_library",
|
||||
"//pkg/controller/volume/attachdetach:go_default_library",
|
||||
"//pkg/controller/volume/expand:go_default_library",
|
||||
"//pkg/controller/volume/persistentvolume:go_default_library",
|
||||
"//pkg/controller/volume/pvcprotection:go_default_library",
|
||||
"//pkg/controller/volume/pvprotection:go_default_library",
|
||||
"//pkg/features:go_default_library",
|
||||
"//pkg/quota/generic:go_default_library",
|
||||
"//pkg/quota/install:go_default_library",
|
||||
"//pkg/quota/v1/generic:go_default_library",
|
||||
"//pkg/quota/v1/install:go_default_library",
|
||||
"//pkg/serviceaccount:go_default_library",
|
||||
"//pkg/util/configz:go_default_library",
|
||||
"//pkg/util/flag:go_default_library",
|
||||
@ -83,7 +85,7 @@ go_library(
|
||||
"//pkg/version:go_default_library",
|
||||
"//pkg/version/verflag:go_default_library",
|
||||
"//pkg/volume:go_default_library",
|
||||
"//pkg/volume/aws_ebs:go_default_library",
|
||||
"//pkg/volume/awsebs:go_default_library",
|
||||
"//pkg/volume/azure_dd:go_default_library",
|
||||
"//pkg/volume/azure_file:go_default_library",
|
||||
"//pkg/volume/cinder:go_default_library",
|
||||
@ -91,7 +93,7 @@ go_library(
|
||||
"//pkg/volume/fc:go_default_library",
|
||||
"//pkg/volume/flexvolume:go_default_library",
|
||||
"//pkg/volume/flocker:go_default_library",
|
||||
"//pkg/volume/gce_pd:go_default_library",
|
||||
"//pkg/volume/gcepd:go_default_library",
|
||||
"//pkg/volume/glusterfs:go_default_library",
|
||||
"//pkg/volume/host_path:go_default_library",
|
||||
"//pkg/volume/iscsi:go_default_library",
|
||||
@ -105,28 +107,37 @@ go_library(
|
||||
"//pkg/volume/storageos:go_default_library",
|
||||
"//pkg/volume/util:go_default_library",
|
||||
"//pkg/volume/vsphere_volume:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/server:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/server/healthz:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/server/mux:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/globalflag:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/discovery/cached:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/restmapper:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/scale:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/leaderelection:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/leaderelection/resourcelock:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/util/cert:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/util/flowcontrol:go_default_library",
|
||||
"//staging/src/k8s.io/cloud-provider:go_default_library",
|
||||
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned:go_default_library",
|
||||
"//staging/src/k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/metrics/pkg/client/custom_metrics:go_default_library",
|
||||
"//staging/src/k8s.io/metrics/pkg/client/external_metrics:go_default_library",
|
||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//vendor/k8s.io/client-go/discovery/cached:go_default_library",
|
||||
"//vendor/k8s.io/client-go/dynamic:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/k8s.io/client-go/restmapper:go_default_library",
|
||||
"//vendor/k8s.io/client-go/scale:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/leaderelection:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/leaderelection/resourcelock:go_default_library",
|
||||
"//vendor/k8s.io/client-go/util/cert:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/custom_metrics:go_default_library",
|
||||
"//vendor/k8s.io/metrics/pkg/client/external_metrics:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@ -135,8 +146,8 @@ go_test(
|
||||
srcs = ["controller_manager_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@ -153,6 +164,7 @@ filegroup(
|
||||
":package-srcs",
|
||||
"//cmd/kube-controller-manager/app/config:all-srcs",
|
||||
"//cmd/kube-controller-manager/app/options:all-srcs",
|
||||
"//cmd/kube-controller-manager/app/testing:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
32
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/apps.go
generated
vendored
32
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/apps.go
generated
vendored
@ -22,17 +22,20 @@ package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/util/flowcontrol"
|
||||
"k8s.io/kubernetes/pkg/controller/daemon"
|
||||
"k8s.io/kubernetes/pkg/controller/deployment"
|
||||
"k8s.io/kubernetes/pkg/controller/replicaset"
|
||||
"k8s.io/kubernetes/pkg/controller/statefulset"
|
||||
)
|
||||
|
||||
func startDaemonSetController(ctx ControllerContext) (bool, error) {
|
||||
func startDaemonSetController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "daemonsets"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
dsc, err := daemon.NewDaemonSetsController(
|
||||
ctx.InformerFactory.Apps().V1().DaemonSets(),
|
||||
@ -40,17 +43,18 @@ func startDaemonSetController(ctx ControllerContext) (bool, error) {
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
ctx.InformerFactory.Core().V1().Nodes(),
|
||||
ctx.ClientBuilder.ClientOrDie("daemon-set-controller"),
|
||||
flowcontrol.NewBackOff(1*time.Second, 15*time.Minute),
|
||||
)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("error creating DaemonSets controller: %v", err)
|
||||
return nil, true, fmt.Errorf("error creating DaemonSets controller: %v", err)
|
||||
}
|
||||
go dsc.Run(int(ctx.ComponentConfig.DaemonSetController.ConcurrentDaemonSetSyncs), ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startStatefulSetController(ctx ControllerContext) (bool, error) {
|
||||
func startStatefulSetController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "statefulsets"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
go statefulset.NewStatefulSetController(
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
@ -59,12 +63,12 @@ func startStatefulSetController(ctx ControllerContext) (bool, error) {
|
||||
ctx.InformerFactory.Apps().V1().ControllerRevisions(),
|
||||
ctx.ClientBuilder.ClientOrDie("statefulset-controller"),
|
||||
).Run(1, ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startReplicaSetController(ctx ControllerContext) (bool, error) {
|
||||
func startReplicaSetController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "replicasets"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
go replicaset.NewReplicaSetController(
|
||||
ctx.InformerFactory.Apps().V1().ReplicaSets(),
|
||||
@ -72,12 +76,12 @@ func startReplicaSetController(ctx ControllerContext) (bool, error) {
|
||||
ctx.ClientBuilder.ClientOrDie("replicaset-controller"),
|
||||
replicaset.BurstReplicas,
|
||||
).Run(int(ctx.ComponentConfig.ReplicaSetController.ConcurrentRSSyncs), ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startDeploymentController(ctx ControllerContext) (bool, error) {
|
||||
func startDeploymentController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
dc, err := deployment.NewDeploymentController(
|
||||
ctx.InformerFactory.Apps().V1().Deployments(),
|
||||
@ -86,8 +90,8 @@ func startDeploymentController(ctx ControllerContext) (bool, error) {
|
||||
ctx.ClientBuilder.ClientOrDie("deployment-controller"),
|
||||
)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("error creating Deployment controller: %v", err)
|
||||
return nil, true, fmt.Errorf("error creating Deployment controller: %v", err)
|
||||
}
|
||||
go dc.Run(int(ctx.ComponentConfig.DeploymentController.ConcurrentDeploymentSyncs), ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
50
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/autoscaling.go
generated
vendored
50
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/autoscaling.go
generated
vendored
@ -21,19 +21,22 @@ limitations under the License.
|
||||
package app
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/scale"
|
||||
"k8s.io/kubernetes/pkg/controller/podautoscaler"
|
||||
"k8s.io/kubernetes/pkg/controller/podautoscaler/metrics"
|
||||
resourceclient "k8s.io/metrics/pkg/client/clientset_generated/clientset/typed/metrics/v1beta1"
|
||||
|
||||
resourceclient "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1"
|
||||
"k8s.io/metrics/pkg/client/custom_metrics"
|
||||
"k8s.io/metrics/pkg/client/external_metrics"
|
||||
)
|
||||
|
||||
func startHPAController(ctx ControllerContext) (bool, error) {
|
||||
func startHPAController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "autoscaling", Version: "v1", Resource: "horizontalpodautoscalers"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
if ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerUseRESTClients {
|
||||
@ -44,17 +47,27 @@ func startHPAController(ctx ControllerContext) (bool, error) {
|
||||
return startHPAControllerWithLegacyClient(ctx)
|
||||
}
|
||||
|
||||
func startHPAControllerWithRESTClient(ctx ControllerContext) (bool, error) {
|
||||
func startHPAControllerWithRESTClient(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
clientConfig := ctx.ClientBuilder.ConfigOrDie("horizontal-pod-autoscaler")
|
||||
hpaClient := ctx.ClientBuilder.ClientOrDie("horizontal-pod-autoscaler")
|
||||
|
||||
apiVersionsGetter := custom_metrics.NewAvailableAPIsGetter(hpaClient.Discovery())
|
||||
// invalidate the discovery information roughly once per resync interval our API
|
||||
// information is *at most* two resync intervals old.
|
||||
go custom_metrics.PeriodicallyInvalidate(
|
||||
apiVersionsGetter,
|
||||
ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerSyncPeriod.Duration,
|
||||
ctx.Stop)
|
||||
|
||||
metricsClient := metrics.NewRESTMetricsClient(
|
||||
resourceclient.NewForConfigOrDie(clientConfig),
|
||||
custom_metrics.NewForConfigOrDie(clientConfig),
|
||||
custom_metrics.NewForConfig(clientConfig, ctx.RESTMapper, apiVersionsGetter),
|
||||
external_metrics.NewForConfigOrDie(clientConfig),
|
||||
)
|
||||
return startHPAControllerWithMetricsClient(ctx, metricsClient)
|
||||
}
|
||||
|
||||
func startHPAControllerWithLegacyClient(ctx ControllerContext) (bool, error) {
|
||||
func startHPAControllerWithLegacyClient(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
hpaClient := ctx.ClientBuilder.ClientOrDie("horizontal-pod-autoscaler")
|
||||
metricsClient := metrics.NewHeapsterMetricsClient(
|
||||
hpaClient,
|
||||
@ -66,34 +79,31 @@ func startHPAControllerWithLegacyClient(ctx ControllerContext) (bool, error) {
|
||||
return startHPAControllerWithMetricsClient(ctx, metricsClient)
|
||||
}
|
||||
|
||||
func startHPAControllerWithMetricsClient(ctx ControllerContext, metricsClient metrics.MetricsClient) (bool, error) {
|
||||
hpaClientGoClient := ctx.ClientBuilder.ClientGoClientOrDie("horizontal-pod-autoscaler")
|
||||
func startHPAControllerWithMetricsClient(ctx ControllerContext, metricsClient metrics.MetricsClient) (http.Handler, bool, error) {
|
||||
hpaClient := ctx.ClientBuilder.ClientOrDie("horizontal-pod-autoscaler")
|
||||
hpaClientConfig := ctx.ClientBuilder.ConfigOrDie("horizontal-pod-autoscaler")
|
||||
|
||||
// we don't use cached discovery because DiscoveryScaleKindResolver does its own caching,
|
||||
// so we want to re-fetch every time when we actually ask for it
|
||||
scaleKindResolver := scale.NewDiscoveryScaleKindResolver(hpaClientGoClient.Discovery())
|
||||
scaleKindResolver := scale.NewDiscoveryScaleKindResolver(hpaClient.Discovery())
|
||||
scaleClient, err := scale.NewForConfig(hpaClientConfig, ctx.RESTMapper, dynamic.LegacyAPIPathResolverFunc, scaleKindResolver)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
replicaCalc := podautoscaler.NewReplicaCalculator(
|
||||
metricsClient,
|
||||
hpaClient.CoreV1(),
|
||||
ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerTolerance,
|
||||
)
|
||||
go podautoscaler.NewHorizontalController(
|
||||
hpaClientGoClient.CoreV1(),
|
||||
hpaClient.CoreV1(),
|
||||
scaleClient,
|
||||
hpaClient.AutoscalingV1(),
|
||||
ctx.RESTMapper,
|
||||
replicaCalc,
|
||||
metricsClient,
|
||||
ctx.InformerFactory.Autoscaling().V1().HorizontalPodAutoscalers(),
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerSyncPeriod.Duration,
|
||||
ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerUpscaleForbiddenWindow.Duration,
|
||||
ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerDownscaleForbiddenWindow.Duration,
|
||||
ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerDownscaleStabilizationWindow.Duration,
|
||||
ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerTolerance,
|
||||
ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerCPUInitializationPeriod.Duration,
|
||||
ctx.ComponentConfig.HPAController.HorizontalPodAutoscalerInitialReadinessDelay.Duration,
|
||||
).Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
16
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/batch.go
generated
vendored
16
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/batch.go
generated
vendored
@ -23,33 +23,35 @@ package app
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"net/http"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/kubernetes/pkg/controller/cronjob"
|
||||
"k8s.io/kubernetes/pkg/controller/job"
|
||||
)
|
||||
|
||||
func startJobController(ctx ControllerContext) (bool, error) {
|
||||
func startJobController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
go job.NewJobController(
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
ctx.InformerFactory.Batch().V1().Jobs(),
|
||||
ctx.ClientBuilder.ClientOrDie("job-controller"),
|
||||
).Run(int(ctx.ComponentConfig.JobController.ConcurrentJobSyncs), ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startCronJobController(ctx ControllerContext) (bool, error) {
|
||||
func startCronJobController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v1beta1", Resource: "cronjobs"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
cjc, err := cronjob.NewCronJobController(
|
||||
ctx.ClientBuilder.ClientOrDie("cronjob-controller"),
|
||||
)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("error creating CronJob controller: %v", err)
|
||||
return nil, true, fmt.Errorf("error creating CronJob controller: %v", err)
|
||||
}
|
||||
go cjc.Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
18
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/bootstrap.go
generated
vendored
18
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/bootstrap.go
generated
vendored
@ -19,32 +19,34 @@ package app
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"net/http"
|
||||
|
||||
"k8s.io/kubernetes/pkg/controller/bootstrap"
|
||||
)
|
||||
|
||||
func startBootstrapSignerController(ctx ControllerContext) (bool, error) {
|
||||
func startBootstrapSignerController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
bsc, err := bootstrap.NewBootstrapSigner(
|
||||
ctx.ClientBuilder.ClientGoClientOrDie("bootstrap-signer"),
|
||||
ctx.ClientBuilder.ClientOrDie("bootstrap-signer"),
|
||||
ctx.InformerFactory.Core().V1().Secrets(),
|
||||
ctx.InformerFactory.Core().V1().ConfigMaps(),
|
||||
bootstrap.DefaultBootstrapSignerOptions(),
|
||||
)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("error creating BootstrapSigner controller: %v", err)
|
||||
return nil, true, fmt.Errorf("error creating BootstrapSigner controller: %v", err)
|
||||
}
|
||||
go bsc.Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startTokenCleanerController(ctx ControllerContext) (bool, error) {
|
||||
func startTokenCleanerController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
tcc, err := bootstrap.NewTokenCleaner(
|
||||
ctx.ClientBuilder.ClientGoClientOrDie("token-cleaner"),
|
||||
ctx.ClientBuilder.ClientOrDie("token-cleaner"),
|
||||
ctx.InformerFactory.Core().V1().Secrets(),
|
||||
bootstrap.DefaultTokenCleanerOptions(),
|
||||
)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("error creating TokenCleaner controller: %v", err)
|
||||
return nil, true, fmt.Errorf("error creating TokenCleaner controller: %v", err)
|
||||
}
|
||||
go tcc.Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
67
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/certificates.go
generated
vendored
67
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/certificates.go
generated
vendored
@ -24,21 +24,26 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
|
||||
"net/http"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cmoptions "k8s.io/kubernetes/cmd/controller-manager/app/options"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
kubeoptions "k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
|
||||
"k8s.io/kubernetes/pkg/controller/certificates/approver"
|
||||
"k8s.io/kubernetes/pkg/controller/certificates/cleaner"
|
||||
"k8s.io/kubernetes/pkg/controller/certificates/rootcacertpublisher"
|
||||
"k8s.io/kubernetes/pkg/controller/certificates/signer"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
)
|
||||
|
||||
func startCSRSigningController(ctx ControllerContext) (bool, error) {
|
||||
func startCSRSigningController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "certificatesigningrequests"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
if ctx.ComponentConfig.CSRSigningController.ClusterSigningCertFile == "" || ctx.ComponentConfig.CSRSigningController.ClusterSigningKeyFile == "" {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
// Deprecation warning for old defaults.
|
||||
@ -55,16 +60,16 @@ func startCSRSigningController(ctx ControllerContext) (bool, error) {
|
||||
_, err := os.Stat(ctx.ComponentConfig.CSRSigningController.ClusterSigningCertFile)
|
||||
certFileExists = !os.IsNotExist(err)
|
||||
|
||||
certUsesDefault = (ctx.ComponentConfig.CSRSigningController.ClusterSigningCertFile == cmoptions.DefaultClusterSigningCertFile)
|
||||
certUsesDefault = (ctx.ComponentConfig.CSRSigningController.ClusterSigningCertFile == kubeoptions.DefaultClusterSigningCertFile)
|
||||
|
||||
_, err = os.Stat(ctx.ComponentConfig.CSRSigningController.ClusterSigningKeyFile)
|
||||
keyFileExists = !os.IsNotExist(err)
|
||||
|
||||
keyUsesDefault = (ctx.ComponentConfig.CSRSigningController.ClusterSigningKeyFile == cmoptions.DefaultClusterSigningKeyFile)
|
||||
keyUsesDefault = (ctx.ComponentConfig.CSRSigningController.ClusterSigningKeyFile == kubeoptions.DefaultClusterSigningKeyFile)
|
||||
|
||||
switch {
|
||||
case (keyFileExists && keyUsesDefault) || (certFileExists && certUsesDefault):
|
||||
glog.Warningf("You might be using flag defaulting for --cluster-signing-cert-file and" +
|
||||
klog.Warningf("You might be using flag defaulting for --cluster-signing-cert-file and" +
|
||||
" --cluster-signing-key-file. These defaults are deprecated and will be removed" +
|
||||
" in a subsequent release. Please pass these options explicitly.")
|
||||
case (!keyFileExists && keyUsesDefault) && (!certFileExists && certUsesDefault):
|
||||
@ -72,7 +77,7 @@ func startCSRSigningController(ctx ControllerContext) (bool, error) {
|
||||
// setting up the signing controller. This isn't
|
||||
// actually a problem since the signer is not a
|
||||
// required controller.
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
default:
|
||||
// Note that '!filesExist && !usesDefaults' is obviously
|
||||
// operator error. We don't handle this case here and instead
|
||||
@ -89,16 +94,16 @@ func startCSRSigningController(ctx ControllerContext) (bool, error) {
|
||||
ctx.ComponentConfig.CSRSigningController.ClusterSigningDuration.Duration,
|
||||
)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to start certificate controller: %v", err)
|
||||
return nil, false, fmt.Errorf("failed to start certificate controller: %v", err)
|
||||
}
|
||||
go signer.Run(1, ctx.Stop)
|
||||
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startCSRApprovingController(ctx ControllerContext) (bool, error) {
|
||||
func startCSRApprovingController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "certificatesigningrequests"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
approver := approver.NewCSRApprovingController(
|
||||
@ -107,14 +112,44 @@ func startCSRApprovingController(ctx ControllerContext) (bool, error) {
|
||||
)
|
||||
go approver.Run(1, ctx.Stop)
|
||||
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startCSRCleanerController(ctx ControllerContext) (bool, error) {
|
||||
func startCSRCleanerController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
cleaner := cleaner.NewCSRCleanerController(
|
||||
ctx.ClientBuilder.ClientOrDie("certificate-controller").CertificatesV1beta1().CertificateSigningRequests(),
|
||||
ctx.InformerFactory.Certificates().V1beta1().CertificateSigningRequests(),
|
||||
)
|
||||
go cleaner.Run(1, ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startRootCACertPublisher(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.BoundServiceAccountTokenVolume) {
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
var (
|
||||
rootCA []byte
|
||||
err error
|
||||
)
|
||||
if ctx.ComponentConfig.SAController.RootCAFile != "" {
|
||||
if rootCA, err = readCA(ctx.ComponentConfig.SAController.RootCAFile); err != nil {
|
||||
return nil, true, fmt.Errorf("error parsing root-ca-file at %s: %v", ctx.ComponentConfig.SAController.RootCAFile, err)
|
||||
}
|
||||
} else {
|
||||
rootCA = ctx.ClientBuilder.ConfigOrDie("root-ca-cert-publisher").CAData
|
||||
}
|
||||
|
||||
sac, err := rootcacertpublisher.NewPublisher(
|
||||
ctx.InformerFactory.Core().V1().ConfigMaps(),
|
||||
ctx.InformerFactory.Core().V1().Namespaces(),
|
||||
ctx.ClientBuilder.ClientOrDie("root-ca-cert-publisher"),
|
||||
rootCA,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, true, fmt.Errorf("error creating root CA certificate publisher: %v", err)
|
||||
}
|
||||
go sac.Run(1, ctx.Stop)
|
||||
return nil, true, nil
|
||||
}
|
||||
|
6
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/cloudproviders.go
generated
vendored
6
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/cloudproviders.go
generated
vendored
@ -19,10 +19,10 @@ package app
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/kubernetes/pkg/cloudprovider"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
)
|
||||
|
||||
// createCloudProvider helps consolidate what is needed for cloud providers, we explicitly list the things
|
||||
@ -50,7 +50,7 @@ func createCloudProvider(cloudProvider string, externalCloudVolumePlugin string,
|
||||
|
||||
if cloud != nil && cloud.HasClusterID() == false {
|
||||
if allowUntaggedCloud == true {
|
||||
glog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues")
|
||||
klog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues")
|
||||
} else {
|
||||
return nil, loopMode, fmt.Errorf("no ClusterID Found. A ClusterID is required for the cloud provider to function properly. This check can be bypassed by setting the allow-untagged-cloud option")
|
||||
}
|
||||
|
11
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/config/BUILD
generated
vendored
11
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/config/BUILD
generated
vendored
@ -6,12 +6,11 @@ go_library(
|
||||
importpath = "k8s.io/kubernetes/cmd/kube-controller-manager/app/config",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//cmd/controller-manager/app:go_default_library",
|
||||
"//pkg/apis/componentconfig:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/server:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/record:go_default_library",
|
||||
"//pkg/controller/apis/config:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/server:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
13
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/config/config.go
generated
vendored
13
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/config/config.go
generated
vendored
@ -21,17 +21,19 @@ import (
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/record"
|
||||
genericcontrollermanager "k8s.io/kubernetes/cmd/controller-manager/app"
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// Config is the main context object for the controller manager.
|
||||
type Config struct {
|
||||
ComponentConfig componentconfig.KubeControllerManagerConfiguration
|
||||
ComponentConfig kubectrlmgrconfig.KubeControllerManagerConfiguration
|
||||
|
||||
SecureServing *apiserver.SecureServingInfo
|
||||
// LoopbackClientConfig is a config for a privileged loopback connection
|
||||
LoopbackClientConfig *restclient.Config
|
||||
|
||||
// TODO: remove deprecated insecure serving
|
||||
InsecureServing *genericcontrollermanager.InsecureServingInfo
|
||||
InsecureServing *apiserver.DeprecatedInsecureServingInfo
|
||||
Authentication apiserver.AuthenticationInfo
|
||||
Authorization apiserver.AuthorizationInfo
|
||||
|
||||
@ -61,5 +63,8 @@ type CompletedConfig struct {
|
||||
// Complete fills in any fields not set that are required to have valid data. It's mutating the receiver.
|
||||
func (c *Config) Complete() *CompletedConfig {
|
||||
cc := completedConfig{c}
|
||||
|
||||
apiserver.AuthorizeClientBearerToken(c.LoopbackClientConfig, &c.Authentication, &c.Authorization)
|
||||
|
||||
return &CompletedConfig{&cc}
|
||||
}
|
||||
|
186
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/controllermanager.go
generated
vendored
186
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/controllermanager.go
generated
vendored
@ -21,13 +21,14 @@ limitations under the License.
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@ -35,6 +36,11 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/uuid"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apiserver/pkg/server"
|
||||
"k8s.io/apiserver/pkg/server/healthz"
|
||||
"k8s.io/apiserver/pkg/server/mux"
|
||||
apiserverflag "k8s.io/apiserver/pkg/util/flag"
|
||||
"k8s.io/apiserver/pkg/util/globalflag"
|
||||
cacheddiscovery "k8s.io/client-go/discovery/cached"
|
||||
"k8s.io/client-go/informers"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
@ -42,12 +48,14 @@ import (
|
||||
"k8s.io/client-go/tools/leaderelection"
|
||||
"k8s.io/client-go/tools/leaderelection/resourcelock"
|
||||
certutil "k8s.io/client-go/util/cert"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
"k8s.io/klog"
|
||||
genericcontrollermanager "k8s.io/kubernetes/cmd/controller-manager/app"
|
||||
cmoptions "k8s.io/kubernetes/cmd/controller-manager/app/options"
|
||||
"k8s.io/kubernetes/cmd/kube-controller-manager/app/config"
|
||||
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||
"k8s.io/kubernetes/pkg/cloudprovider"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount"
|
||||
"k8s.io/kubernetes/pkg/serviceaccount"
|
||||
"k8s.io/kubernetes/pkg/util/configz"
|
||||
@ -59,6 +67,8 @@ import (
|
||||
const (
|
||||
// Jitter used when starting controller managers
|
||||
ControllerStartJitter = 1.0
|
||||
// ConfigzName is the name used for register kube-controller manager /configz, same with GroupName.
|
||||
ConfigzName = "kubecontrollermanager.config.k8s.io"
|
||||
)
|
||||
|
||||
type ControllerLoopMode int
|
||||
@ -72,7 +82,7 @@ const (
|
||||
func NewControllerManagerCommand() *cobra.Command {
|
||||
s, err := options.NewKubeControllerManagerOptions()
|
||||
if err != nil {
|
||||
glog.Fatalf("unable to initialize command options: %v", err)
|
||||
klog.Fatalf("unable to initialize command options: %v", err)
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@ -95,13 +105,32 @@ controller, and serviceaccounts controller.`,
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := Run(c.Complete()); err != nil {
|
||||
if err := Run(c.Complete(), wait.NeverStop); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
},
|
||||
}
|
||||
s.AddFlags(cmd.Flags(), KnownControllers(), ControllersDisabledByDefault.List())
|
||||
|
||||
fs := cmd.Flags()
|
||||
namedFlagSets := s.Flags(KnownControllers(), ControllersDisabledByDefault.List())
|
||||
verflag.AddFlags(namedFlagSets.FlagSet("global"))
|
||||
globalflag.AddGlobalFlags(namedFlagSets.FlagSet("global"), cmd.Name())
|
||||
cmoptions.AddCustomGlobalFlags(namedFlagSets.FlagSet("generic"))
|
||||
for _, f := range namedFlagSets.FlagSets {
|
||||
fs.AddFlagSet(f)
|
||||
}
|
||||
usageFmt := "Usage:\n %s\n"
|
||||
cols, _, _ := apiserverflag.TerminalSize(cmd.OutOrStdout())
|
||||
cmd.SetUsageFunc(func(cmd *cobra.Command) error {
|
||||
fmt.Fprintf(cmd.OutOrStderr(), usageFmt, cmd.UseLine())
|
||||
apiserverflag.PrintSections(cmd.OutOrStderr(), namedFlagSets, cols)
|
||||
return nil
|
||||
})
|
||||
cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "%s\n\n"+usageFmt, cmd.Long, cmd.UseLine())
|
||||
apiserverflag.PrintSections(cmd.OutOrStdout(), namedFlagSets, cols)
|
||||
})
|
||||
|
||||
return cmd
|
||||
}
|
||||
@ -112,39 +141,49 @@ controller, and serviceaccounts controller.`,
|
||||
func ResyncPeriod(c *config.CompletedConfig) func() time.Duration {
|
||||
return func() time.Duration {
|
||||
factor := rand.Float64() + 1
|
||||
return time.Duration(float64(c.ComponentConfig.GenericComponent.MinResyncPeriod.Nanoseconds()) * factor)
|
||||
return time.Duration(float64(c.ComponentConfig.Generic.MinResyncPeriod.Nanoseconds()) * factor)
|
||||
}
|
||||
}
|
||||
|
||||
// Run runs the KubeControllerManagerOptions. This should never exit.
|
||||
func Run(c *config.CompletedConfig) error {
|
||||
func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
|
||||
// To help debugging, immediately log version
|
||||
glog.Infof("Version: %+v", version.Get())
|
||||
klog.Infof("Version: %+v", version.Get())
|
||||
|
||||
if cfgz, err := configz.New("componentconfig"); err == nil {
|
||||
if cfgz, err := configz.New(ConfigzName); err == nil {
|
||||
cfgz.Set(c.ComponentConfig)
|
||||
} else {
|
||||
glog.Errorf("unable to register configz: %c", err)
|
||||
klog.Errorf("unable to register configz: %c", err)
|
||||
}
|
||||
|
||||
// Setup any healthz checks we will want to use.
|
||||
var checks []healthz.HealthzChecker
|
||||
var electionChecker *leaderelection.HealthzAdaptor
|
||||
if c.ComponentConfig.Generic.LeaderElection.LeaderElect {
|
||||
electionChecker = leaderelection.NewLeaderHealthzAdaptor(time.Second * 20)
|
||||
checks = append(checks, electionChecker)
|
||||
}
|
||||
|
||||
// Start the controller manager HTTP server
|
||||
stopCh := make(chan struct{})
|
||||
// unsecuredMux is the handler for these controller *after* authn/authz filters have been applied
|
||||
var unsecuredMux *mux.PathRecorderMux
|
||||
if c.SecureServing != nil {
|
||||
handler := genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Debugging)
|
||||
handler = genericcontrollermanager.BuildHandlerChain(handler, &c.Authorization, &c.Authentication)
|
||||
unsecuredMux = genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Generic.Debugging, checks...)
|
||||
handler := genericcontrollermanager.BuildHandlerChain(unsecuredMux, &c.Authorization, &c.Authentication)
|
||||
if err := c.SecureServing.Serve(handler, 0, stopCh); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if c.InsecureServing != nil {
|
||||
handler := genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Debugging)
|
||||
handler = genericcontrollermanager.BuildHandlerChain(handler, &c.Authorization, &c.Authentication)
|
||||
unsecuredMux = genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Generic.Debugging, checks...)
|
||||
insecureSuperuserAuthn := server.AuthenticationInfo{Authenticator: &server.InsecureSuperuser{}}
|
||||
handler := genericcontrollermanager.BuildHandlerChain(unsecuredMux, nil, &insecureSuperuserAuthn)
|
||||
if err := c.InsecureServing.Serve(handler, 0, stopCh); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
run := func(stop <-chan struct{}) {
|
||||
run := func(ctx context.Context) {
|
||||
rootClientBuilder := controller.SimpleControllerClientBuilder{
|
||||
ClientConfig: c.Kubeconfig,
|
||||
}
|
||||
@ -153,7 +192,7 @@ func Run(c *config.CompletedConfig) error {
|
||||
if len(c.ComponentConfig.SAController.ServiceAccountKeyFile) == 0 {
|
||||
// It'c possible another controller process is creating the tokens for us.
|
||||
// If one isn't, we'll timeout and exit when our client builder is unable to create the tokens.
|
||||
glog.Warningf("--use-service-account-credentials was specified without providing a --service-account-private-key-file")
|
||||
klog.Warningf("--use-service-account-credentials was specified without providing a --service-account-private-key-file")
|
||||
}
|
||||
clientBuilder = controller.SAControllerClientBuilder{
|
||||
ClientConfig: restclient.AnonymousClientConfig(c.Kubeconfig),
|
||||
@ -164,24 +203,24 @@ func Run(c *config.CompletedConfig) error {
|
||||
} else {
|
||||
clientBuilder = rootClientBuilder
|
||||
}
|
||||
ctx, err := CreateControllerContext(c, rootClientBuilder, clientBuilder, stop)
|
||||
controllerContext, err := CreateControllerContext(c, rootClientBuilder, clientBuilder, ctx.Done())
|
||||
if err != nil {
|
||||
glog.Fatalf("error building controller context: %v", err)
|
||||
klog.Fatalf("error building controller context: %v", err)
|
||||
}
|
||||
saTokenControllerInitFunc := serviceAccountTokenControllerStarter{rootClientBuilder: rootClientBuilder}.startServiceAccountTokenController
|
||||
|
||||
if err := StartControllers(ctx, saTokenControllerInitFunc, NewControllerInitializers(ctx.LoopMode)); err != nil {
|
||||
glog.Fatalf("error starting controllers: %v", err)
|
||||
if err := StartControllers(controllerContext, saTokenControllerInitFunc, NewControllerInitializers(controllerContext.LoopMode), unsecuredMux); err != nil {
|
||||
klog.Fatalf("error starting controllers: %v", err)
|
||||
}
|
||||
|
||||
ctx.InformerFactory.Start(ctx.Stop)
|
||||
close(ctx.InformersStarted)
|
||||
controllerContext.InformerFactory.Start(controllerContext.Stop)
|
||||
close(controllerContext.InformersStarted)
|
||||
|
||||
select {}
|
||||
}
|
||||
|
||||
if !c.ComponentConfig.GenericComponent.LeaderElection.LeaderElect {
|
||||
run(wait.NeverStop)
|
||||
if !c.ComponentConfig.Generic.LeaderElection.LeaderElect {
|
||||
run(context.TODO())
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
@ -192,7 +231,7 @@ func Run(c *config.CompletedConfig) error {
|
||||
|
||||
// add a uniquifier so that two processes on the same host don't accidentally both become active
|
||||
id = id + "_" + string(uuid.NewUUID())
|
||||
rl, err := resourcelock.New(c.ComponentConfig.GenericComponent.LeaderElection.ResourceLock,
|
||||
rl, err := resourcelock.New(c.ComponentConfig.Generic.LeaderElection.ResourceLock,
|
||||
"kube-system",
|
||||
"kube-controller-manager",
|
||||
c.LeaderElectionClient.CoreV1(),
|
||||
@ -201,20 +240,22 @@ func Run(c *config.CompletedConfig) error {
|
||||
EventRecorder: c.EventRecorder,
|
||||
})
|
||||
if err != nil {
|
||||
glog.Fatalf("error creating lock: %v", err)
|
||||
klog.Fatalf("error creating lock: %v", err)
|
||||
}
|
||||
|
||||
leaderelection.RunOrDie(leaderelection.LeaderElectionConfig{
|
||||
leaderelection.RunOrDie(context.TODO(), leaderelection.LeaderElectionConfig{
|
||||
Lock: rl,
|
||||
LeaseDuration: c.ComponentConfig.GenericComponent.LeaderElection.LeaseDuration.Duration,
|
||||
RenewDeadline: c.ComponentConfig.GenericComponent.LeaderElection.RenewDeadline.Duration,
|
||||
RetryPeriod: c.ComponentConfig.GenericComponent.LeaderElection.RetryPeriod.Duration,
|
||||
LeaseDuration: c.ComponentConfig.Generic.LeaderElection.LeaseDuration.Duration,
|
||||
RenewDeadline: c.ComponentConfig.Generic.LeaderElection.RenewDeadline.Duration,
|
||||
RetryPeriod: c.ComponentConfig.Generic.LeaderElection.RetryPeriod.Duration,
|
||||
Callbacks: leaderelection.LeaderCallbacks{
|
||||
OnStartedLeading: run,
|
||||
OnStoppedLeading: func() {
|
||||
glog.Fatalf("leaderelection lost")
|
||||
klog.Fatalf("leaderelection lost")
|
||||
},
|
||||
},
|
||||
WatchDog: electionChecker,
|
||||
Name: "kube-controller-manager",
|
||||
})
|
||||
panic("unreachable")
|
||||
}
|
||||
@ -227,7 +268,7 @@ type ControllerContext struct {
|
||||
InformerFactory informers.SharedInformerFactory
|
||||
|
||||
// ComponentConfig provides access to init options for a given controller
|
||||
ComponentConfig componentconfig.KubeControllerManagerConfiguration
|
||||
ComponentConfig kubectrlmgrconfig.KubeControllerManagerConfiguration
|
||||
|
||||
// DeferredDiscoveryRESTMapper is a RESTMapper that will defer
|
||||
// initialization of the RESTMapper until the first mapping is
|
||||
@ -260,7 +301,7 @@ type ControllerContext struct {
|
||||
}
|
||||
|
||||
func (c ControllerContext) IsControllerEnabled(name string) bool {
|
||||
return IsControllerEnabled(name, ControllersDisabledByDefault, c.ComponentConfig.Controllers...)
|
||||
return IsControllerEnabled(name, ControllersDisabledByDefault, c.ComponentConfig.Generic.Controllers...)
|
||||
}
|
||||
|
||||
func IsControllerEnabled(name string, disabledByDefaultControllers sets.String, controllers ...string) bool {
|
||||
@ -291,7 +332,7 @@ func IsControllerEnabled(name string, disabledByDefaultControllers sets.String,
|
||||
// InitFunc is used to launch a particular controller. It may run additional "should I activate checks".
|
||||
// Any error returned will cause the controller process to `Fatal`
|
||||
// The bool indicates whether the controller was enabled.
|
||||
type InitFunc func(ctx ControllerContext) (bool, error)
|
||||
type InitFunc func(ctx ControllerContext) (debuggingHandler http.Handler, enabled bool, err error)
|
||||
|
||||
func KnownControllers() []string {
|
||||
ret := sets.StringKeySet(NewControllerInitializers(IncludeCloudLoops))
|
||||
@ -355,6 +396,8 @@ func NewControllerInitializers(loopMode ControllerLoopMode) map[string]InitFunc
|
||||
controllers["clusterrole-aggregation"] = startClusterRoleAggregrationController
|
||||
controllers["pvc-protection"] = startPVCProtectionController
|
||||
controllers["pv-protection"] = startPVProtectionController
|
||||
controllers["ttl-after-finished"] = startTTLAfterFinishedController
|
||||
controllers["root-ca-cert-publisher"] = startRootCACertPublisher
|
||||
|
||||
return controllers
|
||||
}
|
||||
@ -413,8 +456,8 @@ func CreateControllerContext(s *config.CompletedConfig, rootClientBuilder, clien
|
||||
return ControllerContext{}, err
|
||||
}
|
||||
|
||||
cloud, loopMode, err := createCloudProvider(s.ComponentConfig.CloudProvider.Name, s.ComponentConfig.ExternalCloudVolumePlugin,
|
||||
s.ComponentConfig.CloudProvider.CloudConfigFile, s.ComponentConfig.KubeCloudShared.AllowUntaggedCloud, sharedInformers)
|
||||
cloud, loopMode, err := createCloudProvider(s.ComponentConfig.KubeCloudShared.CloudProvider.Name, s.ComponentConfig.KubeCloudShared.ExternalCloudVolumePlugin,
|
||||
s.ComponentConfig.KubeCloudShared.CloudProvider.CloudConfigFile, s.ComponentConfig.KubeCloudShared.AllowUntaggedCloud, sharedInformers)
|
||||
if err != nil {
|
||||
return ControllerContext{}, err
|
||||
}
|
||||
@ -434,38 +477,43 @@ func CreateControllerContext(s *config.CompletedConfig, rootClientBuilder, clien
|
||||
return ctx, nil
|
||||
}
|
||||
|
||||
func StartControllers(ctx ControllerContext, startSATokenController InitFunc, controllers map[string]InitFunc) error {
|
||||
func StartControllers(ctx ControllerContext, startSATokenController InitFunc, controllers map[string]InitFunc, unsecuredMux *mux.PathRecorderMux) error {
|
||||
// Always start the SA token controller first using a full-power client, since it needs to mint tokens for the rest
|
||||
// If this fails, just return here and fail since other controllers won't be able to get credentials.
|
||||
if _, err := startSATokenController(ctx); err != nil {
|
||||
if _, _, err := startSATokenController(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Initialize the cloud provider with a reference to the clientBuilder only after token controller
|
||||
// has started in case the cloud provider uses the client builder.
|
||||
if ctx.Cloud != nil {
|
||||
ctx.Cloud.Initialize(ctx.ClientBuilder)
|
||||
ctx.Cloud.Initialize(ctx.ClientBuilder, ctx.Stop)
|
||||
}
|
||||
|
||||
for controllerName, initFn := range controllers {
|
||||
if !ctx.IsControllerEnabled(controllerName) {
|
||||
glog.Warningf("%q is disabled", controllerName)
|
||||
klog.Warningf("%q is disabled", controllerName)
|
||||
continue
|
||||
}
|
||||
|
||||
time.Sleep(wait.Jitter(ctx.ComponentConfig.GenericComponent.ControllerStartInterval.Duration, ControllerStartJitter))
|
||||
time.Sleep(wait.Jitter(ctx.ComponentConfig.Generic.ControllerStartInterval.Duration, ControllerStartJitter))
|
||||
|
||||
glog.V(1).Infof("Starting %q", controllerName)
|
||||
started, err := initFn(ctx)
|
||||
klog.V(1).Infof("Starting %q", controllerName)
|
||||
debugHandler, started, err := initFn(ctx)
|
||||
if err != nil {
|
||||
glog.Errorf("Error starting %q", controllerName)
|
||||
klog.Errorf("Error starting %q", controllerName)
|
||||
return err
|
||||
}
|
||||
if !started {
|
||||
glog.Warningf("Skipping %q", controllerName)
|
||||
klog.Warningf("Skipping %q", controllerName)
|
||||
continue
|
||||
}
|
||||
glog.Infof("Started %q", controllerName)
|
||||
if debugHandler != nil && unsecuredMux != nil {
|
||||
basePath := "/debug/controllers/" + controllerName
|
||||
unsecuredMux.UnlistedHandle(basePath, http.StripPrefix(basePath, debugHandler))
|
||||
unsecuredMux.UnlistedHandlePrefix(basePath+"/", http.StripPrefix(basePath, debugHandler))
|
||||
}
|
||||
klog.Infof("Started %q", controllerName)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -478,50 +526,62 @@ type serviceAccountTokenControllerStarter struct {
|
||||
rootClientBuilder controller.ControllerClientBuilder
|
||||
}
|
||||
|
||||
func (c serviceAccountTokenControllerStarter) startServiceAccountTokenController(ctx ControllerContext) (bool, error) {
|
||||
func (c serviceAccountTokenControllerStarter) startServiceAccountTokenController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.IsControllerEnabled(saTokenControllerName) {
|
||||
glog.Warningf("%q is disabled", saTokenControllerName)
|
||||
return false, nil
|
||||
klog.Warningf("%q is disabled", saTokenControllerName)
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
if len(ctx.ComponentConfig.SAController.ServiceAccountKeyFile) == 0 {
|
||||
glog.Warningf("%q is disabled because there is no private key", saTokenControllerName)
|
||||
return false, nil
|
||||
klog.Warningf("%q is disabled because there is no private key", saTokenControllerName)
|
||||
return nil, false, nil
|
||||
}
|
||||
privateKey, err := certutil.PrivateKeyFromFile(ctx.ComponentConfig.SAController.ServiceAccountKeyFile)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("error reading key for service account token controller: %v", err)
|
||||
return nil, true, fmt.Errorf("error reading key for service account token controller: %v", err)
|
||||
}
|
||||
|
||||
var rootCA []byte
|
||||
if ctx.ComponentConfig.SAController.RootCAFile != "" {
|
||||
rootCA, err = ioutil.ReadFile(ctx.ComponentConfig.SAController.RootCAFile)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("error reading root-ca-file at %s: %v", ctx.ComponentConfig.SAController.RootCAFile, err)
|
||||
}
|
||||
if _, err := certutil.ParseCertsPEM(rootCA); err != nil {
|
||||
return true, fmt.Errorf("error parsing root-ca-file at %s: %v", ctx.ComponentConfig.SAController.RootCAFile, err)
|
||||
if rootCA, err = readCA(ctx.ComponentConfig.SAController.RootCAFile); err != nil {
|
||||
return nil, true, fmt.Errorf("error parsing root-ca-file at %s: %v", ctx.ComponentConfig.SAController.RootCAFile, err)
|
||||
}
|
||||
} else {
|
||||
rootCA = c.rootClientBuilder.ConfigOrDie("tokens-controller").CAData
|
||||
}
|
||||
|
||||
tokenGenerator, err := serviceaccount.JWTTokenGenerator(serviceaccount.LegacyIssuer, privateKey)
|
||||
if err != nil {
|
||||
return nil, false, fmt.Errorf("failed to build token generator: %v", err)
|
||||
}
|
||||
controller, err := serviceaccountcontroller.NewTokensController(
|
||||
ctx.InformerFactory.Core().V1().ServiceAccounts(),
|
||||
ctx.InformerFactory.Core().V1().Secrets(),
|
||||
c.rootClientBuilder.ClientOrDie("tokens-controller"),
|
||||
serviceaccountcontroller.TokensControllerOptions{
|
||||
TokenGenerator: serviceaccount.JWTTokenGenerator(serviceaccount.LegacyIssuer, privateKey),
|
||||
TokenGenerator: tokenGenerator,
|
||||
RootCA: rootCA,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("error creating Tokens controller: %v", err)
|
||||
return nil, true, fmt.Errorf("error creating Tokens controller: %v", err)
|
||||
}
|
||||
go controller.Run(int(ctx.ComponentConfig.SAController.ConcurrentSATokenSyncs), ctx.Stop)
|
||||
|
||||
// start the first set of informers now so that other controllers can start
|
||||
ctx.InformerFactory.Start(ctx.Stop)
|
||||
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func readCA(file string) ([]byte, error) {
|
||||
rootCA, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, err := certutil.ParseCertsPEM(rootCA); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return rootCA, err
|
||||
}
|
||||
|
155
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/core.go
generated
vendored
155
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/core.go
generated
vendored
@ -26,7 +26,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
|
||||
"net/http"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@ -34,6 +36,7 @@ import (
|
||||
cacheddiscovery "k8s.io/client-go/discovery/cached"
|
||||
"k8s.io/client-go/dynamic"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
csiclientset "k8s.io/csi-api/pkg/client/clientset/versioned"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
endpointcontroller "k8s.io/kubernetes/pkg/controller/endpoint"
|
||||
"k8s.io/kubernetes/pkg/controller/garbagecollector"
|
||||
@ -48,18 +51,19 @@ import (
|
||||
servicecontroller "k8s.io/kubernetes/pkg/controller/service"
|
||||
serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount"
|
||||
ttlcontroller "k8s.io/kubernetes/pkg/controller/ttl"
|
||||
"k8s.io/kubernetes/pkg/controller/ttlafterfinished"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/attachdetach"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/expand"
|
||||
persistentvolumecontroller "k8s.io/kubernetes/pkg/controller/volume/persistentvolume"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/pvcprotection"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/pvprotection"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/quota/generic"
|
||||
quotainstall "k8s.io/kubernetes/pkg/quota/install"
|
||||
"k8s.io/kubernetes/pkg/quota/v1/generic"
|
||||
quotainstall "k8s.io/kubernetes/pkg/quota/v1/install"
|
||||
"k8s.io/kubernetes/pkg/util/metrics"
|
||||
)
|
||||
|
||||
func startServiceController(ctx ControllerContext) (bool, error) {
|
||||
func startServiceController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
serviceController, err := servicecontroller.New(
|
||||
ctx.Cloud,
|
||||
ctx.ClientBuilder.ClientOrDie("service-controller"),
|
||||
@ -69,33 +73,33 @@ func startServiceController(ctx ControllerContext) (bool, error) {
|
||||
)
|
||||
if err != nil {
|
||||
// This error shouldn't fail. It lives like this as a legacy.
|
||||
glog.Errorf("Failed to start service controller: %v", err)
|
||||
return false, nil
|
||||
klog.Errorf("Failed to start service controller: %v", err)
|
||||
return nil, false, nil
|
||||
}
|
||||
go serviceController.Run(ctx.Stop, int(ctx.ComponentConfig.ServiceController.ConcurrentServiceSyncs))
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startNodeIpamController(ctx ControllerContext) (bool, error) {
|
||||
func startNodeIpamController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
var clusterCIDR *net.IPNet = nil
|
||||
var serviceCIDR *net.IPNet = nil
|
||||
|
||||
if !ctx.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
var err error
|
||||
if len(strings.TrimSpace(ctx.ComponentConfig.KubeCloudShared.ClusterCIDR)) != 0 {
|
||||
_, clusterCIDR, err = net.ParseCIDR(ctx.ComponentConfig.KubeCloudShared.ClusterCIDR)
|
||||
if err != nil {
|
||||
glog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", ctx.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
||||
klog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", ctx.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(strings.TrimSpace(ctx.ComponentConfig.NodeIpamController.ServiceCIDR)) != 0 {
|
||||
_, serviceCIDR, err = net.ParseCIDR(ctx.ComponentConfig.NodeIpamController.ServiceCIDR)
|
||||
if len(strings.TrimSpace(ctx.ComponentConfig.NodeIPAMController.ServiceCIDR)) != 0 {
|
||||
_, serviceCIDR, err = net.ParseCIDR(ctx.ComponentConfig.NodeIPAMController.ServiceCIDR)
|
||||
if err != nil {
|
||||
glog.Warningf("Unsuccessful parsing of service CIDR %v: %v", ctx.ComponentConfig.NodeIpamController.ServiceCIDR, err)
|
||||
klog.Warningf("Unsuccessful parsing of service CIDR %v: %v", ctx.ComponentConfig.NodeIPAMController.ServiceCIDR, err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,18 +109,19 @@ func startNodeIpamController(ctx ControllerContext) (bool, error) {
|
||||
ctx.ClientBuilder.ClientOrDie("node-controller"),
|
||||
clusterCIDR,
|
||||
serviceCIDR,
|
||||
int(ctx.ComponentConfig.NodeIpamController.NodeCIDRMaskSize),
|
||||
int(ctx.ComponentConfig.NodeIPAMController.NodeCIDRMaskSize),
|
||||
ipam.CIDRAllocatorType(ctx.ComponentConfig.KubeCloudShared.CIDRAllocatorType),
|
||||
)
|
||||
if err != nil {
|
||||
return true, err
|
||||
return nil, true, err
|
||||
}
|
||||
go nodeIpamController.Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startNodeLifecycleController(ctx ControllerContext) (bool, error) {
|
||||
func startNodeLifecycleController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
lifecycleController, err := lifecyclecontroller.NewNodeLifecycleController(
|
||||
ctx.InformerFactory.Coordination().V1beta1().Leases(),
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
ctx.InformerFactory.Core().V1().Nodes(),
|
||||
ctx.InformerFactory.Extensions().V1beta1().DaemonSets(),
|
||||
@ -135,36 +140,36 @@ func startNodeLifecycleController(ctx ControllerContext) (bool, error) {
|
||||
utilfeature.DefaultFeatureGate.Enabled(features.TaintNodesByCondition),
|
||||
)
|
||||
if err != nil {
|
||||
return true, err
|
||||
return nil, true, err
|
||||
}
|
||||
go lifecycleController.Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startRouteController(ctx ControllerContext) (bool, error) {
|
||||
func startRouteController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs || !ctx.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes {
|
||||
glog.Infof("Will not configure cloud provider routes for allocate-node-cidrs: %v, configure-cloud-routes: %v.", ctx.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs, ctx.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes)
|
||||
return false, nil
|
||||
klog.Infof("Will not configure cloud provider routes for allocate-node-cidrs: %v, configure-cloud-routes: %v.", ctx.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs, ctx.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes)
|
||||
return nil, false, nil
|
||||
}
|
||||
if ctx.Cloud == nil {
|
||||
glog.Warning("configure-cloud-routes is set, but no cloud provider specified. Will not configure cloud provider routes.")
|
||||
return false, nil
|
||||
klog.Warning("configure-cloud-routes is set, but no cloud provider specified. Will not configure cloud provider routes.")
|
||||
return nil, false, nil
|
||||
}
|
||||
routes, ok := ctx.Cloud.Routes()
|
||||
if !ok {
|
||||
glog.Warning("configure-cloud-routes is set, but cloud provider does not support routes. Will not configure cloud provider routes.")
|
||||
return false, nil
|
||||
klog.Warning("configure-cloud-routes is set, but cloud provider does not support routes. Will not configure cloud provider routes.")
|
||||
return nil, false, nil
|
||||
}
|
||||
_, clusterCIDR, err := net.ParseCIDR(ctx.ComponentConfig.KubeCloudShared.ClusterCIDR)
|
||||
if err != nil {
|
||||
glog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", ctx.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
||||
klog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", ctx.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
||||
}
|
||||
routeController := routecontroller.New(routes, ctx.ClientBuilder.ClientOrDie("route-controller"), ctx.InformerFactory.Core().V1().Nodes(), ctx.ComponentConfig.KubeCloudShared.ClusterName, clusterCIDR)
|
||||
go routeController.Run(ctx.Stop, ctx.ComponentConfig.KubeCloudShared.RouteReconciliationPeriod.Duration)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startPersistentVolumeBinderController(ctx ControllerContext) (bool, error) {
|
||||
func startPersistentVolumeBinderController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
params := persistentvolumecontroller.ControllerParameters{
|
||||
KubeClient: ctx.ClientBuilder.ClientOrDie("persistent-volume-binder"),
|
||||
SyncPeriod: ctx.ComponentConfig.PersistentVolumeBinderController.PVClaimBinderSyncPeriod.Duration,
|
||||
@ -180,19 +185,24 @@ func startPersistentVolumeBinderController(ctx ControllerContext) (bool, error)
|
||||
}
|
||||
volumeController, volumeControllerErr := persistentvolumecontroller.NewController(params)
|
||||
if volumeControllerErr != nil {
|
||||
return true, fmt.Errorf("failed to construct persistentvolume controller: %v", volumeControllerErr)
|
||||
return nil, true, fmt.Errorf("failed to construct persistentvolume controller: %v", volumeControllerErr)
|
||||
}
|
||||
go volumeController.Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startAttachDetachController(ctx ControllerContext) (bool, error) {
|
||||
func startAttachDetachController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if ctx.ComponentConfig.AttachDetachController.ReconcilerSyncLoopPeriod.Duration < time.Second {
|
||||
return true, fmt.Errorf("Duration time must be greater than one second as set via command line option reconcile-sync-loop-period.")
|
||||
return nil, true, fmt.Errorf("Duration time must be greater than one second as set via command line option reconcile-sync-loop-period.")
|
||||
}
|
||||
csiClientConfig := ctx.ClientBuilder.ConfigOrDie("attachdetach-controller")
|
||||
// csiClient works with CRDs that support json only
|
||||
csiClientConfig.ContentType = "application/json"
|
||||
|
||||
attachDetachController, attachDetachControllerErr :=
|
||||
attachdetach.NewAttachDetachController(
|
||||
ctx.ClientBuilder.ClientOrDie("attachdetach-controller"),
|
||||
csiclientset.NewForConfigOrDie(csiClientConfig),
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
ctx.InformerFactory.Core().V1().Nodes(),
|
||||
ctx.InformerFactory.Core().V1().PersistentVolumeClaims(),
|
||||
@ -205,13 +215,13 @@ func startAttachDetachController(ctx ControllerContext) (bool, error) {
|
||||
attachdetach.DefaultTimerConfig,
|
||||
)
|
||||
if attachDetachControllerErr != nil {
|
||||
return true, fmt.Errorf("failed to start attach/detach controller: %v", attachDetachControllerErr)
|
||||
return nil, true, fmt.Errorf("failed to start attach/detach controller: %v", attachDetachControllerErr)
|
||||
}
|
||||
go attachDetachController.Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startVolumeExpandController(ctx ControllerContext) (bool, error) {
|
||||
func startVolumeExpandController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.ExpandPersistentVolumes) {
|
||||
expandController, expandControllerErr := expand.NewExpandController(
|
||||
ctx.ClientBuilder.ClientOrDie("expand-controller"),
|
||||
@ -221,44 +231,44 @@ func startVolumeExpandController(ctx ControllerContext) (bool, error) {
|
||||
ProbeExpandableVolumePlugins(ctx.ComponentConfig.PersistentVolumeBinderController.VolumeConfiguration))
|
||||
|
||||
if expandControllerErr != nil {
|
||||
return true, fmt.Errorf("Failed to start volume expand controller : %v", expandControllerErr)
|
||||
return nil, true, fmt.Errorf("Failed to start volume expand controller : %v", expandControllerErr)
|
||||
}
|
||||
go expandController.Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
func startEndpointController(ctx ControllerContext) (bool, error) {
|
||||
func startEndpointController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
go endpointcontroller.NewEndpointController(
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
ctx.InformerFactory.Core().V1().Services(),
|
||||
ctx.InformerFactory.Core().V1().Endpoints(),
|
||||
ctx.ClientBuilder.ClientOrDie("endpoint-controller"),
|
||||
).Run(int(ctx.ComponentConfig.EndPointController.ConcurrentEndpointSyncs), ctx.Stop)
|
||||
return true, nil
|
||||
).Run(int(ctx.ComponentConfig.EndpointController.ConcurrentEndpointSyncs), ctx.Stop)
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startReplicationController(ctx ControllerContext) (bool, error) {
|
||||
func startReplicationController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
go replicationcontroller.NewReplicationManager(
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
ctx.InformerFactory.Core().V1().ReplicationControllers(),
|
||||
ctx.ClientBuilder.ClientOrDie("replication-controller"),
|
||||
replicationcontroller.BurstReplicas,
|
||||
).Run(int(ctx.ComponentConfig.ReplicationController.ConcurrentRCSyncs), ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startPodGCController(ctx ControllerContext) (bool, error) {
|
||||
func startPodGCController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
go podgc.NewPodGC(
|
||||
ctx.ClientBuilder.ClientOrDie("pod-garbage-collector"),
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
int(ctx.ComponentConfig.PodGCController.TerminatedPodGCThreshold),
|
||||
).Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startResourceQuotaController(ctx ControllerContext) (bool, error) {
|
||||
func startResourceQuotaController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
resourceQuotaControllerClient := ctx.ClientBuilder.ClientOrDie("resourcequota-controller")
|
||||
discoveryFunc := resourceQuotaControllerClient.Discovery().ServerPreferredNamespacedResources
|
||||
listerFuncForResource := generic.ListerFuncForResourceFunc(ctx.InformerFactory.ForResource)
|
||||
@ -277,23 +287,23 @@ func startResourceQuotaController(ctx ControllerContext) (bool, error) {
|
||||
}
|
||||
if resourceQuotaControllerClient.CoreV1().RESTClient().GetRateLimiter() != nil {
|
||||
if err := metrics.RegisterMetricAndTrackRateLimiterUsage("resource_quota_controller", resourceQuotaControllerClient.CoreV1().RESTClient().GetRateLimiter()); err != nil {
|
||||
return true, err
|
||||
return nil, true, err
|
||||
}
|
||||
}
|
||||
|
||||
resourceQuotaController, err := resourcequotacontroller.NewResourceQuotaController(resourceQuotaControllerOptions)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, false, err
|
||||
}
|
||||
go resourceQuotaController.Run(int(ctx.ComponentConfig.ResourceQuotaController.ConcurrentResourceQuotaSyncs), ctx.Stop)
|
||||
|
||||
// Periodically the quota controller to detect new resource types
|
||||
go resourceQuotaController.Sync(discoveryFunc, 30*time.Second, ctx.Stop)
|
||||
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startNamespaceController(ctx ControllerContext) (bool, error) {
|
||||
func startNamespaceController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
// the namespace cleanup controller is very chatty. It makes lots of discovery calls and then it makes lots of delete calls
|
||||
// the ratelimiter negatively affects its speed. Deleting 100 total items in a namespace (that's only a few of each resource
|
||||
// including events), takes ~10 seconds by default.
|
||||
@ -304,7 +314,7 @@ func startNamespaceController(ctx ControllerContext) (bool, error) {
|
||||
|
||||
dynamicClient, err := dynamic.NewForConfig(nsKubeconfig)
|
||||
if err != nil {
|
||||
return true, err
|
||||
return nil, true, err
|
||||
}
|
||||
|
||||
discoverResourcesFn := namespaceKubeClient.Discovery().ServerPreferredNamespacedResources
|
||||
@ -319,10 +329,10 @@ func startNamespaceController(ctx ControllerContext) (bool, error) {
|
||||
)
|
||||
go namespaceController.Run(int(ctx.ComponentConfig.NamespaceController.ConcurrentNamespaceSyncs), ctx.Stop)
|
||||
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startServiceAccountController(ctx ControllerContext) (bool, error) {
|
||||
func startServiceAccountController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
sac, err := serviceaccountcontroller.NewServiceAccountsController(
|
||||
ctx.InformerFactory.Core().V1().ServiceAccounts(),
|
||||
ctx.InformerFactory.Core().V1().Namespaces(),
|
||||
@ -330,23 +340,23 @@ func startServiceAccountController(ctx ControllerContext) (bool, error) {
|
||||
serviceaccountcontroller.DefaultServiceAccountsControllerOptions(),
|
||||
)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("error creating ServiceAccount controller: %v", err)
|
||||
return nil, true, fmt.Errorf("error creating ServiceAccount controller: %v", err)
|
||||
}
|
||||
go sac.Run(1, ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startTTLController(ctx ControllerContext) (bool, error) {
|
||||
func startTTLController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
go ttlcontroller.NewTTLController(
|
||||
ctx.InformerFactory.Core().V1().Nodes(),
|
||||
ctx.ClientBuilder.ClientOrDie("ttl-controller"),
|
||||
).Run(5, ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startGarbageCollectorController(ctx ControllerContext) (bool, error) {
|
||||
func startGarbageCollectorController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.ComponentConfig.GarbageCollectorController.EnableGarbageCollector {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
gcClientset := ctx.ClientBuilder.ClientOrDie("generic-garbage-collector")
|
||||
@ -355,7 +365,7 @@ func startGarbageCollectorController(ctx ControllerContext) (bool, error) {
|
||||
config := ctx.ClientBuilder.ConfigOrDie("generic-garbage-collector")
|
||||
dynamicClient, err := dynamic.NewForConfig(config)
|
||||
if err != nil {
|
||||
return true, err
|
||||
return nil, true, err
|
||||
}
|
||||
|
||||
// Get an initial set of deletable resources to prime the garbage collector.
|
||||
@ -373,7 +383,7 @@ func startGarbageCollectorController(ctx ControllerContext) (bool, error) {
|
||||
ctx.InformersStarted,
|
||||
)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("Failed to start the generic garbage collector: %v", err)
|
||||
return nil, true, fmt.Errorf("Failed to start the generic garbage collector: %v", err)
|
||||
}
|
||||
|
||||
// Start the garbage collector.
|
||||
@ -384,24 +394,35 @@ func startGarbageCollectorController(ctx ControllerContext) (bool, error) {
|
||||
// the garbage collector.
|
||||
go garbageCollector.Sync(gcClientset.Discovery(), 30*time.Second, ctx.Stop)
|
||||
|
||||
return true, nil
|
||||
return garbagecollector.NewDebugHandler(garbageCollector), true, nil
|
||||
}
|
||||
|
||||
func startPVCProtectionController(ctx ControllerContext) (bool, error) {
|
||||
func startPVCProtectionController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
go pvcprotection.NewPVCProtectionController(
|
||||
ctx.InformerFactory.Core().V1().PersistentVolumeClaims(),
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
ctx.ClientBuilder.ClientOrDie("pvc-protection-controller"),
|
||||
utilfeature.DefaultFeatureGate.Enabled(features.StorageObjectInUseProtection),
|
||||
).Run(1, ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startPVProtectionController(ctx ControllerContext) (bool, error) {
|
||||
func startPVProtectionController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
go pvprotection.NewPVProtectionController(
|
||||
ctx.InformerFactory.Core().V1().PersistentVolumes(),
|
||||
ctx.ClientBuilder.ClientOrDie("pv-protection-controller"),
|
||||
utilfeature.DefaultFeatureGate.Enabled(features.StorageObjectInUseProtection),
|
||||
).Run(1, ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startTTLAfterFinishedController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.TTLAfterFinished) {
|
||||
return nil, false, nil
|
||||
}
|
||||
go ttlafterfinished.New(
|
||||
ctx.InformerFactory.Batch().V1().Jobs(),
|
||||
ctx.ClientBuilder.ClientOrDie("ttl-after-finished-controller"),
|
||||
).Run(int(ctx.ComponentConfig.TTLAfterFinishedController.ConcurrentTTLSyncs), ctx.Stop)
|
||||
return nil, true, nil
|
||||
}
|
||||
|
1
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/import_known_versions.go
generated
vendored
1
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/import_known_versions.go
generated
vendored
@ -26,6 +26,7 @@ import (
|
||||
_ "k8s.io/kubernetes/pkg/apis/autoscaling/install"
|
||||
_ "k8s.io/kubernetes/pkg/apis/batch/install"
|
||||
_ "k8s.io/kubernetes/pkg/apis/certificates/install"
|
||||
_ "k8s.io/kubernetes/pkg/apis/coordination/install"
|
||||
_ "k8s.io/kubernetes/pkg/apis/core/install"
|
||||
_ "k8s.io/kubernetes/pkg/apis/events/install"
|
||||
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
|
||||
|
63
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/BUILD
generated
vendored
63
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/BUILD
generated
vendored
@ -8,30 +8,53 @@ load(
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["options.go"],
|
||||
srcs = [
|
||||
"attachdetachcontroller.go",
|
||||
"csrsigningcontroller.go",
|
||||
"daemonsetcontroller.go",
|
||||
"deploymentcontroller.go",
|
||||
"deprecatedcontroller.go",
|
||||
"endpointcontroller.go",
|
||||
"garbagecollectorcontroller.go",
|
||||
"hpacontroller.go",
|
||||
"jobcontroller.go",
|
||||
"namespacecontroller.go",
|
||||
"nodeipamcontroller.go",
|
||||
"nodelifecyclecontroller.go",
|
||||
"options.go",
|
||||
"persistentvolumebindercontroller.go",
|
||||
"podgccontroller.go",
|
||||
"replicasetcontroller.go",
|
||||
"replicationcontroller.go",
|
||||
"resourcequotacontroller.go",
|
||||
"serviceaccountcontroller.go",
|
||||
"ttlafterfinishedcontroller.go",
|
||||
],
|
||||
importpath = "k8s.io/kubernetes/cmd/kube-controller-manager/app/options",
|
||||
deps = [
|
||||
"//cmd/controller-manager/app/options:go_default_library",
|
||||
"//cmd/kube-controller-manager/app/config:go_default_library",
|
||||
"//pkg/api/legacyscheme:go_default_library",
|
||||
"//pkg/apis/componentconfig:go_default_library",
|
||||
"//pkg/apis/componentconfig/v1alpha1:go_default_library",
|
||||
"//pkg/controller/apis/config:go_default_library",
|
||||
"//pkg/controller/apis/config/v1alpha1:go_default_library",
|
||||
"//pkg/controller/garbagecollector:go_default_library",
|
||||
"//pkg/features:go_default_library",
|
||||
"//pkg/master/ports:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/server/options:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||
"//staging/src/k8s.io/kube-controller-manager/config/v1alpha1:go_default_library",
|
||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/server/options:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/record:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@ -55,10 +78,12 @@ go_test(
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//cmd/controller-manager/app/options:go_default_library",
|
||||
"//pkg/apis/componentconfig:go_default_library",
|
||||
"//pkg/controller/apis/config:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/apis/config:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/server/options:go_default_library",
|
||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/diff:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/server/options:go_default_library",
|
||||
],
|
||||
)
|
||||
|
62
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/attachdetachcontroller.go
generated
vendored
Normal file
62
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/attachdetachcontroller.go
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// AttachDetachControllerOptions holds the AttachDetachController options.
|
||||
type AttachDetachControllerOptions struct {
|
||||
ReconcilerSyncLoopPeriod metav1.Duration
|
||||
DisableAttachDetachReconcilerSync bool
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to AttachDetachController for controller manager to the specified FlagSet.
|
||||
func (o *AttachDetachControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.BoolVar(&o.DisableAttachDetachReconcilerSync, "disable-attach-detach-reconcile-sync", false, "Disable volume attach detach reconciler sync. Disabling this may cause volumes to be mismatched with pods. Use wisely.")
|
||||
fs.DurationVar(&o.ReconcilerSyncLoopPeriod.Duration, "attach-detach-reconcile-sync-period", o.ReconcilerSyncLoopPeriod.Duration, "The reconciler sync wait time between volume attach detach. This duration must be larger than one second, and increasing this value from the default may allow for volumes to be mismatched with pods.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up AttachDetachController config with options.
|
||||
func (o *AttachDetachControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.AttachDetachControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.DisableAttachDetachReconcilerSync = o.DisableAttachDetachReconcilerSync
|
||||
cfg.ReconcilerSyncLoopPeriod = o.ReconcilerSyncLoopPeriod
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of AttachDetachControllerOptions.
|
||||
func (o *AttachDetachControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
75
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/csrsigningcontroller.go
generated
vendored
Normal file
75
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/csrsigningcontroller.go
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
const (
|
||||
// These defaults are deprecated and exported so that we can warn if
|
||||
// they are being used.
|
||||
|
||||
// DefaultClusterSigningCertFile is deprecated. Do not use.
|
||||
DefaultClusterSigningCertFile = "/etc/kubernetes/ca/ca.pem"
|
||||
// DefaultClusterSigningKeyFile is deprecated. Do not use.
|
||||
DefaultClusterSigningKeyFile = "/etc/kubernetes/ca/ca.key"
|
||||
)
|
||||
|
||||
// CSRSigningControllerOptions holds the CSRSigningController options.
|
||||
type CSRSigningControllerOptions struct {
|
||||
ClusterSigningDuration metav1.Duration
|
||||
ClusterSigningKeyFile string
|
||||
ClusterSigningCertFile string
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to CSRSigningController for controller manager to the specified FlagSet.
|
||||
func (o *CSRSigningControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.StringVar(&o.ClusterSigningCertFile, "cluster-signing-cert-file", o.ClusterSigningCertFile, "Filename containing a PEM-encoded X509 CA certificate used to issue cluster-scoped certificates")
|
||||
fs.StringVar(&o.ClusterSigningKeyFile, "cluster-signing-key-file", o.ClusterSigningKeyFile, "Filename containing a PEM-encoded RSA or ECDSA private key used to sign cluster-scoped certificates")
|
||||
fs.DurationVar(&o.ClusterSigningDuration.Duration, "experimental-cluster-signing-duration", o.ClusterSigningDuration.Duration, "The length of duration signed certificates will be given.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up CSRSigningController config with options.
|
||||
func (o *CSRSigningControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.CSRSigningControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ClusterSigningCertFile = o.ClusterSigningCertFile
|
||||
cfg.ClusterSigningKeyFile = o.ClusterSigningKeyFile
|
||||
cfg.ClusterSigningDuration = o.ClusterSigningDuration
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of CSRSigningControllerOptions.
|
||||
func (o *CSRSigningControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
56
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/daemonsetcontroller.go
generated
vendored
Normal file
56
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/daemonsetcontroller.go
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// DaemonSetControllerOptions holds the DaemonSetController options.
|
||||
type DaemonSetControllerOptions struct {
|
||||
ConcurrentDaemonSetSyncs int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to DaemonSetController for controller manager to the specified FlagSet.
|
||||
func (o *DaemonSetControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// ApplyTo fills up DaemonSetController config with options.
|
||||
func (o *DaemonSetControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.DaemonSetControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentDaemonSetSyncs = o.ConcurrentDaemonSetSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of DaemonSetControllerOptions.
|
||||
func (o *DaemonSetControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
62
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/deploymentcontroller.go
generated
vendored
Normal file
62
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/deploymentcontroller.go
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// DeploymentControllerOptions holds the DeploymentController options.
|
||||
type DeploymentControllerOptions struct {
|
||||
ConcurrentDeploymentSyncs int32
|
||||
DeploymentControllerSyncPeriod metav1.Duration
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to DeploymentController for controller manager to the specified FlagSet.
|
||||
func (o *DeploymentControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Int32Var(&o.ConcurrentDeploymentSyncs, "concurrent-deployment-syncs", o.ConcurrentDeploymentSyncs, "The number of deployment objects that are allowed to sync concurrently. Larger number = more responsive deployments, but more CPU (and network) load")
|
||||
fs.DurationVar(&o.DeploymentControllerSyncPeriod.Duration, "deployment-controller-sync-period", o.DeploymentControllerSyncPeriod.Duration, "Period for syncing the deployments.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up DeploymentController config with options.
|
||||
func (o *DeploymentControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.DeploymentControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentDeploymentSyncs = o.ConcurrentDeploymentSyncs
|
||||
cfg.DeploymentControllerSyncPeriod = o.DeploymentControllerSyncPeriod
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of DeploymentControllerOptions.
|
||||
func (o *DeploymentControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
69
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/deprecatedcontroller.go
generated
vendored
Normal file
69
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/deprecatedcontroller.go
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// DeprecatedControllerOptions holds the DeprecatedController options, those option are deprecated.
|
||||
// TODO remove these fields once the deprecated flags are removed.
|
||||
type DeprecatedControllerOptions struct {
|
||||
DeletingPodsQPS float32
|
||||
DeletingPodsBurst int32
|
||||
RegisterRetryCount int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to DeprecatedController for controller manager to the specified FlagSet.
|
||||
func (o *DeprecatedControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Float32Var(&o.DeletingPodsQPS, "deleting-pods-qps", 0.1, "Number of nodes per second on which pods are deleted in case of node failure.")
|
||||
fs.MarkDeprecated("deleting-pods-qps", "This flag is currently no-op and will be deleted.")
|
||||
fs.Int32Var(&o.DeletingPodsBurst, "deleting-pods-burst", 0, "Number of nodes on which pods are bursty deleted in case of node failure. For more details look into RateLimiter.")
|
||||
fs.MarkDeprecated("deleting-pods-burst", "This flag is currently no-op and will be deleted.")
|
||||
fs.Int32Var(&o.RegisterRetryCount, "register-retry-count", o.RegisterRetryCount, ""+
|
||||
"The number of retries for initial node registration. Retry interval equals node-sync-period.")
|
||||
fs.MarkDeprecated("register-retry-count", "This flag is currently no-op and will be deleted.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up DeprecatedController config with options.
|
||||
func (o *DeprecatedControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.DeprecatedControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.DeletingPodsQPS = o.DeletingPodsQPS
|
||||
cfg.DeletingPodsBurst = o.DeletingPodsBurst
|
||||
cfg.RegisterRetryCount = o.RegisterRetryCount
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of DeprecatedControllerOptions.
|
||||
func (o *DeprecatedControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/endpointcontroller.go
generated
vendored
Normal file
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/endpointcontroller.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// EndpointControllerOptions holds the EndPointController options.
|
||||
type EndpointControllerOptions struct {
|
||||
ConcurrentEndpointSyncs int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to EndPointController for controller manager to the specified FlagSet.
|
||||
func (o *EndpointControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Int32Var(&o.ConcurrentEndpointSyncs, "concurrent-endpoint-syncs", o.ConcurrentEndpointSyncs, "The number of endpoint syncing operations that will be done concurrently. Larger number = faster endpoint updating, but more CPU (and network) load")
|
||||
}
|
||||
|
||||
// ApplyTo fills up EndPointController config with options.
|
||||
func (o *EndpointControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.EndpointControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentEndpointSyncs = o.ConcurrentEndpointSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of EndpointControllerOptions.
|
||||
func (o *EndpointControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
63
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/garbagecollectorcontroller.go
generated
vendored
Normal file
63
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/garbagecollectorcontroller.go
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// GarbageCollectorControllerOptions holds the GarbageCollectorController options.
|
||||
type GarbageCollectorControllerOptions struct {
|
||||
ConcurrentGCSyncs int32
|
||||
GCIgnoredResources []kubectrlmgrconfig.GroupResource
|
||||
EnableGarbageCollector bool
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to GarbageCollectorController for controller manager to the specified FlagSet.
|
||||
func (o *GarbageCollectorControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Int32Var(&o.ConcurrentGCSyncs, "concurrent-gc-syncs", o.ConcurrentGCSyncs, "The number of garbage collector workers that are allowed to sync concurrently.")
|
||||
fs.BoolVar(&o.EnableGarbageCollector, "enable-garbage-collector", o.EnableGarbageCollector, "Enables the generic garbage collector. MUST be synced with the corresponding flag of the kube-apiserver.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up GarbageCollectorController config with options.
|
||||
func (o *GarbageCollectorControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.GarbageCollectorControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentGCSyncs = o.ConcurrentGCSyncs
|
||||
cfg.GCIgnoredResources = o.GCIgnoredResources
|
||||
cfg.EnableGarbageCollector = o.EnableGarbageCollector
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of GarbageCollectorController.
|
||||
func (o *GarbageCollectorControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
81
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/hpacontroller.go
generated
vendored
Normal file
81
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/hpacontroller.go
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// HPAControllerOptions holds the HPAController options.
|
||||
type HPAControllerOptions struct {
|
||||
HorizontalPodAutoscalerUseRESTClients bool
|
||||
HorizontalPodAutoscalerTolerance float64
|
||||
HorizontalPodAutoscalerDownscaleStabilizationWindow metav1.Duration
|
||||
HorizontalPodAutoscalerDownscaleForbiddenWindow metav1.Duration
|
||||
HorizontalPodAutoscalerUpscaleForbiddenWindow metav1.Duration
|
||||
HorizontalPodAutoscalerSyncPeriod metav1.Duration
|
||||
HorizontalPodAutoscalerCPUInitializationPeriod metav1.Duration
|
||||
HorizontalPodAutoscalerInitialReadinessDelay metav1.Duration
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to HPAController for controller manager to the specified FlagSet.
|
||||
func (o *HPAControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.DurationVar(&o.HorizontalPodAutoscalerSyncPeriod.Duration, "horizontal-pod-autoscaler-sync-period", o.HorizontalPodAutoscalerSyncPeriod.Duration, "The period for syncing the number of pods in horizontal pod autoscaler.")
|
||||
fs.DurationVar(&o.HorizontalPodAutoscalerUpscaleForbiddenWindow.Duration, "horizontal-pod-autoscaler-upscale-delay", o.HorizontalPodAutoscalerUpscaleForbiddenWindow.Duration, "The period since last upscale, before another upscale can be performed in horizontal pod autoscaler.")
|
||||
fs.MarkDeprecated("horizontal-pod-autoscaler-upscale-delay", "This flag is currently no-op and will be deleted.")
|
||||
fs.DurationVar(&o.HorizontalPodAutoscalerDownscaleStabilizationWindow.Duration, "horizontal-pod-autoscaler-downscale-stabilization", o.HorizontalPodAutoscalerDownscaleStabilizationWindow.Duration, "The period for which autoscaler will look backwards and not scale down below any recommendation it made during that period.")
|
||||
fs.DurationVar(&o.HorizontalPodAutoscalerDownscaleForbiddenWindow.Duration, "horizontal-pod-autoscaler-downscale-delay", o.HorizontalPodAutoscalerDownscaleForbiddenWindow.Duration, "The period since last downscale, before another downscale can be performed in horizontal pod autoscaler.")
|
||||
fs.MarkDeprecated("horizontal-pod-autoscaler-downscale-delay", "This flag is currently no-op and will be deleted.")
|
||||
fs.Float64Var(&o.HorizontalPodAutoscalerTolerance, "horizontal-pod-autoscaler-tolerance", o.HorizontalPodAutoscalerTolerance, "The minimum change (from 1.0) in the desired-to-actual metrics ratio for the horizontal pod autoscaler to consider scaling.")
|
||||
fs.BoolVar(&o.HorizontalPodAutoscalerUseRESTClients, "horizontal-pod-autoscaler-use-rest-clients", o.HorizontalPodAutoscalerUseRESTClients, "If set to true, causes the horizontal pod autoscaler controller to use REST clients through the kube-aggregator, instead of using the legacy metrics client through the API server proxy. This is required for custom metrics support in the horizontal pod autoscaler.")
|
||||
fs.DurationVar(&o.HorizontalPodAutoscalerCPUInitializationPeriod.Duration, "horizontal-pod-autoscaler-cpu-initialization-period", o.HorizontalPodAutoscalerCPUInitializationPeriod.Duration, "The period after pod start when CPU samples might be skipped.")
|
||||
fs.MarkDeprecated("horizontal-pod-autoscaler-use-rest-clients", "Heapster is no longer supported as a source for Horizontal Pod Autoscaler metrics.")
|
||||
fs.DurationVar(&o.HorizontalPodAutoscalerInitialReadinessDelay.Duration, "horizontal-pod-autoscaler-initial-readiness-delay", o.HorizontalPodAutoscalerInitialReadinessDelay.Duration, "The period after pod start during which readiness changes will be treated as initial readiness.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up HPAController config with options.
|
||||
func (o *HPAControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.HPAControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.HorizontalPodAutoscalerSyncPeriod = o.HorizontalPodAutoscalerSyncPeriod
|
||||
cfg.HorizontalPodAutoscalerDownscaleStabilizationWindow = o.HorizontalPodAutoscalerDownscaleStabilizationWindow
|
||||
cfg.HorizontalPodAutoscalerTolerance = o.HorizontalPodAutoscalerTolerance
|
||||
cfg.HorizontalPodAutoscalerUseRESTClients = o.HorizontalPodAutoscalerUseRESTClients
|
||||
cfg.HorizontalPodAutoscalerCPUInitializationPeriod = o.HorizontalPodAutoscalerCPUInitializationPeriod
|
||||
cfg.HorizontalPodAutoscalerInitialReadinessDelay = o.HorizontalPodAutoscalerInitialReadinessDelay
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of HPAControllerOptions.
|
||||
func (o *HPAControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
56
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/jobcontroller.go
generated
vendored
Normal file
56
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/jobcontroller.go
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// JobControllerOptions holds the JobController options.
|
||||
type JobControllerOptions struct {
|
||||
ConcurrentJobSyncs int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to JobController for controller manager to the specified FlagSet.
|
||||
func (o *JobControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// ApplyTo fills up JobController config with options.
|
||||
func (o *JobControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.JobControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentJobSyncs = o.ConcurrentJobSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of JobControllerOptions.
|
||||
func (o *JobControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
62
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/namespacecontroller.go
generated
vendored
Normal file
62
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/namespacecontroller.go
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// NamespaceControllerOptions holds the NamespaceController options.
|
||||
type NamespaceControllerOptions struct {
|
||||
NamespaceSyncPeriod metav1.Duration
|
||||
ConcurrentNamespaceSyncs int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to NamespaceController for controller manager to the specified FlagSet.
|
||||
func (o *NamespaceControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.DurationVar(&o.NamespaceSyncPeriod.Duration, "namespace-sync-period", o.NamespaceSyncPeriod.Duration, "The period for syncing namespace life-cycle updates")
|
||||
fs.Int32Var(&o.ConcurrentNamespaceSyncs, "concurrent-namespace-syncs", o.ConcurrentNamespaceSyncs, "The number of namespace objects that are allowed to sync concurrently. Larger number = more responsive namespace termination, but more CPU (and network) load")
|
||||
}
|
||||
|
||||
// ApplyTo fills up NamespaceController config with options.
|
||||
func (o *NamespaceControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.NamespaceControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.NamespaceSyncPeriod = o.NamespaceSyncPeriod
|
||||
cfg.ConcurrentNamespaceSyncs = o.ConcurrentNamespaceSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of NamespaceControllerOptions.
|
||||
func (o *NamespaceControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
61
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/nodeipamcontroller.go
generated
vendored
Normal file
61
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/nodeipamcontroller.go
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// NodeIPAMControllerOptions holds the NodeIpamController options.
|
||||
type NodeIPAMControllerOptions struct {
|
||||
ServiceCIDR string
|
||||
NodeCIDRMaskSize int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to NodeIpamController for controller manager to the specified FlagSet.
|
||||
func (o *NodeIPAMControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.StringVar(&o.ServiceCIDR, "service-cluster-ip-range", o.ServiceCIDR, "CIDR Range for Services in cluster. Requires --allocate-node-cidrs to be true")
|
||||
fs.Int32Var(&o.NodeCIDRMaskSize, "node-cidr-mask-size", o.NodeCIDRMaskSize, "Mask size for node cidr in cluster.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up NodeIpamController config with options.
|
||||
func (o *NodeIPAMControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.NodeIPAMControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ServiceCIDR = o.ServiceCIDR
|
||||
cfg.NodeCIDRMaskSize = o.NodeCIDRMaskSize
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of NodeIPAMControllerOptions.
|
||||
func (o *NodeIPAMControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
84
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/nodelifecyclecontroller.go
generated
vendored
Normal file
84
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/nodelifecyclecontroller.go
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// NodeLifecycleControllerOptions holds the NodeLifecycleController options.
|
||||
type NodeLifecycleControllerOptions struct {
|
||||
EnableTaintManager bool
|
||||
NodeEvictionRate float32
|
||||
SecondaryNodeEvictionRate float32
|
||||
NodeStartupGracePeriod metav1.Duration
|
||||
NodeMonitorGracePeriod metav1.Duration
|
||||
PodEvictionTimeout metav1.Duration
|
||||
LargeClusterSizeThreshold int32
|
||||
UnhealthyZoneThreshold float32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to NodeLifecycleController for controller manager to the specified FlagSet.
|
||||
func (o *NodeLifecycleControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.DurationVar(&o.NodeStartupGracePeriod.Duration, "node-startup-grace-period", o.NodeStartupGracePeriod.Duration,
|
||||
"Amount of time which we allow starting Node to be unresponsive before marking it unhealthy.")
|
||||
fs.DurationVar(&o.NodeMonitorGracePeriod.Duration, "node-monitor-grace-period", o.NodeMonitorGracePeriod.Duration,
|
||||
"Amount of time which we allow running Node to be unresponsive before marking it unhealthy. "+
|
||||
"Must be N times more than kubelet's nodeStatusUpdateFrequency, "+
|
||||
"where N means number of retries allowed for kubelet to post node status.")
|
||||
fs.DurationVar(&o.PodEvictionTimeout.Duration, "pod-eviction-timeout", o.PodEvictionTimeout.Duration, "The grace period for deleting pods on failed nodes.")
|
||||
fs.Float32Var(&o.NodeEvictionRate, "node-eviction-rate", 0.1, "Number of nodes per second on which pods are deleted in case of node failure when a zone is healthy (see --unhealthy-zone-threshold for definition of healthy/unhealthy). Zone refers to entire cluster in non-multizone clusters.")
|
||||
fs.Float32Var(&o.SecondaryNodeEvictionRate, "secondary-node-eviction-rate", 0.01, "Number of nodes per second on which pods are deleted in case of node failure when a zone is unhealthy (see --unhealthy-zone-threshold for definition of healthy/unhealthy). Zone refers to entire cluster in non-multizone clusters. This value is implicitly overridden to 0 if the cluster size is smaller than --large-cluster-size-threshold.")
|
||||
fs.Int32Var(&o.LargeClusterSizeThreshold, "large-cluster-size-threshold", 50, "Number of nodes from which NodeController treats the cluster as large for the eviction logic purposes. --secondary-node-eviction-rate is implicitly overridden to 0 for clusters this size or smaller.")
|
||||
fs.Float32Var(&o.UnhealthyZoneThreshold, "unhealthy-zone-threshold", 0.55, "Fraction of Nodes in a zone which needs to be not Ready (minimum 3) for zone to be treated as unhealthy. ")
|
||||
fs.BoolVar(&o.EnableTaintManager, "enable-taint-manager", o.EnableTaintManager, "WARNING: Beta feature. If set to true enables NoExecute Taints and will evict all not-tolerating Pod running on Nodes tainted with this kind of Taints.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up NodeLifecycleController config with options.
|
||||
func (o *NodeLifecycleControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.NodeLifecycleControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.EnableTaintManager = o.EnableTaintManager
|
||||
cfg.NodeStartupGracePeriod = o.NodeStartupGracePeriod
|
||||
cfg.NodeMonitorGracePeriod = o.NodeMonitorGracePeriod
|
||||
cfg.PodEvictionTimeout = o.PodEvictionTimeout
|
||||
cfg.NodeEvictionRate = o.NodeEvictionRate
|
||||
cfg.SecondaryNodeEvictionRate = o.SecondaryNodeEvictionRate
|
||||
cfg.LargeClusterSizeThreshold = o.LargeClusterSizeThreshold
|
||||
cfg.UnhealthyZoneThreshold = o.UnhealthyZoneThreshold
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of NodeLifecycleControllerOptions.
|
||||
func (o *NodeLifecycleControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
369
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/options.go
generated
vendored
369
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/options.go
generated
vendored
@ -21,67 +21,67 @@ package options
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
apiserveroptions "k8s.io/apiserver/pkg/server/options"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
apiserverflag "k8s.io/apiserver/pkg/util/flag"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/client-go/tools/record"
|
||||
kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1"
|
||||
cmoptions "k8s.io/kubernetes/cmd/controller-manager/app/options"
|
||||
kubecontrollerconfig "k8s.io/kubernetes/cmd/kube-controller-manager/app/config"
|
||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||
componentconfigv1alpha1 "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
kubectrlmgrschemev1alpha1 "k8s.io/kubernetes/pkg/controller/apis/config/v1alpha1"
|
||||
"k8s.io/kubernetes/pkg/controller/garbagecollector"
|
||||
"k8s.io/kubernetes/pkg/master/ports"
|
||||
|
||||
// add the kubernetes feature gates
|
||||
_ "k8s.io/kubernetes/pkg/features"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/spf13/pflag"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
const (
|
||||
// KubeControllerManagerUserAgent is the userAgent name when starting kube-controller managers.
|
||||
KubeControllerManagerUserAgent = "kube-controller-manager"
|
||||
)
|
||||
|
||||
// KubeControllerManagerOptions is the main context object for the kube-controller manager.
|
||||
type KubeControllerManagerOptions struct {
|
||||
CloudProvider *cmoptions.CloudProviderOptions
|
||||
Debugging *cmoptions.DebuggingOptions
|
||||
GenericComponent *cmoptions.GenericComponentConfigOptions
|
||||
KubeCloudShared *cmoptions.KubeCloudSharedOptions
|
||||
Generic *cmoptions.GenericControllerManagerConfigurationOptions
|
||||
KubeCloudShared *cmoptions.KubeCloudSharedOptions
|
||||
ServiceController *cmoptions.ServiceControllerOptions
|
||||
|
||||
AttachDetachController *cmoptions.AttachDetachControllerOptions
|
||||
CSRSigningController *cmoptions.CSRSigningControllerOptions
|
||||
DaemonSetController *cmoptions.DaemonSetControllerOptions
|
||||
DeploymentController *cmoptions.DeploymentControllerOptions
|
||||
DeprecatedFlags *cmoptions.DeprecatedControllerOptions
|
||||
EndPointController *cmoptions.EndPointControllerOptions
|
||||
GarbageCollectorController *cmoptions.GarbageCollectorControllerOptions
|
||||
HPAController *cmoptions.HPAControllerOptions
|
||||
JobController *cmoptions.JobControllerOptions
|
||||
NamespaceController *cmoptions.NamespaceControllerOptions
|
||||
NodeIpamController *cmoptions.NodeIpamControllerOptions
|
||||
NodeLifecycleController *cmoptions.NodeLifecycleControllerOptions
|
||||
PersistentVolumeBinderController *cmoptions.PersistentVolumeBinderControllerOptions
|
||||
PodGCController *cmoptions.PodGCControllerOptions
|
||||
ReplicaSetController *cmoptions.ReplicaSetControllerOptions
|
||||
ReplicationController *cmoptions.ReplicationControllerOptions
|
||||
ResourceQuotaController *cmoptions.ResourceQuotaControllerOptions
|
||||
SAController *cmoptions.SAControllerOptions
|
||||
ServiceController *cmoptions.ServiceControllerOptions
|
||||
AttachDetachController *AttachDetachControllerOptions
|
||||
CSRSigningController *CSRSigningControllerOptions
|
||||
DaemonSetController *DaemonSetControllerOptions
|
||||
DeploymentController *DeploymentControllerOptions
|
||||
DeprecatedFlags *DeprecatedControllerOptions
|
||||
EndpointController *EndpointControllerOptions
|
||||
GarbageCollectorController *GarbageCollectorControllerOptions
|
||||
HPAController *HPAControllerOptions
|
||||
JobController *JobControllerOptions
|
||||
NamespaceController *NamespaceControllerOptions
|
||||
NodeIPAMController *NodeIPAMControllerOptions
|
||||
NodeLifecycleController *NodeLifecycleControllerOptions
|
||||
PersistentVolumeBinderController *PersistentVolumeBinderControllerOptions
|
||||
PodGCController *PodGCControllerOptions
|
||||
ReplicaSetController *ReplicaSetControllerOptions
|
||||
ReplicationController *ReplicationControllerOptions
|
||||
ResourceQuotaController *ResourceQuotaControllerOptions
|
||||
SAController *SAControllerOptions
|
||||
TTLAfterFinishedController *TTLAfterFinishedControllerOptions
|
||||
|
||||
Controllers []string
|
||||
ExternalCloudVolumePlugin string
|
||||
|
||||
SecureServing *apiserveroptions.SecureServingOptions
|
||||
SecureServing *apiserveroptions.SecureServingOptionsWithLoopback
|
||||
// TODO: remove insecure serving mode
|
||||
InsecureServing *cmoptions.InsecureServingOptions
|
||||
InsecureServing *apiserveroptions.DeprecatedInsecureServingOptionsWithLoopback
|
||||
Authentication *apiserveroptions.DelegatingAuthenticationOptions
|
||||
Authorization *apiserveroptions.DelegatingAuthorizationOptions
|
||||
|
||||
@ -97,102 +97,107 @@ func NewKubeControllerManagerOptions() (*KubeControllerManagerOptions, error) {
|
||||
}
|
||||
|
||||
s := KubeControllerManagerOptions{
|
||||
CloudProvider: &cmoptions.CloudProviderOptions{},
|
||||
Debugging: &cmoptions.DebuggingOptions{},
|
||||
GenericComponent: cmoptions.NewGenericComponentConfigOptions(componentConfig.GenericComponent),
|
||||
KubeCloudShared: cmoptions.NewKubeCloudSharedOptions(componentConfig.KubeCloudShared),
|
||||
AttachDetachController: &cmoptions.AttachDetachControllerOptions{
|
||||
Generic: cmoptions.NewGenericControllerManagerConfigurationOptions(componentConfig.Generic),
|
||||
KubeCloudShared: cmoptions.NewKubeCloudSharedOptions(componentConfig.KubeCloudShared),
|
||||
AttachDetachController: &AttachDetachControllerOptions{
|
||||
ReconcilerSyncLoopPeriod: componentConfig.AttachDetachController.ReconcilerSyncLoopPeriod,
|
||||
},
|
||||
CSRSigningController: &cmoptions.CSRSigningControllerOptions{
|
||||
CSRSigningController: &CSRSigningControllerOptions{
|
||||
ClusterSigningCertFile: componentConfig.CSRSigningController.ClusterSigningCertFile,
|
||||
ClusterSigningKeyFile: componentConfig.CSRSigningController.ClusterSigningKeyFile,
|
||||
ClusterSigningDuration: componentConfig.CSRSigningController.ClusterSigningDuration,
|
||||
},
|
||||
DaemonSetController: &cmoptions.DaemonSetControllerOptions{
|
||||
DaemonSetController: &DaemonSetControllerOptions{
|
||||
ConcurrentDaemonSetSyncs: componentConfig.DaemonSetController.ConcurrentDaemonSetSyncs,
|
||||
},
|
||||
DeploymentController: &cmoptions.DeploymentControllerOptions{
|
||||
DeploymentController: &DeploymentControllerOptions{
|
||||
ConcurrentDeploymentSyncs: componentConfig.DeploymentController.ConcurrentDeploymentSyncs,
|
||||
DeploymentControllerSyncPeriod: componentConfig.DeploymentController.DeploymentControllerSyncPeriod,
|
||||
},
|
||||
DeprecatedFlags: &cmoptions.DeprecatedControllerOptions{
|
||||
DeprecatedFlags: &DeprecatedControllerOptions{
|
||||
RegisterRetryCount: componentConfig.DeprecatedController.RegisterRetryCount,
|
||||
},
|
||||
EndPointController: &cmoptions.EndPointControllerOptions{
|
||||
ConcurrentEndpointSyncs: componentConfig.EndPointController.ConcurrentEndpointSyncs,
|
||||
EndpointController: &EndpointControllerOptions{
|
||||
ConcurrentEndpointSyncs: componentConfig.EndpointController.ConcurrentEndpointSyncs,
|
||||
},
|
||||
GarbageCollectorController: &cmoptions.GarbageCollectorControllerOptions{
|
||||
GarbageCollectorController: &GarbageCollectorControllerOptions{
|
||||
ConcurrentGCSyncs: componentConfig.GarbageCollectorController.ConcurrentGCSyncs,
|
||||
EnableGarbageCollector: componentConfig.GarbageCollectorController.EnableGarbageCollector,
|
||||
},
|
||||
HPAController: &cmoptions.HPAControllerOptions{
|
||||
HorizontalPodAutoscalerSyncPeriod: componentConfig.HPAController.HorizontalPodAutoscalerSyncPeriod,
|
||||
HorizontalPodAutoscalerUpscaleForbiddenWindow: componentConfig.HPAController.HorizontalPodAutoscalerUpscaleForbiddenWindow,
|
||||
HorizontalPodAutoscalerDownscaleForbiddenWindow: componentConfig.HPAController.HorizontalPodAutoscalerDownscaleForbiddenWindow,
|
||||
HorizontalPodAutoscalerTolerance: componentConfig.HPAController.HorizontalPodAutoscalerTolerance,
|
||||
HorizontalPodAutoscalerUseRESTClients: componentConfig.HPAController.HorizontalPodAutoscalerUseRESTClients,
|
||||
HPAController: &HPAControllerOptions{
|
||||
HorizontalPodAutoscalerSyncPeriod: componentConfig.HPAController.HorizontalPodAutoscalerSyncPeriod,
|
||||
HorizontalPodAutoscalerUpscaleForbiddenWindow: componentConfig.HPAController.HorizontalPodAutoscalerUpscaleForbiddenWindow,
|
||||
HorizontalPodAutoscalerDownscaleForbiddenWindow: componentConfig.HPAController.HorizontalPodAutoscalerDownscaleForbiddenWindow,
|
||||
HorizontalPodAutoscalerDownscaleStabilizationWindow: componentConfig.HPAController.HorizontalPodAutoscalerDownscaleStabilizationWindow,
|
||||
HorizontalPodAutoscalerCPUInitializationPeriod: componentConfig.HPAController.HorizontalPodAutoscalerCPUInitializationPeriod,
|
||||
HorizontalPodAutoscalerInitialReadinessDelay: componentConfig.HPAController.HorizontalPodAutoscalerInitialReadinessDelay,
|
||||
HorizontalPodAutoscalerTolerance: componentConfig.HPAController.HorizontalPodAutoscalerTolerance,
|
||||
HorizontalPodAutoscalerUseRESTClients: componentConfig.HPAController.HorizontalPodAutoscalerUseRESTClients,
|
||||
},
|
||||
JobController: &cmoptions.JobControllerOptions{
|
||||
JobController: &JobControllerOptions{
|
||||
ConcurrentJobSyncs: componentConfig.JobController.ConcurrentJobSyncs,
|
||||
},
|
||||
NamespaceController: &cmoptions.NamespaceControllerOptions{
|
||||
NamespaceController: &NamespaceControllerOptions{
|
||||
NamespaceSyncPeriod: componentConfig.NamespaceController.NamespaceSyncPeriod,
|
||||
ConcurrentNamespaceSyncs: componentConfig.NamespaceController.ConcurrentNamespaceSyncs,
|
||||
},
|
||||
NodeIpamController: &cmoptions.NodeIpamControllerOptions{
|
||||
NodeCIDRMaskSize: componentConfig.NodeIpamController.NodeCIDRMaskSize,
|
||||
NodeIPAMController: &NodeIPAMControllerOptions{
|
||||
NodeCIDRMaskSize: componentConfig.NodeIPAMController.NodeCIDRMaskSize,
|
||||
},
|
||||
NodeLifecycleController: &cmoptions.NodeLifecycleControllerOptions{
|
||||
NodeLifecycleController: &NodeLifecycleControllerOptions{
|
||||
EnableTaintManager: componentConfig.NodeLifecycleController.EnableTaintManager,
|
||||
NodeMonitorGracePeriod: componentConfig.NodeLifecycleController.NodeMonitorGracePeriod,
|
||||
NodeStartupGracePeriod: componentConfig.NodeLifecycleController.NodeStartupGracePeriod,
|
||||
PodEvictionTimeout: componentConfig.NodeLifecycleController.PodEvictionTimeout,
|
||||
},
|
||||
PersistentVolumeBinderController: &cmoptions.PersistentVolumeBinderControllerOptions{
|
||||
PersistentVolumeBinderController: &PersistentVolumeBinderControllerOptions{
|
||||
PVClaimBinderSyncPeriod: componentConfig.PersistentVolumeBinderController.PVClaimBinderSyncPeriod,
|
||||
VolumeConfiguration: componentConfig.PersistentVolumeBinderController.VolumeConfiguration,
|
||||
},
|
||||
PodGCController: &cmoptions.PodGCControllerOptions{
|
||||
PodGCController: &PodGCControllerOptions{
|
||||
TerminatedPodGCThreshold: componentConfig.PodGCController.TerminatedPodGCThreshold,
|
||||
},
|
||||
ReplicaSetController: &cmoptions.ReplicaSetControllerOptions{
|
||||
ReplicaSetController: &ReplicaSetControllerOptions{
|
||||
ConcurrentRSSyncs: componentConfig.ReplicaSetController.ConcurrentRSSyncs,
|
||||
},
|
||||
ReplicationController: &cmoptions.ReplicationControllerOptions{
|
||||
ReplicationController: &ReplicationControllerOptions{
|
||||
ConcurrentRCSyncs: componentConfig.ReplicationController.ConcurrentRCSyncs,
|
||||
},
|
||||
ResourceQuotaController: &cmoptions.ResourceQuotaControllerOptions{
|
||||
ResourceQuotaController: &ResourceQuotaControllerOptions{
|
||||
ResourceQuotaSyncPeriod: componentConfig.ResourceQuotaController.ResourceQuotaSyncPeriod,
|
||||
ConcurrentResourceQuotaSyncs: componentConfig.ResourceQuotaController.ConcurrentResourceQuotaSyncs,
|
||||
},
|
||||
SAController: &cmoptions.SAControllerOptions{
|
||||
SAController: &SAControllerOptions{
|
||||
ConcurrentSATokenSyncs: componentConfig.SAController.ConcurrentSATokenSyncs,
|
||||
},
|
||||
ServiceController: &cmoptions.ServiceControllerOptions{
|
||||
ConcurrentServiceSyncs: componentConfig.ServiceController.ConcurrentServiceSyncs,
|
||||
},
|
||||
Controllers: componentConfig.Controllers,
|
||||
SecureServing: apiserveroptions.NewSecureServingOptions(),
|
||||
InsecureServing: &cmoptions.InsecureServingOptions{
|
||||
BindAddress: net.ParseIP(componentConfig.KubeCloudShared.Address),
|
||||
BindPort: int(componentConfig.KubeCloudShared.Port),
|
||||
BindNetwork: "tcp",
|
||||
TTLAfterFinishedController: &TTLAfterFinishedControllerOptions{
|
||||
ConcurrentTTLSyncs: componentConfig.TTLAfterFinishedController.ConcurrentTTLSyncs,
|
||||
},
|
||||
Authentication: nil, // TODO: enable with apiserveroptions.NewDelegatingAuthenticationOptions()
|
||||
Authorization: nil, // TODO: enable with apiserveroptions.NewDelegatingAuthorizationOptions()
|
||||
SecureServing: apiserveroptions.NewSecureServingOptions().WithLoopback(),
|
||||
InsecureServing: (&apiserveroptions.DeprecatedInsecureServingOptions{
|
||||
BindAddress: net.ParseIP(componentConfig.Generic.Address),
|
||||
BindPort: int(componentConfig.Generic.Port),
|
||||
BindNetwork: "tcp",
|
||||
}).WithLoopback(),
|
||||
Authentication: apiserveroptions.NewDelegatingAuthenticationOptions(),
|
||||
Authorization: apiserveroptions.NewDelegatingAuthorizationOptions(),
|
||||
}
|
||||
|
||||
s.SecureServing.ServerCert.CertDirectory = "/var/run/kubernetes"
|
||||
s.Authentication.RemoteKubeConfigFileOptional = true
|
||||
s.Authorization.RemoteKubeConfigFileOptional = true
|
||||
s.Authorization.AlwaysAllowPaths = []string{"/healthz"}
|
||||
|
||||
// Set the PairName but leave certificate directory blank to generate in-memory by default
|
||||
s.SecureServing.ServerCert.CertDirectory = ""
|
||||
s.SecureServing.ServerCert.PairName = "kube-controller-manager"
|
||||
s.SecureServing.BindPort = ports.KubeControllerManagerPort
|
||||
|
||||
// disable secure serving for now
|
||||
// TODO: enable HTTPS by default
|
||||
s.SecureServing.BindPort = 0
|
||||
|
||||
gcIgnoredResources := make([]componentconfig.GroupResource, 0, len(garbagecollector.DefaultIgnoredResources()))
|
||||
gcIgnoredResources := make([]kubectrlmgrconfig.GroupResource, 0, len(garbagecollector.DefaultIgnoredResources()))
|
||||
for r := range garbagecollector.DefaultIgnoredResources() {
|
||||
gcIgnoredResources = append(gcIgnoredResources, componentconfig.GroupResource{Group: r.Group, Resource: r.Resource})
|
||||
gcIgnoredResources = append(gcIgnoredResources, kubectrlmgrconfig.GroupResource{Group: r.Group, Resource: r.Resource})
|
||||
}
|
||||
|
||||
s.GarbageCollectorController.GCIgnoredResources = gcIgnoredResources
|
||||
@ -201,76 +206,69 @@ func NewKubeControllerManagerOptions() (*KubeControllerManagerOptions, error) {
|
||||
}
|
||||
|
||||
// NewDefaultComponentConfig returns kube-controller manager configuration object.
|
||||
func NewDefaultComponentConfig(insecurePort int32) (componentconfig.KubeControllerManagerConfiguration, error) {
|
||||
func NewDefaultComponentConfig(insecurePort int32) (kubectrlmgrconfig.KubeControllerManagerConfiguration, error) {
|
||||
scheme := runtime.NewScheme()
|
||||
componentconfigv1alpha1.AddToScheme(scheme)
|
||||
componentconfig.AddToScheme(scheme)
|
||||
if err := kubectrlmgrschemev1alpha1.AddToScheme(scheme); err != nil {
|
||||
return kubectrlmgrconfig.KubeControllerManagerConfiguration{}, err
|
||||
}
|
||||
if err := kubectrlmgrconfig.AddToScheme(scheme); err != nil {
|
||||
return kubectrlmgrconfig.KubeControllerManagerConfiguration{}, err
|
||||
}
|
||||
|
||||
versioned := componentconfigv1alpha1.KubeControllerManagerConfiguration{}
|
||||
versioned := kubectrlmgrconfigv1alpha1.KubeControllerManagerConfiguration{}
|
||||
scheme.Default(&versioned)
|
||||
|
||||
internal := componentconfig.KubeControllerManagerConfiguration{}
|
||||
internal := kubectrlmgrconfig.KubeControllerManagerConfiguration{}
|
||||
if err := scheme.Convert(&versioned, &internal, nil); err != nil {
|
||||
return internal, err
|
||||
}
|
||||
internal.KubeCloudShared.Port = insecurePort
|
||||
internal.Generic.Port = insecurePort
|
||||
return internal, nil
|
||||
}
|
||||
|
||||
// AddFlags adds flags for a specific KubeControllerManagerOptions to the specified FlagSet
|
||||
func (s *KubeControllerManagerOptions) AddFlags(fs *pflag.FlagSet, allControllers []string, disabledByDefaultControllers []string) {
|
||||
s.CloudProvider.AddFlags(fs)
|
||||
s.Debugging.AddFlags(fs)
|
||||
s.GenericComponent.AddFlags(fs)
|
||||
s.KubeCloudShared.AddFlags(fs)
|
||||
s.ServiceController.AddFlags(fs)
|
||||
// Flags returns flags for a specific APIServer by section name
|
||||
func (s *KubeControllerManagerOptions) Flags(allControllers []string, disabledByDefaultControllers []string) apiserverflag.NamedFlagSets {
|
||||
fss := apiserverflag.NamedFlagSets{}
|
||||
s.Generic.AddFlags(&fss, allControllers, disabledByDefaultControllers)
|
||||
s.KubeCloudShared.AddFlags(fss.FlagSet("generic"))
|
||||
s.ServiceController.AddFlags(fss.FlagSet("service controller"))
|
||||
|
||||
s.SecureServing.AddFlags(fs)
|
||||
s.InsecureServing.AddFlags(fs)
|
||||
s.Authentication.AddFlags(fs)
|
||||
s.Authorization.AddFlags(fs)
|
||||
s.SecureServing.AddFlags(fss.FlagSet("secure serving"))
|
||||
s.InsecureServing.AddUnqualifiedFlags(fss.FlagSet("insecure serving"))
|
||||
s.Authentication.AddFlags(fss.FlagSet("authentication"))
|
||||
s.Authorization.AddFlags(fss.FlagSet("authorization"))
|
||||
|
||||
s.AttachDetachController.AddFlags(fs)
|
||||
s.CSRSigningController.AddFlags(fs)
|
||||
s.DeploymentController.AddFlags(fs)
|
||||
s.DaemonSetController.AddFlags(fs)
|
||||
s.DeprecatedFlags.AddFlags(fs)
|
||||
s.EndPointController.AddFlags(fs)
|
||||
s.GarbageCollectorController.AddFlags(fs)
|
||||
s.HPAController.AddFlags(fs)
|
||||
s.JobController.AddFlags(fs)
|
||||
s.NamespaceController.AddFlags(fs)
|
||||
s.NodeIpamController.AddFlags(fs)
|
||||
s.NodeLifecycleController.AddFlags(fs)
|
||||
s.PersistentVolumeBinderController.AddFlags(fs)
|
||||
s.PodGCController.AddFlags(fs)
|
||||
s.ReplicaSetController.AddFlags(fs)
|
||||
s.ReplicationController.AddFlags(fs)
|
||||
s.ResourceQuotaController.AddFlags(fs)
|
||||
s.SAController.AddFlags(fs)
|
||||
s.AttachDetachController.AddFlags(fss.FlagSet("attachdetach controller"))
|
||||
s.CSRSigningController.AddFlags(fss.FlagSet("csrsigning controller"))
|
||||
s.DeploymentController.AddFlags(fss.FlagSet("deployment controller"))
|
||||
s.DaemonSetController.AddFlags(fss.FlagSet("daemonset controller"))
|
||||
s.DeprecatedFlags.AddFlags(fss.FlagSet("deprecated"))
|
||||
s.EndpointController.AddFlags(fss.FlagSet("endpoint controller"))
|
||||
s.GarbageCollectorController.AddFlags(fss.FlagSet("garbagecollector controller"))
|
||||
s.HPAController.AddFlags(fss.FlagSet("horizontalpodautoscaling controller"))
|
||||
s.JobController.AddFlags(fss.FlagSet("job controller"))
|
||||
s.NamespaceController.AddFlags(fss.FlagSet("namespace controller"))
|
||||
s.NodeIPAMController.AddFlags(fss.FlagSet("nodeipam controller"))
|
||||
s.NodeLifecycleController.AddFlags(fss.FlagSet("nodelifecycle controller"))
|
||||
s.PersistentVolumeBinderController.AddFlags(fss.FlagSet("persistentvolume-binder controller"))
|
||||
s.PodGCController.AddFlags(fss.FlagSet("podgc controller"))
|
||||
s.ReplicaSetController.AddFlags(fss.FlagSet("replicaset controller"))
|
||||
s.ReplicationController.AddFlags(fss.FlagSet("replicationcontroller"))
|
||||
s.ResourceQuotaController.AddFlags(fss.FlagSet("resourcequota controller"))
|
||||
s.SAController.AddFlags(fss.FlagSet("serviceaccount controller"))
|
||||
s.TTLAfterFinishedController.AddFlags(fss.FlagSet("ttl-after-finished controller"))
|
||||
|
||||
fs := fss.FlagSet("misc")
|
||||
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig).")
|
||||
fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
|
||||
fs.StringSliceVar(&s.Controllers, "controllers", s.Controllers, fmt.Sprintf(""+
|
||||
"A list of controllers to enable. '*' enables all on-by-default controllers, 'foo' enables the controller "+
|
||||
"named 'foo', '-foo' disables the controller named 'foo'.\nAll controllers: %s\nDisabled-by-default controllers: %s",
|
||||
strings.Join(allControllers, ", "), strings.Join(disabledByDefaultControllers, ", ")))
|
||||
fs.StringVar(&s.ExternalCloudVolumePlugin, "external-cloud-volume-plugin", s.ExternalCloudVolumePlugin, "The plugin to use when cloud provider is set to external. Can be empty, should only be set when cloud-provider is external. Currently used to allow node and volume controllers to work for in tree cloud providers.")
|
||||
var dummy string
|
||||
fs.MarkDeprecated("insecure-experimental-approve-all-kubelet-csrs-for-group", "This flag does nothing.")
|
||||
fs.StringVar(&dummy, "insecure-experimental-approve-all-kubelet-csrs-for-group", "", "This flag does nothing.")
|
||||
utilfeature.DefaultFeatureGate.AddFlag(fs)
|
||||
utilfeature.DefaultFeatureGate.AddFlag(fss.FlagSet("generic"))
|
||||
|
||||
return fss
|
||||
}
|
||||
|
||||
// ApplyTo fills up controller manager config with options.
|
||||
func (s *KubeControllerManagerOptions) ApplyTo(c *kubecontrollerconfig.Config, userAgent string) error {
|
||||
if err := s.CloudProvider.ApplyTo(&c.ComponentConfig.CloudProvider); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Debugging.ApplyTo(&c.ComponentConfig.Debugging); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.GenericComponent.ApplyTo(&c.ComponentConfig.GenericComponent); err != nil {
|
||||
func (s *KubeControllerManagerOptions) ApplyTo(c *kubecontrollerconfig.Config) error {
|
||||
if err := s.Generic.ApplyTo(&c.ComponentConfig.Generic); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.KubeCloudShared.ApplyTo(&c.ComponentConfig.KubeCloudShared); err != nil {
|
||||
@ -291,7 +289,7 @@ func (s *KubeControllerManagerOptions) ApplyTo(c *kubecontrollerconfig.Config, u
|
||||
if err := s.DeprecatedFlags.ApplyTo(&c.ComponentConfig.DeprecatedController); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.EndPointController.ApplyTo(&c.ComponentConfig.EndPointController); err != nil {
|
||||
if err := s.EndpointController.ApplyTo(&c.ComponentConfig.EndpointController); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.GarbageCollectorController.ApplyTo(&c.ComponentConfig.GarbageCollectorController); err != nil {
|
||||
@ -306,7 +304,7 @@ func (s *KubeControllerManagerOptions) ApplyTo(c *kubecontrollerconfig.Config, u
|
||||
if err := s.NamespaceController.ApplyTo(&c.ComponentConfig.NamespaceController); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.NodeIpamController.ApplyTo(&c.ComponentConfig.NodeIpamController); err != nil {
|
||||
if err := s.NodeIPAMController.ApplyTo(&c.ComponentConfig.NodeIPAMController); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.NodeLifecycleController.ApplyTo(&c.ComponentConfig.NodeLifecycleController); err != nil {
|
||||
@ -333,67 +331,49 @@ func (s *KubeControllerManagerOptions) ApplyTo(c *kubecontrollerconfig.Config, u
|
||||
if err := s.ServiceController.ApplyTo(&c.ComponentConfig.ServiceController); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.SecureServing.ApplyTo(&c.SecureServing); err != nil {
|
||||
if err := s.TTLAfterFinishedController.ApplyTo(&c.ComponentConfig.TTLAfterFinishedController); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.InsecureServing.ApplyTo(&c.InsecureServing); err != nil {
|
||||
if err := s.InsecureServing.ApplyTo(&c.InsecureServing, &c.LoopbackClientConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Authentication.ApplyTo(&c.Authentication, c.SecureServing, nil); err != nil {
|
||||
if err := s.SecureServing.ApplyTo(&c.SecureServing, &c.LoopbackClientConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Authorization.ApplyTo(&c.Authorization); err != nil {
|
||||
return err
|
||||
if s.SecureServing.BindPort != 0 || s.SecureServing.Listener != nil {
|
||||
if err := s.Authentication.ApplyTo(&c.Authentication, c.SecureServing, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Authorization.ApplyTo(&c.Authorization); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// sync back to component config
|
||||
// TODO: find more elegant way than synching back the values.
|
||||
c.ComponentConfig.KubeCloudShared.Port = int32(s.InsecureServing.BindPort)
|
||||
c.ComponentConfig.KubeCloudShared.Address = s.InsecureServing.BindAddress.String()
|
||||
// TODO: find more elegant way than syncing back the values.
|
||||
c.ComponentConfig.Generic.Port = int32(s.InsecureServing.BindPort)
|
||||
c.ComponentConfig.Generic.Address = s.InsecureServing.BindAddress.String()
|
||||
|
||||
var err error
|
||||
c.Kubeconfig, err = clientcmd.BuildConfigFromFlags(s.Master, s.Kubeconfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.Kubeconfig.ContentConfig.ContentType = s.GenericComponent.ContentType
|
||||
c.Kubeconfig.QPS = s.GenericComponent.KubeAPIQPS
|
||||
c.Kubeconfig.Burst = int(s.GenericComponent.KubeAPIBurst)
|
||||
|
||||
c.Client, err = clientset.NewForConfig(restclient.AddUserAgent(c.Kubeconfig, userAgent))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.LeaderElectionClient = clientset.NewForConfigOrDie(restclient.AddUserAgent(c.Kubeconfig, "leader-election"))
|
||||
|
||||
c.EventRecorder = createRecorder(c.Client, userAgent)
|
||||
|
||||
c.ComponentConfig.Controllers = s.Controllers
|
||||
c.ComponentConfig.ExternalCloudVolumePlugin = s.ExternalCloudVolumePlugin
|
||||
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate is used to validate the options and config before launching the controller manager
|
||||
func (s *KubeControllerManagerOptions) Validate(allControllers []string, disabledByDefaultControllers []string) error {
|
||||
var errs []error
|
||||
|
||||
errs = append(errs, s.CloudProvider.Validate()...)
|
||||
errs = append(errs, s.Debugging.Validate()...)
|
||||
errs = append(errs, s.GenericComponent.Validate()...)
|
||||
errs = append(errs, s.Generic.Validate(allControllers, disabledByDefaultControllers)...)
|
||||
errs = append(errs, s.KubeCloudShared.Validate()...)
|
||||
errs = append(errs, s.AttachDetachController.Validate()...)
|
||||
errs = append(errs, s.CSRSigningController.Validate()...)
|
||||
errs = append(errs, s.DaemonSetController.Validate()...)
|
||||
errs = append(errs, s.DeploymentController.Validate()...)
|
||||
errs = append(errs, s.DeprecatedFlags.Validate()...)
|
||||
errs = append(errs, s.EndPointController.Validate()...)
|
||||
errs = append(errs, s.EndpointController.Validate()...)
|
||||
errs = append(errs, s.GarbageCollectorController.Validate()...)
|
||||
errs = append(errs, s.HPAController.Validate()...)
|
||||
errs = append(errs, s.JobController.Validate()...)
|
||||
errs = append(errs, s.NamespaceController.Validate()...)
|
||||
errs = append(errs, s.NodeIpamController.Validate()...)
|
||||
errs = append(errs, s.NodeIPAMController.Validate()...)
|
||||
errs = append(errs, s.NodeLifecycleController.Validate()...)
|
||||
errs = append(errs, s.PersistentVolumeBinderController.Validate()...)
|
||||
errs = append(errs, s.PodGCController.Validate()...)
|
||||
@ -402,6 +382,7 @@ func (s *KubeControllerManagerOptions) Validate(allControllers []string, disable
|
||||
errs = append(errs, s.ResourceQuotaController.Validate()...)
|
||||
errs = append(errs, s.SAController.Validate()...)
|
||||
errs = append(errs, s.ServiceController.Validate()...)
|
||||
errs = append(errs, s.TTLAfterFinishedController.Validate()...)
|
||||
errs = append(errs, s.SecureServing.Validate()...)
|
||||
errs = append(errs, s.InsecureServing.Validate()...)
|
||||
errs = append(errs, s.Authentication.Validate()...)
|
||||
@ -409,20 +390,6 @@ func (s *KubeControllerManagerOptions) Validate(allControllers []string, disable
|
||||
|
||||
// TODO: validate component config, master and kubeconfig
|
||||
|
||||
allControllersSet := sets.NewString(allControllers...)
|
||||
for _, controller := range s.Controllers {
|
||||
if controller == "*" {
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(controller, "-") {
|
||||
controller = controller[1:]
|
||||
}
|
||||
|
||||
if !allControllersSet.Has(controller) {
|
||||
errs = append(errs, fmt.Errorf("%q is not in the list of known controllers", controller))
|
||||
}
|
||||
}
|
||||
|
||||
return utilerrors.NewAggregate(errs)
|
||||
}
|
||||
|
||||
@ -432,17 +399,47 @@ func (s KubeControllerManagerOptions) Config(allControllers []string, disabledBy
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c := &kubecontrollerconfig.Config{}
|
||||
if err := s.ApplyTo(c, "kube-controller-manager"); err != nil {
|
||||
if err := s.SecureServing.MaybeDefaultWithSelfSignedCerts("localhost", nil, []net.IP{net.ParseIP("127.0.0.1")}); err != nil {
|
||||
return nil, fmt.Errorf("error creating self-signed certificates: %v", err)
|
||||
}
|
||||
|
||||
kubeconfig, err := clientcmd.BuildConfigFromFlags(s.Master, s.Kubeconfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
kubeconfig.ContentConfig.ContentType = s.Generic.ClientConnection.ContentType
|
||||
kubeconfig.QPS = s.Generic.ClientConnection.QPS
|
||||
kubeconfig.Burst = int(s.Generic.ClientConnection.Burst)
|
||||
|
||||
client, err := clientset.NewForConfig(restclient.AddUserAgent(kubeconfig, KubeControllerManagerUserAgent))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// shallow copy, do not modify the kubeconfig.Timeout.
|
||||
config := *kubeconfig
|
||||
config.Timeout = s.Generic.LeaderElection.RenewDeadline.Duration
|
||||
leaderElectionClient := clientset.NewForConfigOrDie(restclient.AddUserAgent(&config, "leader-election"))
|
||||
|
||||
eventRecorder := createRecorder(client, KubeControllerManagerUserAgent)
|
||||
|
||||
c := &kubecontrollerconfig.Config{
|
||||
Client: client,
|
||||
Kubeconfig: kubeconfig,
|
||||
EventRecorder: eventRecorder,
|
||||
LeaderElectionClient: leaderElectionClient,
|
||||
}
|
||||
if err := s.ApplyTo(c); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func createRecorder(kubeClient kubernetes.Interface, userAgent string) record.EventRecorder {
|
||||
func createRecorder(kubeClient clientset.Interface, userAgent string) record.EventRecorder {
|
||||
eventBroadcaster := record.NewBroadcaster()
|
||||
eventBroadcaster.StartLogging(glog.Infof)
|
||||
eventBroadcaster.StartLogging(klog.Infof)
|
||||
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
|
||||
// TODO: remove dependency on the legacyscheme
|
||||
return eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: userAgent})
|
||||
}
|
||||
|
142
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/options_test.go
generated
vendored
142
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/options_test.go
generated
vendored
@ -25,17 +25,21 @@ import (
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
apimachineryconfig "k8s.io/apimachinery/pkg/apis/config"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
apiserverconfig "k8s.io/apiserver/pkg/apis/config"
|
||||
apiserveroptions "k8s.io/apiserver/pkg/server/options"
|
||||
cmoptions "k8s.io/kubernetes/cmd/controller-manager/app/options"
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
func TestAddFlags(t *testing.T) {
|
||||
f := pflag.NewFlagSet("addflagstest", pflag.ContinueOnError)
|
||||
fs := pflag.NewFlagSet("addflagstest", pflag.ContinueOnError)
|
||||
s, _ := NewKubeControllerManagerOptions()
|
||||
s.AddFlags(f, []string{""}, []string{""})
|
||||
for _, f := range s.Flags([]string{""}, []string{""}).FlagSets {
|
||||
fs.AddFlagSet(f)
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"--address=192.168.4.10",
|
||||
@ -72,6 +76,9 @@ func TestAddFlags(t *testing.T) {
|
||||
"--horizontal-pod-autoscaler-downscale-delay=2m",
|
||||
"--horizontal-pod-autoscaler-sync-period=45s",
|
||||
"--horizontal-pod-autoscaler-upscale-delay=1m",
|
||||
"--horizontal-pod-autoscaler-downscale-stabilization=3m",
|
||||
"--horizontal-pod-autoscaler-cpu-initialization-period=90s",
|
||||
"--horizontal-pod-autoscaler-initial-readiness-delay=50s",
|
||||
"--http2-max-streams-per-connection=47",
|
||||
"--kube-api-burst=100",
|
||||
"--kube-api-content-type=application/json",
|
||||
@ -109,38 +116,38 @@ func TestAddFlags(t *testing.T) {
|
||||
"--cert-dir=/a/b/c",
|
||||
"--bind-address=192.168.4.21",
|
||||
"--secure-port=10001",
|
||||
"--concurrent-ttl-after-finished-syncs=8",
|
||||
}
|
||||
f.Parse(args)
|
||||
fs.Parse(args)
|
||||
// Sort GCIgnoredResources because it's built from a map, which means the
|
||||
// insertion order is random.
|
||||
sort.Sort(sortedGCIgnoredResources(s.GarbageCollectorController.GCIgnoredResources))
|
||||
|
||||
expected := &KubeControllerManagerOptions{
|
||||
CloudProvider: &cmoptions.CloudProviderOptions{
|
||||
Name: "gce",
|
||||
CloudConfigFile: "/cloud-config",
|
||||
},
|
||||
Debugging: &cmoptions.DebuggingOptions{
|
||||
EnableProfiling: false,
|
||||
EnableContentionProfiling: true,
|
||||
},
|
||||
GenericComponent: &cmoptions.GenericComponentConfigOptions{
|
||||
MinResyncPeriod: metav1.Duration{Duration: 8 * time.Hour},
|
||||
ContentType: "application/json",
|
||||
KubeAPIQPS: 50.0,
|
||||
KubeAPIBurst: 100,
|
||||
Generic: &cmoptions.GenericControllerManagerConfigurationOptions{
|
||||
Port: 10252, // Note: InsecureServingOptions.ApplyTo will write the flag value back into the component config
|
||||
Address: "0.0.0.0", // Note: InsecureServingOptions.ApplyTo will write the flag value back into the component config
|
||||
MinResyncPeriod: metav1.Duration{Duration: 8 * time.Hour},
|
||||
ClientConnection: apimachineryconfig.ClientConnectionConfiguration{
|
||||
ContentType: "application/json",
|
||||
QPS: 50.0,
|
||||
Burst: 100,
|
||||
},
|
||||
ControllerStartInterval: metav1.Duration{Duration: 2 * time.Minute},
|
||||
LeaderElection: componentconfig.LeaderElectionConfiguration{
|
||||
LeaderElection: apiserverconfig.LeaderElectionConfiguration{
|
||||
ResourceLock: "configmap",
|
||||
LeaderElect: false,
|
||||
LeaseDuration: metav1.Duration{Duration: 30 * time.Second},
|
||||
RenewDeadline: metav1.Duration{Duration: 15 * time.Second},
|
||||
RetryPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||
},
|
||||
Debugging: &cmoptions.DebuggingOptions{
|
||||
EnableProfiling: false,
|
||||
EnableContentionProfiling: true,
|
||||
},
|
||||
Controllers: []string{"foo", "bar"},
|
||||
},
|
||||
KubeCloudShared: &cmoptions.KubeCloudSharedOptions{
|
||||
Port: 10252, // Note: InsecureServingOptions.ApplyTo will write the flag value back into the component config + AllocateNodeCIDRs: true,
|
||||
Address: "0.0.0.0", // Note: InsecureServingOptions.ApplyTo will write the flag value back into the component config
|
||||
UseServiceAccountCredentials: true,
|
||||
RouteReconciliationPeriod: metav1.Duration{Duration: 30 * time.Second},
|
||||
NodeMonitorPeriod: metav1.Duration{Duration: 10 * time.Second},
|
||||
@ -149,63 +156,62 @@ func TestAddFlags(t *testing.T) {
|
||||
AllocateNodeCIDRs: true,
|
||||
CIDRAllocatorType: "CloudAllocator",
|
||||
ConfigureCloudRoutes: false,
|
||||
CloudProvider: &cmoptions.CloudProviderOptions{
|
||||
Name: "gce",
|
||||
CloudConfigFile: "/cloud-config",
|
||||
},
|
||||
},
|
||||
AttachDetachController: &cmoptions.AttachDetachControllerOptions{
|
||||
AttachDetachController: &AttachDetachControllerOptions{
|
||||
ReconcilerSyncLoopPeriod: metav1.Duration{Duration: 30 * time.Second},
|
||||
DisableAttachDetachReconcilerSync: true,
|
||||
},
|
||||
CSRSigningController: &cmoptions.CSRSigningControllerOptions{
|
||||
CSRSigningController: &CSRSigningControllerOptions{
|
||||
ClusterSigningCertFile: "/cluster-signing-cert",
|
||||
ClusterSigningKeyFile: "/cluster-signing-key",
|
||||
ClusterSigningDuration: metav1.Duration{Duration: 10 * time.Hour},
|
||||
},
|
||||
DaemonSetController: &cmoptions.DaemonSetControllerOptions{
|
||||
DaemonSetController: &DaemonSetControllerOptions{
|
||||
ConcurrentDaemonSetSyncs: 2,
|
||||
},
|
||||
DeploymentController: &cmoptions.DeploymentControllerOptions{
|
||||
DeploymentController: &DeploymentControllerOptions{
|
||||
ConcurrentDeploymentSyncs: 10,
|
||||
DeploymentControllerSyncPeriod: metav1.Duration{Duration: 45 * time.Second},
|
||||
},
|
||||
DeprecatedFlags: &cmoptions.DeprecatedControllerOptions{
|
||||
DeprecatedFlags: &DeprecatedControllerOptions{
|
||||
DeletingPodsQPS: 0.1,
|
||||
RegisterRetryCount: 10,
|
||||
},
|
||||
EndPointController: &cmoptions.EndPointControllerOptions{
|
||||
EndpointController: &EndpointControllerOptions{
|
||||
ConcurrentEndpointSyncs: 10,
|
||||
},
|
||||
GarbageCollectorController: &cmoptions.GarbageCollectorControllerOptions{
|
||||
GarbageCollectorController: &GarbageCollectorControllerOptions{
|
||||
ConcurrentGCSyncs: 30,
|
||||
GCIgnoredResources: []componentconfig.GroupResource{
|
||||
{Group: "extensions", Resource: "replicationcontrollers"},
|
||||
{Group: "", Resource: "bindings"},
|
||||
{Group: "", Resource: "componentstatuses"},
|
||||
GCIgnoredResources: []kubectrlmgrconfig.GroupResource{
|
||||
{Group: "", Resource: "events"},
|
||||
{Group: "authentication.k8s.io", Resource: "tokenreviews"},
|
||||
{Group: "authorization.k8s.io", Resource: "subjectaccessreviews"},
|
||||
{Group: "authorization.k8s.io", Resource: "selfsubjectaccessreviews"},
|
||||
{Group: "authorization.k8s.io", Resource: "localsubjectaccessreviews"},
|
||||
{Group: "authorization.k8s.io", Resource: "selfsubjectrulesreviews"},
|
||||
},
|
||||
EnableGarbageCollector: false,
|
||||
},
|
||||
HPAController: &cmoptions.HPAControllerOptions{
|
||||
HorizontalPodAutoscalerSyncPeriod: metav1.Duration{Duration: 45 * time.Second},
|
||||
HorizontalPodAutoscalerUpscaleForbiddenWindow: metav1.Duration{Duration: 1 * time.Minute},
|
||||
HorizontalPodAutoscalerDownscaleForbiddenWindow: metav1.Duration{Duration: 2 * time.Minute},
|
||||
HorizontalPodAutoscalerTolerance: 0.1,
|
||||
HorizontalPodAutoscalerUseRESTClients: true,
|
||||
HPAController: &HPAControllerOptions{
|
||||
HorizontalPodAutoscalerSyncPeriod: metav1.Duration{Duration: 45 * time.Second},
|
||||
HorizontalPodAutoscalerUpscaleForbiddenWindow: metav1.Duration{Duration: 1 * time.Minute},
|
||||
HorizontalPodAutoscalerDownscaleForbiddenWindow: metav1.Duration{Duration: 2 * time.Minute},
|
||||
HorizontalPodAutoscalerDownscaleStabilizationWindow: metav1.Duration{Duration: 3 * time.Minute},
|
||||
HorizontalPodAutoscalerCPUInitializationPeriod: metav1.Duration{Duration: 90 * time.Second},
|
||||
HorizontalPodAutoscalerInitialReadinessDelay: metav1.Duration{Duration: 50 * time.Second},
|
||||
HorizontalPodAutoscalerTolerance: 0.1,
|
||||
HorizontalPodAutoscalerUseRESTClients: true,
|
||||
},
|
||||
JobController: &cmoptions.JobControllerOptions{
|
||||
JobController: &JobControllerOptions{
|
||||
ConcurrentJobSyncs: 5,
|
||||
},
|
||||
NamespaceController: &cmoptions.NamespaceControllerOptions{
|
||||
NamespaceController: &NamespaceControllerOptions{
|
||||
NamespaceSyncPeriod: metav1.Duration{Duration: 10 * time.Minute},
|
||||
ConcurrentNamespaceSyncs: 20,
|
||||
},
|
||||
NodeIpamController: &cmoptions.NodeIpamControllerOptions{
|
||||
NodeIPAMController: &NodeIPAMControllerOptions{
|
||||
NodeCIDRMaskSize: 48,
|
||||
},
|
||||
NodeLifecycleController: &cmoptions.NodeLifecycleControllerOptions{
|
||||
NodeLifecycleController: &NodeLifecycleControllerOptions{
|
||||
EnableTaintManager: false,
|
||||
NodeEvictionRate: 0.2,
|
||||
SecondaryNodeEvictionRate: 0.05,
|
||||
@ -215,13 +221,13 @@ func TestAddFlags(t *testing.T) {
|
||||
LargeClusterSizeThreshold: 100,
|
||||
UnhealthyZoneThreshold: 0.6,
|
||||
},
|
||||
PersistentVolumeBinderController: &cmoptions.PersistentVolumeBinderControllerOptions{
|
||||
PersistentVolumeBinderController: &PersistentVolumeBinderControllerOptions{
|
||||
PVClaimBinderSyncPeriod: metav1.Duration{Duration: 30 * time.Second},
|
||||
VolumeConfiguration: componentconfig.VolumeConfiguration{
|
||||
VolumeConfiguration: kubectrlmgrconfig.VolumeConfiguration{
|
||||
EnableDynamicProvisioning: false,
|
||||
EnableHostPathProvisioning: true,
|
||||
FlexVolumePluginDir: "/flex-volume-plugin",
|
||||
PersistentVolumeRecyclerConfiguration: componentconfig.PersistentVolumeRecyclerConfiguration{
|
||||
PersistentVolumeRecyclerConfiguration: kubectrlmgrconfig.PersistentVolumeRecyclerConfiguration{
|
||||
MaximumRetry: 3,
|
||||
MinimumTimeoutNFS: 200,
|
||||
IncrementTimeoutNFS: 45,
|
||||
@ -230,28 +236,30 @@ func TestAddFlags(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
PodGCController: &cmoptions.PodGCControllerOptions{
|
||||
PodGCController: &PodGCControllerOptions{
|
||||
TerminatedPodGCThreshold: 12000,
|
||||
},
|
||||
ReplicaSetController: &cmoptions.ReplicaSetControllerOptions{
|
||||
ReplicaSetController: &ReplicaSetControllerOptions{
|
||||
ConcurrentRSSyncs: 10,
|
||||
},
|
||||
ReplicationController: &cmoptions.ReplicationControllerOptions{
|
||||
ReplicationController: &ReplicationControllerOptions{
|
||||
ConcurrentRCSyncs: 10,
|
||||
},
|
||||
ResourceQuotaController: &cmoptions.ResourceQuotaControllerOptions{
|
||||
ResourceQuotaController: &ResourceQuotaControllerOptions{
|
||||
ResourceQuotaSyncPeriod: metav1.Duration{Duration: 10 * time.Minute},
|
||||
ConcurrentResourceQuotaSyncs: 10,
|
||||
},
|
||||
SAController: &cmoptions.SAControllerOptions{
|
||||
SAController: &SAControllerOptions{
|
||||
ServiceAccountKeyFile: "/service-account-private-key",
|
||||
ConcurrentSATokenSyncs: 10,
|
||||
},
|
||||
ServiceController: &cmoptions.ServiceControllerOptions{
|
||||
ConcurrentServiceSyncs: 2,
|
||||
},
|
||||
Controllers: []string{"foo", "bar"},
|
||||
SecureServing: &apiserveroptions.SecureServingOptions{
|
||||
TTLAfterFinishedController: &TTLAfterFinishedControllerOptions{
|
||||
ConcurrentTTLSyncs: 8,
|
||||
},
|
||||
SecureServing: (&apiserveroptions.SecureServingOptions{
|
||||
BindPort: 10001,
|
||||
BindAddress: net.ParseIP("192.168.4.21"),
|
||||
ServerCert: apiserveroptions.GeneratableKeyCert{
|
||||
@ -259,11 +267,27 @@ func TestAddFlags(t *testing.T) {
|
||||
PairName: "kube-controller-manager",
|
||||
},
|
||||
HTTP2MaxStreamsPerConnection: 47,
|
||||
},
|
||||
InsecureServing: &cmoptions.InsecureServingOptions{
|
||||
}).WithLoopback(),
|
||||
InsecureServing: (&apiserveroptions.DeprecatedInsecureServingOptions{
|
||||
BindAddress: net.ParseIP("192.168.4.10"),
|
||||
BindPort: int(10000),
|
||||
BindNetwork: "tcp",
|
||||
}).WithLoopback(),
|
||||
Authentication: &apiserveroptions.DelegatingAuthenticationOptions{
|
||||
CacheTTL: 10 * time.Second,
|
||||
ClientCert: apiserveroptions.ClientCertAuthenticationOptions{},
|
||||
RequestHeader: apiserveroptions.RequestHeaderAuthenticationOptions{
|
||||
UsernameHeaders: []string{"x-remote-user"},
|
||||
GroupHeaders: []string{"x-remote-group"},
|
||||
ExtraHeaderPrefixes: []string{"x-remote-extra-"},
|
||||
},
|
||||
RemoteKubeConfigFileOptional: true,
|
||||
},
|
||||
Authorization: &apiserveroptions.DelegatingAuthorizationOptions{
|
||||
AllowCacheTTL: 10 * time.Second,
|
||||
DenyCacheTTL: 10 * time.Second,
|
||||
RemoteKubeConfigFileOptional: true,
|
||||
AlwaysAllowPaths: []string{"/healthz"}, // note: this does not match /healthz/ or /healthz/*
|
||||
},
|
||||
Kubeconfig: "/kubeconfig",
|
||||
Master: "192.168.4.20",
|
||||
@ -278,7 +302,7 @@ func TestAddFlags(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
type sortedGCIgnoredResources []componentconfig.GroupResource
|
||||
type sortedGCIgnoredResources []kubectrlmgrconfig.GroupResource
|
||||
|
||||
func (r sortedGCIgnoredResources) Len() int {
|
||||
return len(r)
|
||||
|
70
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/persistentvolumebindercontroller.go
generated
vendored
Normal file
70
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/persistentvolumebindercontroller.go
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// PersistentVolumeBinderControllerOptions holds the PersistentVolumeBinderController options.
|
||||
type PersistentVolumeBinderControllerOptions struct {
|
||||
PVClaimBinderSyncPeriod metav1.Duration
|
||||
VolumeConfiguration kubectrlmgrconfig.VolumeConfiguration
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to PersistentVolumeBinderController for controller manager to the specified FlagSet.
|
||||
func (o *PersistentVolumeBinderControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.DurationVar(&o.PVClaimBinderSyncPeriod.Duration, "pvclaimbinder-sync-period", o.PVClaimBinderSyncPeriod.Duration, "The period for syncing persistent volumes and persistent volume claims")
|
||||
fs.StringVar(&o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, "pv-recycler-pod-template-filepath-nfs", o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, "The file path to a pod definition used as a template for NFS persistent volume recycling")
|
||||
fs.Int32Var(&o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.MinimumTimeoutNFS, "pv-recycler-minimum-timeout-nfs", o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.MinimumTimeoutNFS, "The minimum ActiveDeadlineSeconds to use for an NFS Recycler pod")
|
||||
fs.Int32Var(&o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.IncrementTimeoutNFS, "pv-recycler-increment-timeout-nfs", o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.IncrementTimeoutNFS, "the increment of time added per Gi to ActiveDeadlineSeconds for an NFS scrubber pod")
|
||||
fs.StringVar(&o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, "pv-recycler-pod-template-filepath-hostpath", o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, "The file path to a pod definition used as a template for HostPath persistent volume recycling. This is for development and testing only and will not work in a multi-node cluster.")
|
||||
fs.Int32Var(&o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.MinimumTimeoutHostPath, "pv-recycler-minimum-timeout-hostpath", o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.MinimumTimeoutHostPath, "The minimum ActiveDeadlineSeconds to use for a HostPath Recycler pod. This is for development and testing only and will not work in a multi-node cluster.")
|
||||
fs.Int32Var(&o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.IncrementTimeoutHostPath, "pv-recycler-timeout-increment-hostpath", o.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.IncrementTimeoutHostPath, "the increment of time added per Gi to ActiveDeadlineSeconds for a HostPath scrubber pod. This is for development and testing only and will not work in a multi-node cluster.")
|
||||
fs.BoolVar(&o.VolumeConfiguration.EnableHostPathProvisioning, "enable-hostpath-provisioner", o.VolumeConfiguration.EnableHostPathProvisioning, "Enable HostPath PV provisioning when running without a cloud provider. This allows testing and development of provisioning features. HostPath provisioning is not supported in any way, won't work in a multi-node cluster, and should not be used for anything other than testing or development.")
|
||||
fs.BoolVar(&o.VolumeConfiguration.EnableDynamicProvisioning, "enable-dynamic-provisioning", o.VolumeConfiguration.EnableDynamicProvisioning, "Enable dynamic provisioning for environments that support it.")
|
||||
fs.StringVar(&o.VolumeConfiguration.FlexVolumePluginDir, "flex-volume-plugin-dir", o.VolumeConfiguration.FlexVolumePluginDir, "Full path of the directory in which the flex volume plugin should search for additional third party volume plugins.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up PersistentVolumeBinderController config with options.
|
||||
func (o *PersistentVolumeBinderControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.PersistentVolumeBinderControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.PVClaimBinderSyncPeriod = o.PVClaimBinderSyncPeriod
|
||||
cfg.VolumeConfiguration = o.VolumeConfiguration
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of PersistentVolumeBinderControllerOptions.
|
||||
func (o *PersistentVolumeBinderControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/podgccontroller.go
generated
vendored
Normal file
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/podgccontroller.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// PodGCControllerOptions holds the PodGCController options.
|
||||
type PodGCControllerOptions struct {
|
||||
TerminatedPodGCThreshold int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to PodGCController for controller manager to the specified FlagSet.
|
||||
func (o *PodGCControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Int32Var(&o.TerminatedPodGCThreshold, "terminated-pod-gc-threshold", o.TerminatedPodGCThreshold, "Number of terminated pods that can exist before the terminated pod garbage collector starts deleting terminated pods. If <= 0, the terminated pod garbage collector is disabled.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up PodGCController config with options.
|
||||
func (o *PodGCControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.PodGCControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.TerminatedPodGCThreshold = o.TerminatedPodGCThreshold
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of PodGCControllerOptions.
|
||||
func (o *PodGCControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/replicasetcontroller.go
generated
vendored
Normal file
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/replicasetcontroller.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// ReplicaSetControllerOptions holds the ReplicaSetController options.
|
||||
type ReplicaSetControllerOptions struct {
|
||||
ConcurrentRSSyncs int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to ReplicaSetController for controller manager to the specified FlagSet.
|
||||
func (o *ReplicaSetControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Int32Var(&o.ConcurrentRSSyncs, "concurrent-replicaset-syncs", o.ConcurrentRSSyncs, "The number of replica sets that are allowed to sync concurrently. Larger number = more responsive replica management, but more CPU (and network) load")
|
||||
}
|
||||
|
||||
// ApplyTo fills up ReplicaSetController config with options.
|
||||
func (o *ReplicaSetControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.ReplicaSetControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentRSSyncs = o.ConcurrentRSSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of ReplicaSetControllerOptions.
|
||||
func (o *ReplicaSetControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/replicationcontroller.go
generated
vendored
Normal file
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/replicationcontroller.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// ReplicationControllerOptions holds the ReplicationController options.
|
||||
type ReplicationControllerOptions struct {
|
||||
ConcurrentRCSyncs int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to ReplicationController for controller manager to the specified FlagSet.
|
||||
func (o *ReplicationControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Int32Var(&o.ConcurrentRCSyncs, "concurrent_rc_syncs", o.ConcurrentRCSyncs, "The number of replication controllers that are allowed to sync concurrently. Larger number = more responsive replica management, but more CPU (and network) load")
|
||||
}
|
||||
|
||||
// ApplyTo fills up ReplicationController config with options.
|
||||
func (o *ReplicationControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.ReplicationControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentRCSyncs = o.ConcurrentRCSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of ReplicationControllerOptions.
|
||||
func (o *ReplicationControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
62
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/resourcequotacontroller.go
generated
vendored
Normal file
62
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/resourcequotacontroller.go
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// ResourceQuotaControllerOptions holds the ResourceQuotaController options.
|
||||
type ResourceQuotaControllerOptions struct {
|
||||
ResourceQuotaSyncPeriod metav1.Duration
|
||||
ConcurrentResourceQuotaSyncs int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to ResourceQuotaController for controller manager to the specified FlagSet.
|
||||
func (o *ResourceQuotaControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.DurationVar(&o.ResourceQuotaSyncPeriod.Duration, "resource-quota-sync-period", o.ResourceQuotaSyncPeriod.Duration, "The period for syncing quota usage status in the system")
|
||||
fs.Int32Var(&o.ConcurrentResourceQuotaSyncs, "concurrent-resource-quota-syncs", o.ConcurrentResourceQuotaSyncs, "The number of resource quotas that are allowed to sync concurrently. Larger number = more responsive quota management, but more CPU (and network) load")
|
||||
}
|
||||
|
||||
// ApplyTo fills up ResourceQuotaController config with options.
|
||||
func (o *ResourceQuotaControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.ResourceQuotaControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ResourceQuotaSyncPeriod = o.ResourceQuotaSyncPeriod
|
||||
cfg.ConcurrentResourceQuotaSyncs = o.ConcurrentResourceQuotaSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of ResourceQuotaControllerOptions.
|
||||
func (o *ResourceQuotaControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
64
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/serviceaccountcontroller.go
generated
vendored
Normal file
64
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/serviceaccountcontroller.go
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// SAControllerOptions holds the ServiceAccountController options.
|
||||
type SAControllerOptions struct {
|
||||
ServiceAccountKeyFile string
|
||||
ConcurrentSATokenSyncs int32
|
||||
RootCAFile string
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to ServiceAccountController for controller manager to the specified FlagSet
|
||||
func (o *SAControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.StringVar(&o.ServiceAccountKeyFile, "service-account-private-key-file", o.ServiceAccountKeyFile, "Filename containing a PEM-encoded private RSA or ECDSA key used to sign service account tokens.")
|
||||
fs.Int32Var(&o.ConcurrentSATokenSyncs, "concurrent-serviceaccount-token-syncs", o.ConcurrentSATokenSyncs, "The number of service account token objects that are allowed to sync concurrently. Larger number = more responsive token generation, but more CPU (and network) load")
|
||||
fs.StringVar(&o.RootCAFile, "root-ca-file", o.RootCAFile, "If set, this root certificate authority will be included in service account's token secret. This must be a valid PEM-encoded CA bundle.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up ServiceAccountController config with options.
|
||||
func (o *SAControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.SAControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ServiceAccountKeyFile = o.ServiceAccountKeyFile
|
||||
cfg.ConcurrentSATokenSyncs = o.ConcurrentSATokenSyncs
|
||||
cfg.RootCAFile = o.RootCAFile
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of ServiceAccountControllerOptions.
|
||||
func (o *SAControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/ttlafterfinishedcontroller.go
generated
vendored
Normal file
58
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/options/ttlafterfinishedcontroller.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
// TTLAfterFinishedControllerOptions holds the TTLAfterFinishedController options.
|
||||
type TTLAfterFinishedControllerOptions struct {
|
||||
ConcurrentTTLSyncs int32
|
||||
}
|
||||
|
||||
// AddFlags adds flags related to TTLAfterFinishedController for controller manager to the specified FlagSet.
|
||||
func (o *TTLAfterFinishedControllerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
if o == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fs.Int32Var(&o.ConcurrentTTLSyncs, "concurrent-ttl-after-finished-syncs", o.ConcurrentTTLSyncs, "The number of TTL-after-finished controller workers that are allowed to sync concurrently.")
|
||||
}
|
||||
|
||||
// ApplyTo fills up TTLAfterFinishedController config with options.
|
||||
func (o *TTLAfterFinishedControllerOptions) ApplyTo(cfg *kubectrlmgrconfig.TTLAfterFinishedControllerConfiguration) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg.ConcurrentTTLSyncs = o.ConcurrentTTLSyncs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of TTLAfterFinishedControllerOptions.
|
||||
func (o *TTLAfterFinishedControllerOptions) Validate() []error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
errs := []error{}
|
||||
return errs
|
||||
}
|
39
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/plugins.go
generated
vendored
39
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/plugins.go
generated
vendored
@ -23,15 +23,14 @@ import (
|
||||
|
||||
"fmt"
|
||||
|
||||
// Cloud providers
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||
_ "k8s.io/kubernetes/pkg/cloudprovider/providers"
|
||||
"k8s.io/klog"
|
||||
|
||||
// Cloud providers
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
_ "k8s.io/kubernetes/pkg/cloudprovider/providers"
|
||||
// Volume plugins
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/kubernetes/pkg/cloudprovider"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
"k8s.io/kubernetes/pkg/volume/aws_ebs"
|
||||
"k8s.io/kubernetes/pkg/volume/awsebs"
|
||||
"k8s.io/kubernetes/pkg/volume/azure_dd"
|
||||
"k8s.io/kubernetes/pkg/volume/azure_file"
|
||||
"k8s.io/kubernetes/pkg/volume/cinder"
|
||||
@ -39,7 +38,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/volume/fc"
|
||||
"k8s.io/kubernetes/pkg/volume/flexvolume"
|
||||
"k8s.io/kubernetes/pkg/volume/flocker"
|
||||
"k8s.io/kubernetes/pkg/volume/gce_pd"
|
||||
"k8s.io/kubernetes/pkg/volume/gcepd"
|
||||
"k8s.io/kubernetes/pkg/volume/glusterfs"
|
||||
"k8s.io/kubernetes/pkg/volume/host_path"
|
||||
"k8s.io/kubernetes/pkg/volume/iscsi"
|
||||
@ -55,7 +54,9 @@ import (
|
||||
"k8s.io/kubernetes/pkg/volume/vsphere_volume"
|
||||
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/utils/exec"
|
||||
)
|
||||
|
||||
// ProbeAttachableVolumePlugins collects all volume plugins for the attach/
|
||||
@ -65,8 +66,8 @@ import (
|
||||
func ProbeAttachableVolumePlugins() []volume.VolumePlugin {
|
||||
allPlugins := []volume.VolumePlugin{}
|
||||
|
||||
allPlugins = append(allPlugins, aws_ebs.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, gce_pd.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
|
||||
@ -86,16 +87,16 @@ func ProbeAttachableVolumePlugins() []volume.VolumePlugin {
|
||||
// GetDynamicPluginProber gets the probers of dynamically discoverable plugins
|
||||
// for the attach/detach controller.
|
||||
// Currently only Flexvolume plugins are dynamically discoverable.
|
||||
func GetDynamicPluginProber(config componentconfig.VolumeConfiguration) volume.DynamicPluginProber {
|
||||
return flexvolume.GetDynamicPluginProber(config.FlexVolumePluginDir)
|
||||
func GetDynamicPluginProber(config kubectrlmgrconfig.VolumeConfiguration) volume.DynamicPluginProber {
|
||||
return flexvolume.GetDynamicPluginProber(config.FlexVolumePluginDir, exec.New() /*exec.Interface*/)
|
||||
}
|
||||
|
||||
// ProbeExpandableVolumePlugins returns volume plugins which are expandable
|
||||
func ProbeExpandableVolumePlugins(config componentconfig.VolumeConfiguration) []volume.VolumePlugin {
|
||||
func ProbeExpandableVolumePlugins(config kubectrlmgrconfig.VolumeConfiguration) []volume.VolumePlugin {
|
||||
allPlugins := []volume.VolumePlugin{}
|
||||
|
||||
allPlugins = append(allPlugins, aws_ebs.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, gce_pd.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, portworx.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
|
||||
@ -113,7 +114,7 @@ func ProbeExpandableVolumePlugins(config componentconfig.VolumeConfiguration) []
|
||||
// ProbeControllerVolumePlugins collects all persistent volume plugins into an
|
||||
// easy to use list. Only volume plugins that implement any of
|
||||
// provisioner/recycler/deleter interface should be returned.
|
||||
func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config componentconfig.VolumeConfiguration) []volume.VolumePlugin {
|
||||
func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config kubectrlmgrconfig.VolumeConfiguration) []volume.VolumePlugin {
|
||||
allPlugins := []volume.VolumePlugin{}
|
||||
|
||||
// The list of plugins to probe is decided by this binary, not
|
||||
@ -132,7 +133,7 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config componen
|
||||
ProvisioningEnabled: config.EnableHostPathProvisioning,
|
||||
}
|
||||
if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, &hostPathConfig); err != nil {
|
||||
glog.Fatalf("Could not create hostpath recycler pod from file %s: %+v", config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, err)
|
||||
klog.Fatalf("Could not create hostpath recycler pod from file %s: %+v", config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, err)
|
||||
}
|
||||
allPlugins = append(allPlugins, host_path.ProbeVolumePlugins(hostPathConfig)...)
|
||||
|
||||
@ -142,7 +143,7 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config componen
|
||||
RecyclerPodTemplate: volume.NewPersistentVolumeRecyclerPodTemplate(),
|
||||
}
|
||||
if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, &nfsConfig); err != nil {
|
||||
glog.Fatalf("Could not create NFS recycler pod from file %s: %+v", config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, err)
|
||||
klog.Fatalf("Could not create NFS recycler pod from file %s: %+v", config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, err)
|
||||
}
|
||||
allPlugins = append(allPlugins, nfs.ProbeVolumePlugins(nfsConfig)...)
|
||||
allPlugins = append(allPlugins, glusterfs.ProbeVolumePlugins()...)
|
||||
@ -157,8 +158,8 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config componen
|
||||
allPlugins = append(allPlugins, local.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, storageos.ProbeVolumePlugins()...)
|
||||
|
||||
allPlugins = append(allPlugins, aws_ebs.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, gce_pd.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
|
||||
allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
|
||||
|
12
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/policy.go
generated
vendored
12
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/policy.go
generated
vendored
@ -24,19 +24,21 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/kubernetes/pkg/controller/disruption"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"net/http"
|
||||
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
func startDisruptionController(ctx ControllerContext) (bool, error) {
|
||||
func startDisruptionController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
var group = "policy"
|
||||
var version = "v1beta1"
|
||||
var resource = "poddisruptionbudgets"
|
||||
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: group, Version: version, Resource: resource}] {
|
||||
glog.Infof(
|
||||
klog.Infof(
|
||||
"Refusing to start disruption because resource %q in group %q is not available.",
|
||||
resource, group+"/"+version)
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
go disruption.NewDisruptionController(
|
||||
ctx.InformerFactory.Core().V1().Pods(),
|
||||
@ -47,5 +49,5 @@ func startDisruptionController(ctx ControllerContext) (bool, error) {
|
||||
ctx.InformerFactory.Apps().V1beta1().StatefulSets(),
|
||||
ctx.ClientBuilder.ClientOrDie("disruption-controller"),
|
||||
).Run(ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
8
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/rbac.go
generated
vendored
8
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/rbac.go
generated
vendored
@ -17,17 +17,19 @@ limitations under the License.
|
||||
package app
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/kubernetes/pkg/controller/clusterroleaggregation"
|
||||
)
|
||||
|
||||
func startClusterRoleAggregrationController(ctx ControllerContext) (bool, error) {
|
||||
func startClusterRoleAggregrationController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "clusterroles"}] {
|
||||
return false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
go clusterroleaggregation.NewClusterRoleAggregation(
|
||||
ctx.InformerFactory.Rbac().V1().ClusterRoles(),
|
||||
ctx.ClientBuilder.ClientOrDie("clusterrole-aggregation-controller").RbacV1(),
|
||||
).Run(5, ctx.Stop)
|
||||
return true, nil
|
||||
return nil, true, nil
|
||||
}
|
||||
|
31
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/testing/BUILD
generated
vendored
Normal file
31
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/testing/BUILD
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["testserver.go"],
|
||||
importpath = "k8s.io/kubernetes/cmd/kube-controller-manager/app/testing",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//cmd/kube-controller-manager/app:go_default_library",
|
||||
"//cmd/kube-controller-manager/app/config:go_default_library",
|
||||
"//cmd/kube-controller-manager/app/options:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||
],
|
||||
)
|
175
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/testing/testserver.go
generated
vendored
Normal file
175
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/testing/testserver.go
generated
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
||||
kubecontrollerconfig "k8s.io/kubernetes/cmd/kube-controller-manager/app/config"
|
||||
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
|
||||
)
|
||||
|
||||
// TearDownFunc is to be called to tear down a test server.
|
||||
type TearDownFunc func()
|
||||
|
||||
// TestServer return values supplied by kube-test-ApiServer
|
||||
type TestServer struct {
|
||||
LoopbackClientConfig *restclient.Config // Rest client config using the magic token
|
||||
Options *options.KubeControllerManagerOptions
|
||||
Config *kubecontrollerconfig.Config
|
||||
TearDownFn TearDownFunc // TearDown function
|
||||
TmpDir string // Temp Dir used, by the apiserver
|
||||
}
|
||||
|
||||
// Logger allows t.Testing and b.Testing to be passed to StartTestServer and StartTestServerOrDie
|
||||
type Logger interface {
|
||||
Errorf(format string, args ...interface{})
|
||||
Fatalf(format string, args ...interface{})
|
||||
Logf(format string, args ...interface{})
|
||||
}
|
||||
|
||||
// StartTestServer starts a kube-controller-manager. A rest client config and a tear-down func,
|
||||
// and location of the tmpdir are returned.
|
||||
//
|
||||
// Note: we return a tear-down func instead of a stop channel because the later will leak temporary
|
||||
// files that because Golang testing's call to os.Exit will not give a stop channel go routine
|
||||
// enough time to remove temporary files.
|
||||
func StartTestServer(t Logger, customFlags []string) (result TestServer, err error) {
|
||||
stopCh := make(chan struct{})
|
||||
tearDown := func() {
|
||||
close(stopCh)
|
||||
if len(result.TmpDir) != 0 {
|
||||
os.RemoveAll(result.TmpDir)
|
||||
}
|
||||
}
|
||||
defer func() {
|
||||
if result.TearDownFn == nil {
|
||||
tearDown()
|
||||
}
|
||||
}()
|
||||
|
||||
result.TmpDir, err = ioutil.TempDir("", "kube-controller-manager")
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("failed to create temp dir: %v", err)
|
||||
}
|
||||
|
||||
fs := pflag.NewFlagSet("test", pflag.PanicOnError)
|
||||
|
||||
s, err := options.NewKubeControllerManagerOptions()
|
||||
if err != nil {
|
||||
return TestServer{}, err
|
||||
}
|
||||
all, disabled := app.KnownControllers(), app.ControllersDisabledByDefault.List()
|
||||
namedFlagSets := s.Flags(all, disabled)
|
||||
for _, f := range namedFlagSets.FlagSets {
|
||||
fs.AddFlagSet(f)
|
||||
}
|
||||
fs.Parse(customFlags)
|
||||
|
||||
if s.SecureServing.BindPort != 0 {
|
||||
s.SecureServing.Listener, s.SecureServing.BindPort, err = createListenerOnFreePort()
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("failed to create listener: %v", err)
|
||||
}
|
||||
s.SecureServing.ServerCert.CertDirectory = result.TmpDir
|
||||
|
||||
t.Logf("kube-controller-manager will listen securely on port %d...", s.SecureServing.BindPort)
|
||||
}
|
||||
|
||||
if s.InsecureServing.BindPort != 0 {
|
||||
s.InsecureServing.Listener, s.InsecureServing.BindPort, err = createListenerOnFreePort()
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("failed to create listener: %v", err)
|
||||
}
|
||||
|
||||
t.Logf("kube-controller-manager will listen insecurely on port %d...", s.InsecureServing.BindPort)
|
||||
}
|
||||
|
||||
config, err := s.Config(all, disabled)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("failed to create config from options: %v", err)
|
||||
}
|
||||
|
||||
go func(stopCh <-chan struct{}) {
|
||||
if err := app.Run(config.Complete(), stopCh); err != nil {
|
||||
t.Errorf("kube-apiserver failed run: %v", err)
|
||||
}
|
||||
}(stopCh)
|
||||
|
||||
t.Logf("Waiting for /healthz to be ok...")
|
||||
client, err := kubernetes.NewForConfig(config.LoopbackClientConfig)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("failed to create a client: %v", err)
|
||||
}
|
||||
err = wait.Poll(100*time.Millisecond, 30*time.Second, func() (bool, error) {
|
||||
result := client.CoreV1().RESTClient().Get().AbsPath("/healthz").Do()
|
||||
status := 0
|
||||
result.StatusCode(&status)
|
||||
if status == 200 {
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("failed to wait for /healthz to return ok: %v", err)
|
||||
}
|
||||
|
||||
// from here the caller must call tearDown
|
||||
result.LoopbackClientConfig = config.LoopbackClientConfig
|
||||
result.Options = s
|
||||
result.Config = config
|
||||
result.TearDownFn = tearDown
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// StartTestServerOrDie calls StartTestServer t.Fatal if it does not succeed.
|
||||
func StartTestServerOrDie(t Logger, flags []string) *TestServer {
|
||||
result, err := StartTestServer(t, flags)
|
||||
if err == nil {
|
||||
return &result
|
||||
}
|
||||
|
||||
t.Fatalf("failed to launch server: %v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
func createListenerOnFreePort() (net.Listener, int, error) {
|
||||
ln, err := net.Listen("tcp", ":0")
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
// get port
|
||||
tcpAddr, ok := ln.Addr().(*net.TCPAddr)
|
||||
if !ok {
|
||||
ln.Close()
|
||||
return nil, 0, fmt.Errorf("invalid listen address: %q", ln.Addr().String())
|
||||
}
|
||||
|
||||
return ln, tcpAddr.Port, nil
|
||||
}
|
8
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/controller-manager.go
generated
vendored
8
vendor/k8s.io/kubernetes/cmd/kube-controller-manager/controller-manager.go
generated
vendored
@ -21,15 +21,11 @@ limitations under the License.
|
||||
package main
|
||||
|
||||
import (
|
||||
goflag "flag"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
utilflag "k8s.io/apiserver/pkg/util/flag"
|
||||
"k8s.io/apiserver/pkg/util/logs"
|
||||
"k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
||||
_ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client metric registration
|
||||
@ -39,15 +35,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
command := app.NewControllerManagerCommand()
|
||||
|
||||
// TODO: once we switch everything over to Cobra commands, we can go back to calling
|
||||
// utilflag.InitFlags() (by removing its pflag.Parse() call). For now, we have to set the
|
||||
// normalize func and add the go flag set by hand.
|
||||
pflag.CommandLine.SetNormalizeFunc(utilflag.WordSepNormalizeFunc)
|
||||
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
|
||||
// utilflag.InitFlags()
|
||||
logs.InitLogs()
|
||||
defer logs.FlushLogs()
|
||||
|
Reference in New Issue
Block a user