Split controller flags between controllers

This commit is contained in:
gmarek
2016-02-05 10:56:36 +01:00
parent ce6fd46637
commit 0c191e787b
23 changed files with 765 additions and 213 deletions

View File

@@ -0,0 +1,35 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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"
)
type DaemonControllerOptions struct {
ConcurrentDSCSyncs int
}
func NewDaemonControllerOptions() DaemonControllerOptions {
return DaemonControllerOptions{
ConcurrentDSCSyncs: 2,
}
}
func (o *DaemonControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&o.ConcurrentDSCSyncs, "concurrent-daemonset-controller-syncs", o.ConcurrentDSCSyncs, "The number of deamon sets that are allowed to sync concurrently.")
}

View File

@@ -0,0 +1,36 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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"
)
type DeploymentControllerOptions struct {
ConcurrentDeploymentSyncs int
}
func NewDeploymentControllerOptions() DeploymentControllerOptions {
return DeploymentControllerOptions{
ConcurrentDeploymentSyncs: 5,
}
}
func (o *DeploymentControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&o.ConcurrentDeploymentSyncs, "concurrent-deployment-syncs", o.ConcurrentDeploymentSyncs,
"The number of deployment objects that are allowed to sync concurrently. Larger number = more reponsive deployments, but more CPU (and network) load")
}

View File

@@ -0,0 +1,36 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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"
)
type EndpointControllerOptions struct {
ConcurrentEndpointSyncs int
}
func NewEndpointControllerOptions() EndpointControllerOptions {
return EndpointControllerOptions{
ConcurrentEndpointSyncs: 5,
}
}
func (o *EndpointControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&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")
}

View File

@@ -0,0 +1,37 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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"
)
type GarbageCollectorOptions struct {
TerminatedPodGCThreshold int
}
func NewGarbageCollectorOptions() GarbageCollectorOptions {
return GarbageCollectorOptions{
TerminatedPodGCThreshold: 12500,
}
}
func (o *GarbageCollectorOptions) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&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.")
}

View File

@@ -0,0 +1,35 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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"
)
type JobControllerOptions struct {
ConcurrentJobSyncs int
}
func NewJobControllerOptions() JobControllerOptions {
return JobControllerOptions{
ConcurrentJobSyncs: 5,
}
}
func (o *JobControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&o.ConcurrentJobSyncs, "concurrent-job-syncs", o.ConcurrentJobSyncs, "The number of job objects that are allowed to sync concurrently.")
}

View File

@@ -0,0 +1,37 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 (
"time"
"github.com/spf13/pflag"
)
type NamespaceControllerOptions struct {
NamespaceSyncPeriod time.Duration
}
func NewNamespaceControllerOptions() NamespaceControllerOptions {
return NamespaceControllerOptions{
NamespaceSyncPeriod: 5 * time.Minute,
}
}
func (o *NamespaceControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.DurationVar(&o.NamespaceSyncPeriod, "namespace-sync-period", o.NamespaceSyncPeriod, "The period for syncing namespace life-cycle updates")
}

View File

