Skip to content

Commit ade3961

Browse files
committed
Standardize variable/function naming to use "Authorization"
1 parent 5b9fd7a commit ade3961

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

cmd/operator-controller/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,16 @@ func run() error {
409409
crdupgradesafety.NewPreflight(aeClient.CustomResourceDefinitions()),
410410
}
411411

412-
acm := applier.NewAuthClientMapper(clientRestConfigMapper, mgr.GetConfig())
412+
acm := applier.NewAuthorizationClientMapper(clientRestConfigMapper, mgr.GetConfig())
413413
acm.NewForConfig = func(cfg *rest.Config) (authorizationv1client.AuthorizationV1Interface, error) {
414414
// *AuthorizationV1Client implements AuthorizationV1Interface
415415
return authorizationv1client.NewForConfig(cfg)
416416
}
417417

418418
helmApplier := &applier.Helm{
419-
ActionClientGetter: acg,
420-
Preflights: preflights,
421-
AuthClientMapper: acm,
419+
ActionClientGetter: acg,
420+
Preflights: preflights,
421+
AuthorizationClientMapper: acm,
422422
}
423423

424424
cm := contentmanager.NewManager(clientRestConfigMapper, mgr.GetConfig(), mgr.GetRESTMapper())

internal/operator-controller/applier/helm.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ type RestConfigMapper func(context.Context, client.Object, *rest.Config) (*rest.
6060

6161
type NewForConfigFunc func(*rest.Config) (authorizationv1client.AuthorizationV1Interface, error)
6262

63-
type AuthClientMapper struct {
63+
type AuthorizationClientMapper struct {
6464
rcm RestConfigMapper
6565
baseCfg *rest.Config
6666
NewForConfig NewForConfigFunc
6767
}
6868

69-
func (acm *AuthClientMapper) GetAuthenticationClient(ctx context.Context, ext *ocv1.ClusterExtension) (authorizationv1client.AuthorizationV1Interface, error) {
69+
func (acm *AuthorizationClientMapper) GetAuthorizationClient(ctx context.Context, ext *ocv1.ClusterExtension) (authorizationv1client.AuthorizationV1Interface, error) {
7070
authcfg, err := acm.rcm(ctx, ext, acm.baseCfg)
7171
if err != nil {
7272
return nil, err
@@ -76,13 +76,13 @@ func (acm *AuthClientMapper) GetAuthenticationClient(ctx context.Context, ext *o
7676
}
7777

7878
type Helm struct {
79-
ActionClientGetter helmclient.ActionClientGetter
80-
Preflights []Preflight
81-
AuthClientMapper AuthClientMapper
79+
ActionClientGetter helmclient.ActionClientGetter
80+
Preflights []Preflight
81+
AuthorizationClientMapper AuthorizationClientMapper
8282
}
8383

84-
func NewAuthClientMapper(rcm RestConfigMapper, baseCfg *rest.Config) AuthClientMapper {
85-
return AuthClientMapper{
84+
func NewAuthorizationClientMapper(rcm RestConfigMapper, baseCfg *rest.Config) AuthorizationClientMapper {
85+
return AuthorizationClientMapper{
8686
rcm: rcm,
8787
baseCfg: baseCfg,
8888
}
@@ -110,7 +110,7 @@ func shouldSkipPreflight(ctx context.Context, preflight Preflight, ext *ocv1.Clu
110110

111111
func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1.ClusterExtension, objectLabels map[string]string, storageLabels map[string]string) ([]client.Object, string, error) {
112112
if features.OperatorControllerFeatureGate.Enabled(features.PreflightPermissions) {
113-
authclient, err := h.AuthClientMapper.GetAuthenticationClient(ctx, ext)
113+
authclient, err := h.AuthorizationClientMapper.GetAuthorizationClient(ctx, ext)
114114
if err != nil {
115115
return nil, "", err
116116
}

internal/operator-controller/applier/helm_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ func newPassingSSRRAuthClient() authorizationv1client.AuthorizationV1Interface {
115115
}
116116
}
117117

118-
// Helper builds an AuthClientMapper with the passing SSRR
119-
func newPassingAuthClientMapper() applier.AuthClientMapper {
118+
// Helper builds an AuthorizationClientMapper with the passing SSRR
119+
func newPassingAuthorizationClientMapper() applier.AuthorizationClientMapper {
120120
fakeRestConfig := &rest.Config{Host: "fake-server"}
121121
mockRCM := func(ctx context.Context, obj client.Object, cfg *rest.Config) (*rest.Config, error) {
122122
return cfg, nil
123123
}
124-
acm := applier.NewAuthClientMapper(mockRCM, fakeRestConfig)
124+
acm := applier.NewAuthorizationClientMapper(mockRCM, fakeRestConfig)
125125
acm.NewForConfig = func(*rest.Config) (authorizationv1client.AuthorizationV1Interface, error) {
126126
return newPassingSSRRAuthClient(), nil
127127
}
@@ -131,9 +131,9 @@ func newPassingAuthClientMapper() applier.AuthClientMapper {
131131
// Helper builds a Helm applier with passing SSRR
132132
func buildHelmApplier(mockAcg *mockActionGetter, preflights []applier.Preflight) applier.Helm {
133133
return applier.Helm{
134-
ActionClientGetter: mockAcg,
135-
AuthClientMapper: newPassingAuthClientMapper(),
136-
Preflights: preflights,
134+
ActionClientGetter: mockAcg,
135+
AuthorizationClientMapper: newPassingAuthorizationClientMapper(),
136+
Preflights: preflights,
137137
}
138138
}
139139

0 commit comments

Comments
 (0)