Skip to content

Commit

Permalink
rename bootstrap sa name
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiwei Yin <[email protected]>
  • Loading branch information
zhiweiyin318 committed Jan 16, 2025
1 parent 4081bde commit 2660b2e
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
open-cluster-management.io/api v0.15.1-0.20250109024121-1a5e25a78a43
open-cluster-management.io/cluster-proxy v0.4.0
open-cluster-management.io/managed-serviceaccount v0.6.0
open-cluster-management.io/ocm v0.15.1-0.20250110031959-11896ccda197
open-cluster-management.io/ocm v0.15.1-0.20250116024415-19fb9243ca2b
open-cluster-management.io/sdk-go v0.15.1-0.20241125015855-1536c3970f8f
sigs.k8s.io/apiserver-network-proxy v0.29.0
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ open-cluster-management.io/cluster-proxy v0.4.0 h1:rm0UDaDWe3/P3xLzwqdHtqNksKwSz
open-cluster-management.io/cluster-proxy v0.4.0/go.mod h1:gTvfDHAhGezhdg4BD3ECBn6jbg2Y5PbHhV2ceW5nrB0=
open-cluster-management.io/managed-serviceaccount v0.6.0 h1:qIi5T9WQJBuoGqnYGIktXbtqfQoiN2H9XU2P/6lAQiw=
open-cluster-management.io/managed-serviceaccount v0.6.0/go.mod h1:G4LUTbZiyrB8c0+rqi/xnDmGlsg7Rdr4T7MPLCWhyQI=
open-cluster-management.io/ocm v0.15.1-0.20250110031959-11896ccda197 h1:ECwQuYbtUxDbKUKHfnmQYwLG2cV3i7OwsU4dJP/XrDg=
open-cluster-management.io/ocm v0.15.1-0.20250110031959-11896ccda197/go.mod h1:daPkqFxkVqKb4O8UTX+7jCyEcJWarGOG7uDie9rFfck=
open-cluster-management.io/ocm v0.15.1-0.20250116024415-19fb9243ca2b h1:zA4fOnKpgsjImN/Qc1JcwyumwYALmS7EUl9KT0lRUwk=
open-cluster-management.io/ocm v0.15.1-0.20250116024415-19fb9243ca2b/go.mod h1:daPkqFxkVqKb4O8UTX+7jCyEcJWarGOG7uDie9rFfck=
open-cluster-management.io/sdk-go v0.15.1-0.20241125015855-1536c3970f8f h1:zeC7QrFNarfK2zY6jGtd+mX+yDrQQmnH/J8A7n5Nh38=
open-cluster-management.io/sdk-go v0.15.1-0.20241125015855-1536c3970f8f/go.mod h1:fi5WBsbC5K3txKb8eRLuP0Sim/Oqz/PHX18skAEyjiA=
oras.land/oras-go v1.2.5 h1:XpYuAwAb0DfQsunIyMfeET92emK8km3W4yEzZvUbsTo=
Expand Down
16 changes: 8 additions & 8 deletions pkg/cmd/accept/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
const (
groupNameBootstrap = "system:bootstrappers:managedcluster"
userNameSignatureBootstrapPrefix = "system:bootstrap:"
userNameSignatureSA = "system:serviceaccount:open-cluster-management:cluster-bootstrap"
userNameSignatureSA = "system:serviceaccount:open-cluster-management:agent-registration-bootstrap"
groupNameSA = "system:serviceaccounts:open-cluster-management"
clusterLabel = "open-cluster-management.io/cluster-name"
)
Expand Down Expand Up @@ -124,12 +124,12 @@ func (o *Options) approveCSR(kubeClient *kubernetes.Clientset, clusterName strin
passedCSRs = csrs.Items
} else {
for _, item := range csrs.Items {
//Does not have the correct name prefix
// Does not have the correct name prefix
if !strings.HasPrefix(item.Spec.Username, userNameSignatureBootstrapPrefix) &&
!strings.HasPrefix(item.Spec.Username, userNameSignatureSA) {
continue
}
//Check groups
// Check groups
groups := sets.NewString(item.Spec.Groups...)
if !groups.Has(groupNameBootstrap) &&
!groups.Has(groupNameSA) {
Expand Down Expand Up @@ -173,14 +173,14 @@ func (o *Options) approveCSR(kubeClient *kubernetes.Clientset, clusterName strin
fmt.Fprintf(o.Streams.Out, "CSR %s with requester %s is not in the approve list\n", passedCSR.Name, cn)
continue
}
//Check if already approved or denied
// Check if already approved or denied
approved, denied := GetCertApprovalCondition(&passedCSR.Status)
//if already denied, then nothing to do
// if already denied, then nothing to do
if denied {
fmt.Fprintf(o.Streams.Out, "CSR %s already denied\n", passedCSR.Name)
continue
}
//if already approved, then nothing to do
// if already approved, then nothing to do
if approved {
fmt.Fprintf(o.Streams.Out, "CSR %s already approved\n", passedCSR.Name)
hasApproved = true
Expand All @@ -189,15 +189,15 @@ func (o *Options) approveCSR(kubeClient *kubernetes.Clientset, clusterName strin
csrToApprove = append(csrToApprove, passedCSR)
}

//no csr found
// no csr found
if len(csrToApprove) == 0 {
if waitMode {
fmt.Fprintf(o.Streams.Out, "no CSR to approve for cluster %s\n", clusterName)
}

return hasApproved, nil
}
//if dry-run don't approve
// if dry-run don't approve
if o.ClusteradmFlags.DryRun {
return hasApproved, nil
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/config/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ package config

const (
OpenClusterManagementNamespace = "open-cluster-management"
BootstrapSAName = "cluster-bootstrap"
BootstrapClusterRoleBindingName = "cluster-bootstrap"
BootstrapClusterRoleBindingSAName = "cluster-bootstrap-sa"
BootstrapClusterRoleName = "system:open-cluster-management:bootstrap"
BootstrapSAName = "agent-registration-bootstrap"
BootstrapClusterRoleBindingName = "open-cluster-management:bootstrap:agent-registration"
BootstrapClusterRoleBindingSAName = "agent-registration-bootstrap"
BootstrapClusterRoleName = "open-cluster-management:bootstrap"
ClusterManagerName = "cluster-manager"
LabelApp = "app"
BootstrapSecretPrefix = "bootstrap-token-"
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ open-cluster-management.io/managed-serviceaccount/pkg/generated/clientset/versio
open-cluster-management.io/managed-serviceaccount/pkg/generated/clientset/versioned/scheme
open-cluster-management.io/managed-serviceaccount/pkg/generated/clientset/versioned/typed/authentication/v1alpha1
open-cluster-management.io/managed-serviceaccount/pkg/generated/clientset/versioned/typed/authentication/v1beta1
# open-cluster-management.io/ocm v0.15.1-0.20250110031959-11896ccda197
# open-cluster-management.io/ocm v0.15.1-0.20250116024415-19fb9243ca2b
## explicit; go 1.22.5
open-cluster-management.io/ocm/deploy/cluster-manager/chart
open-cluster-management.io/ocm/deploy/klusterlet/chart
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2660b2e

Please sign in to comment.