diff --git a/models/service_account_creds.go b/models/service_account_creds.go index 43671f7d8..4fec2ea55 100644 --- a/models/service_account_creds.go +++ b/models/service_account_creds.go @@ -39,6 +39,9 @@ type ServiceAccountCreds struct { // secret key SecretKey string `json:"secretKey,omitempty"` + + // url + URL string `json:"url,omitempty"` } // Validate validates this service account creds diff --git a/models/tenant_response_item.go b/models/tenant_response_item.go index 67dacee48..933b6aba0 100644 --- a/models/tenant_response_item.go +++ b/models/tenant_response_item.go @@ -39,6 +39,9 @@ type TenantResponseItem struct { // secret key SecretKey string `json:"secret_key,omitempty"` + + // url + URL string `json:"url,omitempty"` } // Validate validates this tenant response item diff --git a/operatorapi/embedded_spec.go b/operatorapi/embedded_spec.go index ed506b61a..9ceaf8d98 100644 --- a/operatorapi/embedded_spec.go +++ b/operatorapi/embedded_spec.go @@ -3478,6 +3478,9 @@ func init() { }, "secret_key": { "type": "string" + }, + "url": { + "type": "string" } } }, @@ -7741,6 +7744,9 @@ func init() { }, "secret_key": { "type": "string" + }, + "url": { + "type": "string" } } }, diff --git a/operatorapi/operator_tenants.go b/operatorapi/operator_tenants.go index 99fb7d3d3..aaf21da3c 100644 --- a/operatorapi/operator_tenants.go +++ b/operatorapi/operator_tenants.go @@ -1453,11 +1453,18 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre response = &models.CreateTenantResponse{ ExternalIDP: tenantExternalIDPConfigured, } + thisClient := &operatorClient{ + client: opClient, + } + + minTenant, err := getTenant(ctx, thisClient, ns, tenantName) + if tenantReq.Idp != nil && !tenantExternalIDPConfigured { for _, credential := range tenantReq.Idp.Keys { response.Console = append(response.Console, &models.TenantResponseItem{ AccessKey: *credential.AccessKey, SecretKey: *credential.SecretKey, + URL: GetTenantServiceURL(minTenant), }) } } diff --git a/portal-ui/src/screens/Console/Account/Account.tsx b/portal-ui/src/screens/Console/Account/Account.tsx index 4df922584..0a8aa4282 100644 --- a/portal-ui/src/screens/Console/Account/Account.tsx +++ b/portal-ui/src/screens/Console/Account/Account.tsx @@ -135,6 +135,7 @@ const Account = ({ classes, displayErrorMessage }: IServiceAccountsProps) => { console: { accessKey: `${res.accessKey}`, secretKey: `${res.secretKey}`, + url: `${res.url}`, }, }; setNewServiceAccount(nsa); diff --git a/portal-ui/src/screens/Console/Common/CredentialsPrompt/CredentialsPrompt.tsx b/portal-ui/src/screens/Console/Common/CredentialsPrompt/CredentialsPrompt.tsx index 7809a6b91..4bf09bfa7 100644 --- a/portal-ui/src/screens/Console/Common/CredentialsPrompt/CredentialsPrompt.tsx +++ b/portal-ui/src/screens/Console/Common/CredentialsPrompt/CredentialsPrompt.tsx @@ -90,7 +90,6 @@ const download = (filename: string, text: string) => { document.body.appendChild(element); element.click(); - document.body.removeChild(element); }; @@ -104,7 +103,6 @@ const CredentialsPrompt = ({ if (!newServiceAccount) { return null; } - const consoleCreds = get(newServiceAccount, "console", null); const idp = get(newServiceAccount, "idp", false); @@ -196,16 +194,22 @@ const CredentialsPrompt = ({ consoleExtras = { console: [ { + url : consoleCreds.url, access_key: consoleCreds.accessKey, secret_key: consoleCreds.secretKey, + api: "s3v4", + path: "auto", }, ], }; } else { const cCreds = consoleCreds.map((itemMap) => { return { + url: itemMap.url, access_key: itemMap.accessKey, secret_key: itemMap.secretKey, + api: "s3v4", + path: "auto", }; }); diff --git a/portal-ui/src/screens/Console/Common/CredentialsPrompt/types.ts b/portal-ui/src/screens/Console/Common/CredentialsPrompt/types.ts index bcef0befb..c85a050be 100644 --- a/portal-ui/src/screens/Console/Common/CredentialsPrompt/types.ts +++ b/portal-ui/src/screens/Console/Common/CredentialsPrompt/types.ts @@ -19,9 +19,11 @@ export interface NewServiceAccount { console?: ConsoleSA | ConsoleSA[]; accessKey?: string; secretKey?: string; + url?: string; } export interface ConsoleSA { accessKey: string; secretKey: string; + url: string; } diff --git a/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx b/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx index 85ebd69c1..f77f7ebbc 100644 --- a/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx +++ b/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx @@ -652,6 +652,9 @@ const AddTenant = ({ return { accessKey: consoleKey.access_key, secretKey: consoleKey.secret_key, + api: "s3v4", + path: "auto", + url: consoleKey.url, }; }); @@ -661,6 +664,7 @@ const AddTenant = ({ console: { accessKey: res.console.access_key, secretKey: res.console.secret_key, + url: res.console.url, }, }; } diff --git a/portal-ui/src/screens/Console/Users/UserServiceAccountsPanel.tsx b/portal-ui/src/screens/Console/Users/UserServiceAccountsPanel.tsx index 77195e6b4..501b12f42 100644 --- a/portal-ui/src/screens/Console/Users/UserServiceAccountsPanel.tsx +++ b/portal-ui/src/screens/Console/Users/UserServiceAccountsPanel.tsx @@ -108,10 +108,11 @@ const UserServiceAccountsPanel = ({ fetchRecords(); if (res !== null) { - const nsa: NewServiceAccount = { + const nsa: NewServiceAccount = { console: { accessKey: `${res.accessKey}`, secretKey: `${res.secretKey}`, + url : `${res.url}`, }, }; setNewServiceAccount(nsa); diff --git a/restapi/embedded_spec.go b/restapi/embedded_spec.go index 104ee6c39..aca930b4c 100644 --- a/restapi/embedded_spec.go +++ b/restapi/embedded_spec.go @@ -5741,6 +5741,9 @@ func init() { }, "secretKey": { "type": "string" + }, + "url": { + "type": "string" } } }, @@ -11582,6 +11585,9 @@ func init() { }, "secretKey": { "type": "string" + }, + "url": { + "type": "string" } } }, diff --git a/restapi/user_service_accounts.go b/restapi/user_service_accounts.go index e83517fb9..326c2701a 100644 --- a/restapi/user_service_accounts.go +++ b/restapi/user_service_accounts.go @@ -134,7 +134,7 @@ func createServiceAccount(ctx context.Context, userClient MinioAdmin, policy str if err != nil { return nil, err } - return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey}, nil + return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil } // createServiceAccount adds a service account with the given credentials to the userClient and assigns a policy to him if defined. @@ -196,7 +196,7 @@ func createAUserServiceAccount(ctx context.Context, userClient MinioAdmin, polic if err != nil { return nil, err } - return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey}, nil + return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil } func createAUserServiceAccountCreds(ctx context.Context, userClient MinioAdmin, policy string, user string, accessKey string, secretKey string) (*models.ServiceAccountCreds, error) { diff --git a/swagger-console.yml b/swagger-console.yml index 97746bc8d..48b9145bd 100644 --- a/swagger-console.yml +++ b/swagger-console.yml @@ -3745,6 +3745,8 @@ definitions: type: string secretKey: type: string + url: + type: string remoteBucket: type: object required: diff --git a/swagger-operator.yml b/swagger-operator.yml index c9edade25..2ffc4b501 100644 --- a/swagger-operator.yml +++ b/swagger-operator.yml @@ -1868,7 +1868,9 @@ definitions: type: string secret_key: type: string - + url: + type: string + tenantPod: type: object required: