@@ -487,6 +487,13 @@ func (c *system) runController(ctx context.Context, ct *controller) error {
487487 templateData := map [string ]string {
488488 "WebhookPort" : fmt .Sprintf ("%d" , wh .LocalServingPort ),
489489 "WebhookCertDir" : wh .LocalServingCertDir ,
490+ "KubeconfigPath" : c .lcp .KubeconfigPath ,
491+ }
492+
493+ // We cannot override KUBECONFIG, e.g., in case the user supplies a callback that needs to access the cluster,
494+ // such as via credential_process in the AWS config file. The kubeconfig path is set in the controller instead.
495+ if ct .Provider == nil || ct .Provider .Name != "azureaso" {
496+ ct .Args = append (ct .Args , "--kubeconfig={{.KubeconfigPath}}" )
490497 }
491498
492499 args := make ([]string , 0 , len (ct .Args ))
@@ -508,7 +515,10 @@ func (c *system) runController(ctx context.Context, ct *controller) error {
508515 ct .Env = map [string ]string {}
509516 }
510517 // Override KUBECONFIG to point to the local control plane.
511- ct .Env ["KUBECONFIG" ] = c .lcp .KubeconfigPath
518+ // azureaso doesn't support the --kubeconfig parameter.
519+ if ct .Provider != nil && ct .Provider .Name == "azureaso" {
520+ ct .Env ["KUBECONFIG" ] = c .lcp .KubeconfigPath
521+ }
512522 for key , value := range ct .Env {
513523 env = append (env , fmt .Sprintf ("%s=%s" , key , value ))
514524 }
0 commit comments