@@ -458,6 +458,8 @@ type options struct {
458458 enableSecretsStoreCSIDriver bool
459459 gsmConfigPath string
460460 gsmConfig api.GSMConfig
461+ gsmProjectConfigPath string
462+ gsmProjectConfig gsm.Config
461463 gsmCredentialsFile string
462464
463465 metricsAgent * metrics.MetricsAgent
@@ -514,7 +516,8 @@ func bindOptions(flag *flag.FlagSet) *options {
514516 flag .StringVar (& opt .impersonateUser , "as" , "" , "Username to impersonate" )
515517 flag .BoolVar (& opt .restrictNetworkAccess , "restrict-network-access" , false , "Restrict network access to 10.0.0.0/8 (RedHat intranet)." )
516518 flag .BoolVar (& opt .enableSecretsStoreCSIDriver , "enable-secrets-store-csi-driver" , false , "Use Secrets Store CSI driver for accessing multi-stage credentials." )
517- flag .StringVar (& opt .gsmConfigPath , "gsm-config" , "" , "Path to the gsm config file." )
519+ flag .StringVar (& opt .gsmConfigPath , "gsm-config" , "" , "Path to the gsm secrets config file." )
520+ flag .StringVar (& opt .gsmProjectConfigPath , "gsm-project-config" , "" , "Path to the GSM project config file." )
518521 flag .StringVar (& opt .gsmCredentialsFile , "gsm-credentials-file" , "" , "Path to GCP service account credentials." )
519522
520523 // flags needed for the configresolver
@@ -769,8 +772,10 @@ func (o *options) Complete() error {
769772 handleTargetAdditionalSuffix (o )
770773
771774 if o .enableSecretsStoreCSIDriver {
772- err := api .LoadGSMConfigFromFile (o .gsmConfigPath , & o .gsmConfig )
773- if err != nil {
775+ if err := api .LoadGSMConfigFromFile (o .gsmConfigPath , & o .gsmConfig ); err != nil {
776+ return err
777+ }
778+ if err = api .LoadGSMProjectConfigFromFile (o .gsmProjectConfigPath , & o .gsmProjectConfig ); err != nil {
774779 return err
775780 }
776781 }
@@ -1062,10 +1067,6 @@ func (o *options) Run() (errs []error) {
10621067
10631068 var gsmConfig * multi_stage.GSMConfiguration
10641069 if o .enableSecretsStoreCSIDriver {
1065- gsmProjectConfig , err := gsm .GetConfigFromEnv ()
1066- if err != nil {
1067- return []error {results .ForReason ("gsm_config" ).WithError (err ).Errorf ("failed to get GSM project config from environment: %v" , err )}
1068- }
10691070 var opts []option.ClientOption
10701071 if o .gsmCredentialsFile != "" {
10711072 opts = append (opts , option .WithCredentialsFile (o .gsmCredentialsFile ))
@@ -1082,7 +1083,7 @@ func (o *options) Run() (errs []error) {
10821083 gsmConfig = & multi_stage.GSMConfiguration {
10831084 Config : & o .gsmConfig ,
10841085 CredentialsFile : o .gsmCredentialsFile ,
1085- ProjectConfig : gsmProjectConfig ,
1086+ ProjectConfig : o . gsmProjectConfig ,
10861087 Client : gsmClient ,
10871088 }
10881089 }
0 commit comments