Skip to content

Commit

Permalink
Fix existing bootstrapPassword secret read
Browse files Browse the repository at this point in the history
StringData field is used only on Create. On Read StringData is always nil.

This commit fixes evaluating exiting secret by evaluating len of Data and
considers secret is set if at least 1 character present

Signed-off-by: Dinar Valeev <[email protected]>
  • Loading branch information
k0da committed Oct 16, 2024
1 parent 0cddb5f commit 3af52ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/data/management/bootstrap_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func GetBootstrapPassword(ctx context.Context, secrets corev1.SecretInterface) (
}

// if the bootstrap password is set return it
if s.StringData[bootstrapPasswordSecretKey] != "" {
if len(s.Data[bootstrapPasswordSecretKey]) > 0 {
return s.StringData[bootstrapPasswordSecretKey], generated, nil
}

Expand Down

0 comments on commit 3af52ff

Please sign in to comment.