Skip to content

Commit

Permalink
ROSA: Generate unique username for BreakGlassCredential requests
Browse files Browse the repository at this point in the history
  • Loading branch information
muraee committed May 29, 2024
1 parent b2fae56 commit f78557c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion controlplane/rosa/controllers/rosacontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
kerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apiserver/pkg/storage/names"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/clientcmd/api"
Expand Down Expand Up @@ -609,7 +610,7 @@ func (r *ROSAControlPlaneReconciler) reconcileExternalAuthBootstrapKubeconfig(ct

// kubeconfig doesn't exist, generate a new one.
breakGlassConfig, err := cmv1.NewBreakGlassCredential().
Username("capi-admin").
Username(names.SimpleNameGenerator.GenerateName("capi-admin-")). // OCM requires unique usernames
ExpirationTimestamp(time.Now().Add(time.Hour * 24)).
Build()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ require (
k8s.io/api v0.29.3
k8s.io/apiextensions-apiserver v0.29.3
k8s.io/apimachinery v0.29.3
k8s.io/apiserver v0.29.3
k8s.io/cli-runtime v0.29.3
k8s.io/client-go v0.29.3
k8s.io/component-base v0.29.3
Expand Down Expand Up @@ -217,7 +218,6 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiserver v0.29.3 // indirect
k8s.io/cluster-bootstrap v0.29.3 // indirect
k8s.io/component-helpers v0.29.3 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
Expand Down

0 comments on commit f78557c

Please sign in to comment.