@@ -96,6 +96,7 @@ func main() {
9696 rateLimiterOptions helper.RateLimiterOptions
9797 featureGates feathelper.FeatureGates
9898 tokenCacheOptions pkgcache.TokenFlags
99+ defaultServiceAccount string
99100 )
100101
101102 flag .StringVar (& metricsAddr , "metrics-addr" , ":8080" , "The address the metric endpoint binds to." )
@@ -114,11 +115,17 @@ func main() {
114115 featureGates .BindFlags (flag .CommandLine )
115116 watchOptions .BindFlags (flag .CommandLine )
116117 tokenCacheOptions .BindFlags (flag .CommandLine , tokenCacheDefaultMaxSize )
118+ flag .StringVar (& defaultServiceAccount , auth .ControllerFlagDefaultServiceAccount ,
119+ "" , "Default service account to use for workload identity when not specified in resources." )
117120
118121 flag .Parse ()
119122
120123 logger .SetLogger (logger .NewLogger (logOptions ))
121124
125+ if defaultServiceAccount != "" {
126+ auth .SetDefaultServiceAccount (defaultServiceAccount )
127+ }
128+
122129 if err := featureGates .WithLogger (setupLog ).SupportedFeatures (features .FeatureGates ()); err != nil {
123130 setupLog .Error (err , "unable to load feature gates" )
124131 os .Exit (1 )
@@ -132,6 +139,11 @@ func main() {
132139 auth .EnableObjectLevelWorkloadIdentity ()
133140 }
134141
142+ if auth .InconsistentObjectLevelConfiguration () {
143+ setupLog .Error (auth .ErrInconsistentObjectLevelConfiguration , "invalid configuration" )
144+ os .Exit (1 )
145+ }
146+
135147 badgerOpts := badger .DefaultOptions (storagePath )
136148 badgerOpts .ValueLogFileSize = storageValueLogFileSize
137149 badgerDB , err := badger .Open (badgerOpts )
0 commit comments