Skip to content

Commit 3de0d9a

Browse files
committed
pkg/kubeapiserver: pass authorizer in top level while building from legacy options
Signed-off-by: Nabarun Pal <[email protected]>
1 parent 11ce6d2 commit 3de0d9a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/kubeapiserver/options/authorization.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ func (o *BuiltInAuthorizationOptions) buildAuthorizationConfiguration() (*authzc
167167
case authzmodes.ModeWebhook:
168168
authorizers = append(authorizers, authzconfig.AuthorizerConfiguration{
169169
Type: authzconfig.TypeWebhook,
170+
Name: defaultWebhookName,
170171
Webhook: &authzconfig.WebhookConfiguration{
171-
Name: defaultWebhookName,
172172
AuthorizedTTL: metav1.Duration{Duration: o.WebhookCacheAuthorizedTTL},
173173
UnauthorizedTTL: metav1.Duration{Duration: o.WebhookCacheUnauthorizedTTL},
174174
// Timeout and FailurePolicy are required for the new configuration.
@@ -183,9 +183,18 @@ func (o *BuiltInAuthorizationOptions) buildAuthorizationConfiguration() (*authzc
183183
},
184184
})
185185
default:
186-
authorizers = append(authorizers, authzconfig.AuthorizerConfiguration{Type: authzconfig.AuthorizerType(mode)})
186+
authorizers = append(authorizers, authzconfig.AuthorizerConfiguration{
187+
Type: authzconfig.AuthorizerType(mode),
188+
Name: getNameForAuthorizerMode(mode),
189+
})
187190
}
188191
}
189192

190193
return &authzconfig.AuthorizationConfiguration{Authorizers: authorizers}, nil
191194
}
195+
196+
// getNameForAuthorizerMode returns the name to be set for the mode in AuthorizationConfiguration
197+
// For now, lower cases the mode name
198+
func getNameForAuthorizerMode(mode string) string {
199+
return strings.ToLower(mode)
200+
}

0 commit comments

Comments
 (0)