@@ -0,0 +1,67 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 (
"net"
"time"
"github.com/spf13/pflag"
)
type NodeControllerOptions struct {
AllocateNodeCIDRs bool
ClusterCIDR net.IPNet
DeletingPodsBurst int
DeletingPodsQps float32
NodeMonitorGracePeriod time.Duration
NodeMonitorPeriod time.Duration
NodeStartupGracePeriod time.Duration
PodEvictionTimeout time.Duration
}
func NewNodeControllerOptions() NodeControllerOptions {
return NodeControllerOptions{
AllocateNodeCIDRs: false,
DeletingPodsBurst: 10,
DeletingPodsQps: 0.1,
NodeMonitorGracePeriod: 40 * time.Second,
NodeMonitorPeriod: 5 * time.Second,
NodeStartupGracePeriod: 60 * time.Second,
PodEvictionTimeout: 5 * time.Minute,
}
}
func (o *NodeControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.BoolVar(&o.AllocateNodeCIDRs, "allocate-node-cidrs", o.AllocateNodeCIDRs, "Should CIDRs for Pods be allocated and set on the cloud provider.")
fs.IPNetVar(&o.ClusterCIDR, "cluster-cidr", o.ClusterCIDR, "CIDR Range for Pods in cluster.")
fs.IntVar(&o.DeletingPodsBurst, "deleting-pods-burst", o.DeletingPodsBurst,
"Number of nodes on which pods are bursty deleted in case of node failure. For more details look into RateLimiter.")
fs.Float32Var(&o.DeletingPodsQps, "deleting-pods-qps", o.DeletingPodsQps,
"Number of nodes per second on which pods are deleted in case of node failure.")
fs.DurationVar(&o.NodeMonitorGracePeriod, "node-monitor-grace-period", o.NodeMonitorGracePeriod,
"Amount of time which we allow running Node to be unresponsive before marking it unhealty. "+
"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.NodeMonitorPeriod, "node-monitor-period", o.NodeMonitorPeriod,
"The period for syncing NodeStatus in NodeController.")
fs.DurationVar(&o.NodeStartupGracePeriod, "node-startup-grace-period", o.NodeStartupGracePeriod,
"Amount of time which we allow starting Node to be unresponsive before marking it unhealty.")
fs.DurationVar(&o.PodEvictionTimeout, "pod-eviction-timeout", o.PodEvictionTimeout,
"The grace period for deleting pods on failed nodes.")
}

View File

@@ -0,0 +1,82 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 (
"time"
"github.com/spf13/pflag"
)
// VolumeConfigFlags is used to bind CLI flags to variables. This top-level struct contains *all* enumerated
// CLI flags meant to configure all volume plugins. From this config, the binary will create many instances
// of volume.VolumeConfig which are then passed to the appropriate plugin. The ControllerManager binary is the only
// part of the code which knows what plugins are supported and which CLI flags correspond to each plugin.
type VolumeConfigFlags struct {
PersistentVolumeRecyclerMinimumTimeoutNFS int
PersistentVolumeRecyclerPodTemplateFilePathNFS string
PersistentVolumeRecyclerIncrementTimeoutNFS int
PersistentVolumeRecyclerPodTemplateFilePathHostPath string
PersistentVolumeRecyclerMinimumTimeoutHostPath int
PersistentVolumeRecyclerIncrementTimeoutHostPath int
EnableHostPathProvisioning bool
}
type PersistentVolumeControllerOptions struct {
PVClaimBinderSyncPeriod time.Duration
VolumeConfigFlags VolumeConfigFlags
}
func NewPersistentVolumeControllerOptions() PersistentVolumeControllerOptions {
return PersistentVolumeControllerOptions{
PVClaimBinderSyncPeriod: 10 * time.Minute,
VolumeConfigFlags: VolumeConfigFlags{
// default values here
PersistentVolumeRecyclerMinimumTimeoutNFS: 300,
PersistentVolumeRecyclerIncrementTimeoutNFS: 30,
PersistentVolumeRecyclerMinimumTimeoutHostPath: 60,
PersistentVolumeRecyclerIncrementTimeoutHostPath: 30,
EnableHostPathProvisioning: false,
},
}
}
func (o *PersistentVolumeControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.DurationVar(&o.PVClaimBinderSyncPeriod, "pvclaimbinder-sync-period", o.PVClaimBinderSyncPeriod,
"The period for syncing persistent volumes and persistent volume claims")
fs.StringVar(&o.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathNFS,
"pv-recycler-pod-template-filepath-nfs", o.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathNFS,
"The file path to a pod definition used as a template for NFS persistent volume recycling")
fs.IntVar(&o.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutNFS, "pv-recycler-minimum-timeout-nfs",
o.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutNFS, "The minimum ActiveDeadlineSeconds to use for an NFS Recycler pod")
fs.IntVar(&o.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutNFS, "pv-recycler-increment-timeout-nfs",
o.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutNFS, "the increment of time added per Gi to ActiveDeadlineSeconds for an NFS scrubber pod")
fs.StringVar(&o.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathHostPath, "pv-recycler-pod-template-filepath-hostpath",
o.VolumeConfigFlags.PersistentVolumeRecyclerPodTemplateFilePathHostPath,
"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.IntVar(&o.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutHostPath, "pv-recycler-minimum-timeout-hostpath",
o.VolumeConfigFlags.PersistentVolumeRecyclerMinimumTimeoutHostPath,
"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.IntVar(&o.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutHostPath, "pv-recycler-timeout-increment-hostpath",
o.VolumeConfigFlags.PersistentVolumeRecyclerIncrementTimeoutHostPath,
"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.VolumeConfigFlags.EnableHostPathProvisioning, "enable-hostpath-provisioner", o.VolumeConfigFlags.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.")
}

