@@ -429,7 +429,7 @@ func createCommon(cmd *cobra.Command, args []string, storeType nbv1.NSType, popu
429429 log .Fatalf (`❌ %s %s` , validationErr , cmd .UsageString ())
430430 }
431431
432- // Create namespace store CR
432+ // Create namespace store CR
433433 util .Panic (controllerutil .SetControllerReference (sys , namespaceStore , scheme .Scheme ))
434434 if ! util .KubeCreateFailExisting (namespaceStore ) {
435435 log .Fatalf (`❌ Could not create NamespaceStore %q in Namespace %q (conflict)` , namespaceStore .Name , namespaceStore .Namespace )
@@ -703,20 +703,22 @@ func RunCreateAzureSTSBlob(cmd *cobra.Command, args []string) {
703703 log .Fatalf (`❌ Missing expected arguments: <namespace-store-name> %s` , cmd .UsageString ())
704704 }
705705 createCommon (cmd , args , nbv1 .NSStoreTypeAzureBlob , func (namespaceStore * nbv1.NamespaceStore , secret * corev1.Secret ) {
706- targetBlobContainer := util .GetFlagStringOrPrompt (cmd , "target-blob-container" )
707- azureSTSClientID := util .GetFlagStringOrPrompt (cmd , "client-id" )
708- azureSTSTenantID := util .GetFlagStringOrPrompt (cmd , "tenant-id" )
709- if err := validations .ValidateAzureSTSRequiredFlags (targetBlobContainer , azureSTSClientID , azureSTSTenantID ); err != nil {
710- log .Fatalf (`❌ %s %s` , err , cmd .UsageString ())
711- }
712706 secretName , _ := cmd .Flags ().GetString ("secret-name" )
713- accountName , _ := cmd . Flags (). GetString ( "account-name " )
714-
707+ targetBlobContainer := util . GetFlagStringOrPrompt ( cmd , "target-blob-container " )
708+ azureSTSClientID := ""
715709 if secretName != "" {
716710 util .VerifyCredsInSecret (secretName , options .Namespace , []string {"azure_tenant_id" , "azure_client_id" })
717711 secret .Name = secretName
718712 secret .Namespace = options .Namespace
713+ util .KubeCheck (secret )
714+ azureSTSClientID = secret .StringData ["azure_client_id" ]
719715 } else {
716+ azureSTSClientID = util .GetFlagStringOrPrompt (cmd , "client-id" )
717+ azureSTSTenantID := strings .TrimSpace (util .GetFlagStringOrPrompt (cmd , "tenant-id" ))
718+ accountName := util .GetFlagStringOrPrompt (cmd , "account-name" )
719+ if err := validations .ValidateAzureSTSRequiredFlags (targetBlobContainer , azureSTSClientID , azureSTSTenantID , accountName ); err != nil {
720+ log .Fatalf (`❌ %s %s` , err , cmd .UsageString ())
721+ }
720722 secret .StringData ["azure_tenant_id" ] = strings .TrimSpace (azureSTSTenantID )
721723 secret .StringData ["azure_client_id" ] = strings .TrimSpace (azureSTSClientID )
722724 if strings .TrimSpace (accountName ) != "" {
0 commit comments