Skip to content

Commit

Permalink
Merge pull request #1230 from shirady/bz-obc
Browse files Browse the repository at this point in the history
Bug Fix BZ 2242414 | Add Flag `app-namespace` To Command `obc regenerate`
  • Loading branch information
shirady authored Oct 19, 2023
2 parents 3186eed + 1338f0c commit f850b67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/noobaaaccount/noobaaaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,15 +649,15 @@ func GenerateAccountKeys(name string) error {
secret.StringData["AWS_ACCESS_KEY_ID"] = accessKeys.AccessKey
secret.StringData["AWS_SECRET_ACCESS_KEY"] = accessKeys.SecretKey

//If we will not be able to update the secret we will print the credentials as they allready been changed by the RPC
// If we will not be able to update the secret we will print the credentials as they already been changed by the RPC
if !util.KubeUpdate(secret) {
log.Printf(`❌ Please write the new credentials for account %s:`, name)
fmt.Printf("\nAWS_ACCESS_KEY_ID : %s\n", accessKeys.AccessKey)
fmt.Printf("AWS_SECRET_ACCESS_KEY : %s\n\n", accessKeys.SecretKey)
log.Fatalf(`❌ Failed to update the secret %s with the new accessKeys`, secret.Name)
}

log.Printf("✅ Successfully reganerate s3 credentials for the account %q", name)
log.Printf("✅ Successfully regenerate s3 credentials for the account %q", name)
return nil
}

Expand Down
10 changes: 6 additions & 4 deletions pkg/obc/obc.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func CmdRegenerate() *cobra.Command {
Short: "Regenerate OBC S3 Credentials",
Run: RunRegenerate,
}
cmd.Flags().String("app-namespace", "",
"Set the namespace of the application where the OBC should be regenerated")
return cmd
}

Expand All @@ -80,7 +82,7 @@ func CmdDelete() *cobra.Command {
Run: RunDelete,
}
cmd.Flags().String("app-namespace", "",
"Set the namespace of the application where the OBC should be created")
"Set the namespace of the application where the OBC should be deleted")
return cmd
}

Expand Down Expand Up @@ -250,7 +252,7 @@ func RunRegenerate(cmd *cobra.Command, args []string) {
if obc.Spec.ObjectBucketName != "" {
ob.Name = obc.Spec.ObjectBucketName
} else {
ob.Name = fmt.Sprintf("obc-%s-%s", appNamespace, name)
ob.Name = fmt.Sprintf("ob-%s-%s", appNamespace, name)
}

if !util.KubeCheck(ob) {
Expand Down Expand Up @@ -478,7 +480,7 @@ func WaitReady(obc *nbv1.ObjectBucketClaim) bool {

interval := time.Duration(3)

err := wait.PollUntilContextCancel(ctx,interval*time.Second, true, func(ctx context.Context) (bool, error) {
err := wait.PollUntilContextCancel(ctx, interval*time.Second, true, func(ctx context.Context) (bool, error) {
err := klient.Get(util.Context(), util.ObjectKey(obc), obc)
if err != nil {
log.Printf("⏳ Failed to get OBC: %s", err)
Expand Down Expand Up @@ -567,6 +569,6 @@ func GenerateAccountKeys(name string, accountName string) error {
log.Fatalf(`❌ Failed to update the secret %s with the new accessKeys`, secret.Name)
}

log.Printf("✅ Successfully reganerate s3 credentials for the OBC %q", name)
log.Printf("✅ Successfully regenerate s3 credentials for the OBC %q", name)
return nil
}

0 comments on commit f850b67

Please sign in to comment.