View File

@@ -0,0 +1,39 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 (
"time"
"github.com/spf13/pflag"
)
type PodAutoscalerOptions struct {
HorizontalPodAutoscalerSyncPeriod time.Duration
}
func NewPodAutoscalerOptions() PodAutoscalerOptions {
return PodAutoscalerOptions{
HorizontalPodAutoscalerSyncPeriod: 30 * time.Second,
}
}
func (o *PodAutoscalerOptions) AddFlags(fs *pflag.FlagSet) {
fs.DurationVar(&o.HorizontalPodAutoscalerSyncPeriod, "horizontal-pod-autoscaler-sync-period", o.HorizontalPodAutoscalerSyncPeriod,
"The period for syncing the number of pods in horizontal pod autoscaler.",
)
}

View File

@@ -0,0 +1,35 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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"
)
type ReplicationControllerOptions struct {
ConcurrentRCSyncs int
}
func NewReplicationControllerOptions() ReplicationControllerOptions {
return ReplicationControllerOptions{
ConcurrentRCSyncs: 5,
}
}
func (o *ReplicationControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&o.ConcurrentRCSyncs, "concurrent_rc_syncs", o.ConcurrentRCSyncs, "The number of replication controllers that are allowed to sync concurrently. Larger number = more reponsive replica management, but more CPU (and network) load")
}

View File

@@ -0,0 +1,41 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 (
"time"
"github.com/spf13/pflag"
)
type ResourceQuotaControllerOptions struct {
ConcurrentResourceQuotaSyncs int
ResourceQuotaSyncPeriod time.Duration
}
func NewResourceQuotaControllerOptions() ResourceQuotaControllerOptions {
return ResourceQuotaControllerOptions{
ConcurrentResourceQuotaSyncs: 5,
ResourceQuotaSyncPeriod: 5 * time.Minute,
}
}
func (o *ResourceQuotaControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&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")
fs.DurationVar(&o.ResourceQuotaSyncPeriod, "resource-quota-sync-period", o.ResourceQuotaSyncPeriod, "The period for syncing quota usage status in the system")
}

View File

@@ -0,0 +1,37 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 (
"time"
"github.com/spf13/pflag"
)
type ServiceControllerOptions struct {
ServiceSyncPeriod time.Duration
}
func NewServiceControllerOptions() ServiceControllerOptions {
return ServiceControllerOptions{
ServiceSyncPeriod: 5 * time.Minute,
}
}
func (o *ServiceControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.DurationVar(&o.ServiceSyncPeriod, "service-sync-period", o.ServiceSyncPeriod, "The period for syncing services with their external load balancers")
}

View File

@@ -0,0 +1,33 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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"
)
type ServiceAccountControllerOptions struct {
ServiceAccountKeyFile string
}
func NewServiceAccountControllerOptions() ServiceAccountControllerOptions {
return ServiceAccountControllerOptions{}
}
func (o *ServiceAccountControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&o.ServiceAccountKeyFile, "service-account-private-key-file", o.ServiceAccountKeyFile, "Filename containing a PEM-encoded private RSA key used to sign service account tokens.")
}