Skip to content

Commit f28691d

Browse files
authored
Merge pull request kubernetes#127062 from eminwux/fix-kcm-flags-doc
Clarify KCM --service-account-private-key-file flag documentation and improve legacy controller warning message.
2 parents 7df5940 + 29f23af commit f28691d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func Run(ctx context.Context, c *config.CompletedConfig) error {
232232
}
233233
}
234234

235-
clientBuilder, rootClientBuilder := createClientBuilders(logger, c)
235+
clientBuilder, rootClientBuilder := createClientBuilders(c)
236236

237237
saTokenControllerDescriptor := newServiceAccountTokenControllerDescriptor(rootClientBuilder)
238238

@@ -869,16 +869,12 @@ func readCA(file string) ([]byte, error) {
869869
}
870870

871871
// createClientBuilders creates clientBuilder and rootClientBuilder from the given configuration
872-
func createClientBuilders(logger klog.Logger, c *config.CompletedConfig) (clientBuilder clientbuilder.ControllerClientBuilder, rootClientBuilder clientbuilder.ControllerClientBuilder) {
872+
func createClientBuilders(c *config.CompletedConfig) (clientBuilder clientbuilder.ControllerClientBuilder, rootClientBuilder clientbuilder.ControllerClientBuilder) {
873+
873874
rootClientBuilder = clientbuilder.SimpleControllerClientBuilder{
874875
ClientConfig: c.Kubeconfig,
875876
}
876877
if c.ComponentConfig.KubeCloudShared.UseServiceAccountCredentials {
877-
if len(c.ComponentConfig.SAController.ServiceAccountKeyFile) == 0 {
878-
// It's possible another controller process is creating the tokens for us.
879-
// If one isn't, we'll timeout and exit when our client builder is unable to create the tokens.
880-
logger.Info("Warning: --use-service-account-credentials was specified without providing a --service-account-private-key-file")
881-
}
882878

883879
clientBuilder = clientbuilder.NewDynamicClientBuilder(
884880
restclient.AnonymousClientConfig(c.Kubeconfig),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (o *SAControllerOptions) AddFlags(fs *pflag.FlagSet) {
3333
return
3434
}
3535

36-
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.")
36+
fs.StringVar(&o.ServiceAccountKeyFile, "service-account-private-key-file", o.ServiceAccountKeyFile, "Enables legacy secret-based tokens when set. Filename containing a PEM-encoded private RSA or ECDSA key used to sign service account tokens.")
3737
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")
3838
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.")
3939
}

0 commit comments

Comments
 (0)