Skip to content

Commit

Permalink
Add auth secret name func
Browse files Browse the repository at this point in the history
Signed-off-by: Neaj Morshad <[email protected]>
  • Loading branch information
Neaj-Morshad-101 committed Feb 8, 2024
1 parent b51d59e commit b6e67a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mssql/kubedb_client_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ func (o *KubeDBClientBuilder) getMsSQLSACredentials() (string, string, error) {
}
user, ok := secret.Data[core.BasicAuthUsernameKey]
if !ok {
return "", "", fmt.Errorf("DB sa user is not found in secret")
return "", "", fmt.Errorf("DB SA user is not found in secret")
}
pass, ok := secret.Data[core.BasicAuthPasswordKey]
if !ok {
return "", "", fmt.Errorf("DB SA password is not set in secret")
return "", "", fmt.Errorf("DB password is not set in secret")
}
return string(user), string(pass), nil
}
Expand Down
7 changes: 7 additions & 0 deletions vendor/kubedb.dev/mssql/api/v1alpha2/mssql_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,10 @@ func (m MsSQL) SetHealthCheckerDefaults() {
m.Spec.HealthChecker.FailureThreshold = pointer.Int32P(1)
}
}

func (m MsSQL) GetAuthSecretName() string {
if m.Spec.AuthSecret != nil && m.Spec.AuthSecret.Name != "" {
return m.Spec.AuthSecret.Name
}
return m.DefaultUserCredSecretName(MsSQLSAUser)
}

0 comments on commit b6e67a1

Please sign in to comment.