Skip to content

Commit f160318

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request #35970 from deads2k/controller-15-enable
Automatic merge from submit-queue make using service account credentials from controllers optional Adds a flag to make the "SA per controller" behavior optional.
2 parents da56dc1 + ebf796a commit f160318

File tree

6 files changed

+15
-2
lines changed

6 files changed

+15
-2
lines changed

cmd/kube-controller-manager/app/controllermanager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func Run(s *options.CMServer) error {
167167
ClientConfig: kubeconfig,
168168
}
169169
var clientBuilder controller.ControllerClientBuilder
170-
if len(s.ServiceAccountKeyFile) > 0 {
170+
if len(s.ServiceAccountKeyFile) > 0 && s.UseServiceAccountCredentials {
171171
clientBuilder = controller.SAControllerClientBuilder{
172172
ClientConfig: restclient.AnonymousClientConfig(kubeconfig),
173173
CoreClient: kubeClient.Core(),

cmd/kube-controller-manager/app/options/options.go

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ func NewCMServer() *CMServer {
105105
func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
106106
fs.Int32Var(&s.Port, "port", s.Port, "The port that the controller-manager's http service runs on")
107107
fs.Var(componentconfig.IPVar{Val: &s.Address}, "address", "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
108+
fs.BoolVar(&s.UseServiceAccountCredentials, "use-service-account-credentials", s.UseServiceAccountCredentials, "If true, use individual service account credentials for each controller.")
108109
fs.StringVar(&s.CloudProvider, "cloud-provider", s.CloudProvider, "The provider for cloud services. Empty string for no provider.")
109110
fs.StringVar(&s.CloudConfigFile, "cloud-config", s.CloudConfigFile, "The path to the cloud provider configuration file. Empty string for no configuration file.")
110111
fs.Int32Var(&s.ConcurrentEndpointSyncs, "concurrent-endpoint-syncs", s.ConcurrentEndpointSyncs, "The number of endpoint syncing operations that will be done concurrently. Larger number = faster endpoint updating, but more CPU (and network) load")

hack/verify-flags/known-flags.txt

+1
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ unix-socket
574574
update-period
575575
upgrade-image
576576
upgrade-target
577+
use-service-account-credentials
577578
use-kubernetes-cluster-service
578579
use-kubernetes-version
579580
user-whitelist

pkg/apis/componentconfig/types.go

+3
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,9 @@ type KubeControllerManagerConfiguration struct {
589589
Port int32 `json:"port"`
590590
// address is the IP address to serve on (set to 0.0.0.0 for all interfaces).
591591
Address string `json:"address"`
592+
// useServiceAccountCredentials indicates whether controllers should be run with
593+
// individual service account credentials.
594+
UseServiceAccountCredentials bool `json:"useServiceAccountCredentials"`
592595
// cloudProvider is the provider for cloud services.
593596
CloudProvider string `json:"cloudProvider"`
594597
// cloudConfigFile is the path to the cloud provider configuration file.

pkg/apis/componentconfig/zz_generated.deepcopy.go

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func DeepCopy_componentconfig_KubeControllerManagerConfiguration(in interface{},
7575
out.TypeMeta = in.TypeMeta
7676
out.Port = in.Port
7777
out.Address = in.Address
78+
out.UseServiceAccountCredentials = in.UseServiceAccountCredentials
7879
out.CloudProvider = in.CloudProvider
7980
out.CloudConfigFile = in.CloudConfigFile
8081
out.ConcurrentEndpointSyncs = in.ConcurrentEndpointSyncs

pkg/generated/openapi/zz_generated.openapi.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,13 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
14711471
Format: "",
14721472
},
14731473
},
1474+
"useServiceAccountCredentials": {
1475+
SchemaProps: spec.SchemaProps{
1476+
Description: "useServiceAccountCredentials indicates whether controllers should be run with individual service account credentials.",
1477+
Type: []string{"boolean"},
1478+
Format: "",
1479+
},
1480+
},
14741481
"cloudProvider": {
14751482
SchemaProps: spec.SchemaProps{
14761483
Description: "cloudProvider is the provider for cloud services.",
@@ -1848,7 +1855,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
18481855
},
18491856
},
18501857
},
1851-
Required: []string{"TypeMeta", "port", "address", "cloudProvider", "cloudConfigFile", "concurrentEndpointSyncs", "concurrentRSSyncs", "concurrentRCSyncs", "concurrentServiceSyncs", "concurrentResourceQuotaSyncs", "concurrentDeploymentSyncs", "concurrentDaemonSetSyncs", "concurrentJobSyncs", "concurrentNamespaceSyncs", "concurrentSATokenSyncs", "lookupCacheSizeForRC", "lookupCacheSizeForRS", "lookupCacheSizeForDaemonSet", "serviceSyncPeriod", "nodeSyncPeriod", "routeReconciliationPeriod", "resourceQuotaSyncPeriod", "namespaceSyncPeriod", "pvClaimBinderSyncPeriod", "minResyncPeriod", "terminatedPodGCThreshold", "horizontalPodAutoscalerSyncPeriod", "deploymentControllerSyncPeriod", "podEvictionTimeout", "deletingPodsQps", "deletingPodsBurst", "nodeMonitorGracePeriod", "registerRetryCount", "nodeStartupGracePeriod", "nodeMonitorPeriod", "serviceAccountKeyFile", "clusterSigningCertFile", "clusterSigningKeyFile", "approveAllKubeletCSRsForGroup", "enableProfiling", "clusterName", "clusterCIDR", "serviceCIDR", "nodeCIDRMaskSize", "allocateNodeCIDRs", "configureCloudRoutes", "rootCAFile", "contentType", "kubeAPIQPS", "kubeAPIBurst", "leaderElection", "volumeConfiguration", "controllerStartInterval", "enableGarbageCollector", "concurrentGCSyncs", "nodeEvictionRate", "secondaryNodeEvictionRate", "largeClusterSizeThreshold", "unhealthyZoneThreshold"},
1858+
Required: []string{"TypeMeta", "port", "address", "useServiceAccountCredentials", "cloudProvider", "cloudConfigFile", "concurrentEndpointSyncs", "concurrentRSSyncs", "concurrentRCSyncs", "concurrentServiceSyncs", "concurrentResourceQuotaSyncs", "concurrentDeploymentSyncs", "concurrentDaemonSetSyncs", "concurrentJobSyncs", "concurrentNamespaceSyncs", "concurrentSATokenSyncs", "lookupCacheSizeForRC", "lookupCacheSizeForRS", "lookupCacheSizeForDaemonSet", "serviceSyncPeriod", "nodeSyncPeriod", "routeReconciliationPeriod", "resourceQuotaSyncPeriod", "namespaceSyncPeriod", "pvClaimBinderSyncPeriod", "minResyncPeriod", "terminatedPodGCThreshold", "horizontalPodAutoscalerSyncPeriod", "deploymentControllerSyncPeriod", "podEvictionTimeout", "deletingPodsQps", "deletingPodsBurst", "nodeMonitorGracePeriod", "registerRetryCount", "nodeStartupGracePeriod", "nodeMonitorPeriod", "serviceAccountKeyFile", "clusterSigningCertFile", "clusterSigningKeyFile", "approveAllKubeletCSRsForGroup", "enableProfiling", "clusterName", "clusterCIDR", "serviceCIDR", "nodeCIDRMaskSize", "allocateNodeCIDRs", "configureCloudRoutes", "rootCAFile", "contentType", "kubeAPIQPS", "kubeAPIBurst", "leaderElection", "volumeConfiguration", "controllerStartInterval", "enableGarbageCollector", "concurrentGCSyncs", "nodeEvictionRate", "secondaryNodeEvictionRate", "largeClusterSizeThreshold", "unhealthyZoneThreshold"},
18521859
},
18531860
},
18541861
Dependencies: []string{

0 commit comments

Comments
 (0)