@@ -84,28 +84,29 @@ func main() {
8484 )
8585
8686 var (
87- metricsAddr string
88- eventsAddr string
89- healthAddr string
90- concurrent int
91- requeueDependency time.Duration
92- gracefulShutdownTimeout time.Duration
93- httpRetry int
94- clientOptions client.Options
95- kubeConfigOpts client.KubeConfigOptions
96- featureGates feathelper.FeatureGates
97- logOptions logger.Options
98- aclOptions acl.Options
99- leaderElectionOptions leaderelection.Options
100- rateLimiterOptions helper.RateLimiterOptions
101- watchOptions helper.WatchOptions
102- intervalJitterOptions jitter.IntervalOptions
103- oomWatchInterval time.Duration
104- oomWatchMemoryThreshold uint8
105- oomWatchMaxMemoryPath string
106- oomWatchCurrentMemoryPath string
107- snapshotDigestAlgo string
108- tokenCacheOptions cache.TokenFlags
87+ metricsAddr string
88+ eventsAddr string
89+ healthAddr string
90+ concurrent int
91+ requeueDependency time.Duration
92+ gracefulShutdownTimeout time.Duration
93+ httpRetry int
94+ clientOptions client.Options
95+ kubeConfigOpts client.KubeConfigOptions
96+ featureGates feathelper.FeatureGates
97+ logOptions logger.Options
98+ aclOptions acl.Options
99+ leaderElectionOptions leaderelection.Options
100+ rateLimiterOptions helper.RateLimiterOptions
101+ watchOptions helper.WatchOptions
102+ intervalJitterOptions jitter.IntervalOptions
103+ oomWatchInterval time.Duration
104+ oomWatchMemoryThreshold uint8
105+ oomWatchMaxMemoryPath string
106+ oomWatchCurrentMemoryPath string
107+ snapshotDigestAlgo string
108+ tokenCacheOptions cache.TokenFlags
109+ defaultKubeConfigServiceAccount string
109110 )
110111
111112 flag .StringVar (& metricsAddr , "metrics-addr" , ":8080" ,
@@ -122,8 +123,10 @@ func main() {
122123 "The duration given to the reconciler to finish before forcibly stopping." )
123124 flag .IntVar (& httpRetry , "http-retry" , 9 ,
124125 "The maximum number of retries when failing to fetch artifacts over HTTP." )
125- flag .StringVar (& intkube .DefaultServiceAccountName , "default-service-account" , "" ,
126+ flag .StringVar (& intkube .DefaultServiceAccountName , auth . ControllerFlagDefaultServiceAccount , "" ,
126127 "Default service account used for impersonation." )
128+ flag .StringVar (& defaultKubeConfigServiceAccount , auth .ControllerFlagDefaultKubeConfigServiceAccount , "" ,
129+ "Default service account used for kubeconfig." )
127130 flag .Uint8Var (& oomWatchMemoryThreshold , "oom-watch-memory-threshold" , 95 ,
128131 "The memory threshold in percentage at which the OOM watcher will trigger a graceful shutdown. Requires feature gate 'OOMWatch' to be enabled." )
129132 flag .DurationVar (& oomWatchInterval , "oom-watch-interval" , 500 * time .Millisecond ,
@@ -165,6 +168,10 @@ func main() {
165168 auth .EnableObjectLevelWorkloadIdentity ()
166169 }
167170
171+ if defaultKubeConfigServiceAccount != "" {
172+ auth .SetDefaultKubeConfigServiceAccount (defaultKubeConfigServiceAccount )
173+ }
174+
168175 if err := intervalJitterOptions .SetGlobalJitter (nil ); err != nil {
169176 setupLog .Error (err , "unable to set global jitter" )
170177 os .Exit (1 )
0 commit comments