Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed AccessKeys printings on RPC calls #1357

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/cosi/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ func (r *APIRequest) DeleteBucket() error {

func fetchUserCredentials(accessKeys nb.S3AccessKeys) map[string]*cosi.CredentialDetails {
s3Keys := make(map[string]string)
s3Keys["accessKeyID"] = accessKeys.AccessKey
s3Keys["accessSecretKey"] = accessKeys.SecretKey
s3Keys["accessKeyID"] = string(accessKeys.AccessKey)
s3Keys["accessSecretKey"] = string(accessKeys.SecretKey)
creds := &cosi.CredentialDetails{
Secrets: s3Keys,
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/nb/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ type PoolHostsInfo struct {

// S3AccessKeys is a struct holding S3 access and secret keys
type S3AccessKeys struct {
AccessKey string `json:"access_key"`
SecretKey string `json:"secret_key"`
AccessKey MaskedString `json:"access_key"`
SecretKey MaskedString `json:"secret_key"`
}

// ReadAuthReply is the reply of auth_api.read_auth()
Expand Down
8 changes: 4 additions & 4 deletions pkg/noobaaaccount/noobaaaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,14 +653,14 @@ func GenerateAccountKeys(name string) error {
accessKeys = accountInfo.AccessKeys[0]

secret.StringData = map[string]string{}
secret.StringData["AWS_ACCESS_KEY_ID"] = accessKeys.AccessKey
secret.StringData["AWS_SECRET_ACCESS_KEY"] = accessKeys.SecretKey
secret.StringData["AWS_ACCESS_KEY_ID"] = string(accessKeys.AccessKey)
secret.StringData["AWS_SECRET_ACCESS_KEY"] = string(accessKeys.SecretKey)

// 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)
fmt.Printf("\nAWS_ACCESS_KEY_ID : %s\n", string(accessKeys.AccessKey))
fmt.Printf("AWS_SECRET_ACCESS_KEY : %s\n\n", string(accessKeys.SecretKey))
log.Fatalf(`❌ Failed to update the secret %s with the new accessKeys`, secret.Name)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/noobaaaccount/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ func (r *Reconciler) CreateNooBaaAccount() error {
accessKeys = accountInfo.AccessKeys[0]
}
r.Secret.StringData = map[string]string{}
r.Secret.StringData["AWS_ACCESS_KEY_ID"] = accessKeys.AccessKey
r.Secret.StringData["AWS_SECRET_ACCESS_KEY"] = accessKeys.SecretKey
r.Secret.StringData["AWS_ACCESS_KEY_ID"] = string(accessKeys.AccessKey)
r.Secret.StringData["AWS_SECRET_ACCESS_KEY"] = string(accessKeys.SecretKey)
r.Own(r.Secret)
err = r.Client.Create(r.Ctx, r.Secret)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions pkg/obc/obc.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,14 @@ func GenerateAccountKeys(name, accountName, appNamespace string) error {
accessKeys = accountInfo.AccessKeys[0]

secret.StringData = map[string]string{}
secret.StringData["AWS_ACCESS_KEY_ID"] = accessKeys.AccessKey
secret.StringData["AWS_SECRET_ACCESS_KEY"] = accessKeys.SecretKey
secret.StringData["AWS_ACCESS_KEY_ID"] = string(accessKeys.AccessKey)
secret.StringData["AWS_SECRET_ACCESS_KEY"] = string(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 OBC %s:`, name)
fmt.Printf("\nAWS_ACCESS_KEY_ID : %s\n", accessKeys.AccessKey)
fmt.Printf("AWS_SECRET_ACCESS_KEY : %s\n\n", accessKeys.SecretKey)
fmt.Printf("\nAWS_ACCESS_KEY_ID : %s\n", string(accessKeys.AccessKey))
fmt.Printf("AWS_SECRET_ACCESS_KEY : %s\n\n", string(accessKeys.SecretKey))
log.Fatalf(`❌ Failed to update the secret %s with the new accessKeys`, secret.Name)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/obc/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,8 @@ func (r *BucketRequest) CreateAccount() error {

r.OB.Spec.Authentication = &nbv1.ObjectBucketAuthentication{
AccessKeys: &nbv1.ObjectBucketAccessKeys{
AccessKeyID: accessKeys.AccessKey,
SecretAccessKey: accessKeys.SecretKey,
AccessKeyID: string(accessKeys.AccessKey),
SecretAccessKey: string(accessKeys.SecretKey),
},
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/system/phase4_configuring.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ func (r *Reconciler) SetDesiredSecretAdminAccountInfo() error {
return fmt.Errorf("admin account has no access keys yet")
}

r.SecretAdmin.StringData["AWS_ACCESS_KEY_ID"] = account.AccessKeys[0].AccessKey
r.SecretAdmin.StringData["AWS_SECRET_ACCESS_KEY"] = account.AccessKeys[0].SecretKey
r.SecretAdmin.StringData["AWS_ACCESS_KEY_ID"] = string(account.AccessKeys[0].AccessKey)
r.SecretAdmin.StringData["AWS_SECRET_ACCESS_KEY"] = string(account.AccessKeys[0].SecretKey)
return nil
}

Expand Down
Loading