Skip to content

Commit

Permalink
Merge pull request #183 from zzzeek/escape_underscores
Browse files Browse the repository at this point in the history
when generating metadata.name, use dashes instead of underscores
  • Loading branch information
openshift-merge-bot[bot] authored Jan 30, 2024
2 parents 331c633 + 4943f55 commit 5ad30f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/v1beta1/mariadbdatabase_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1beta1
import (
"context"
"fmt"
"strings"
"time"

"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
Expand Down Expand Up @@ -171,7 +172,7 @@ func (d *Database) CreateOrPatchDBByName(
if account == nil {
account = &MariaDBAccount{
ObjectMeta: metav1.ObjectMeta{
Name: d.databaseUser,
Name: strings.Replace(d.databaseUser, "_", "-", -1),
Namespace: d.namespace,
Labels: map[string]string{
"mariaDBDatabaseName": d.name,
Expand Down Expand Up @@ -366,7 +367,7 @@ func (d *Database) getDBWithName(
err = h.GetClient().Get(
ctx,
types.NamespacedName{
Name: username,
Name: strings.Replace(username, "_", "-", -1),
Namespace: namespace,
},
account)
Expand Down

0 comments on commit 5ad30f7

Please sign in to comment.