Skip to content

Commit

Permalink
fix: Fixes helm
Browse files Browse the repository at this point in the history
  • Loading branch information
salehkhazaei committed Jul 30, 2024
1 parent 983fe44 commit d05afb1
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions pkg/workspace/internal/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,26 @@ func GetUpToDateWorkspaceHelmValues(ctx context.Context, cfg config.Config, kube
return false, nil, err
}

result, err := vault.Decrypt(ctx, masterCred.Credential)
if err != nil {
return false, nil, fmt.Errorf("failed to encrypt ciphertext: %v", err)
}
jsonResult, err := json.Marshal(result)
if err != nil {
return false, nil, err
}
var accessKey types2.AccessKey
err = json.Unmarshal(jsonResult, &accessKey)
if err != nil {
return false, nil, err
}
if masterCred != nil {
result, err := vault.Decrypt(ctx, masterCred.Credential)
if err != nil {
return false, nil, fmt.Errorf("failed to encrypt ciphertext: %v", err)
}
jsonResult, err := json.Marshal(result)
if err != nil {
return false, nil, err
}
var accessKey types2.AccessKey
err = json.Unmarshal(jsonResult, &accessKey)
if err != nil {
return false, nil, err
}

if settings.Kaytu.Workspace.MasterAccessKey != *accessKey.AccessKeyId {
settings.Kaytu.Workspace.MasterAccessKey = *accessKey.AccessKeyId
settings.Kaytu.Workspace.MasterSecretKey = *accessKey.SecretAccessKey
needsUpdate = true
if settings.Kaytu.Workspace.MasterAccessKey != *accessKey.AccessKeyId {
settings.Kaytu.Workspace.MasterAccessKey = *accessKey.AccessKeyId
settings.Kaytu.Workspace.MasterSecretKey = *accessKey.SecretAccessKey
needsUpdate = true
}
}
}

Expand Down

0 comments on commit d05afb1

Please sign in to comment.