mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-19 07:25:19 +00:00
pkg/kubeapiserver: use utils/ptr package instead of utils/pointer
The new k8s.io/utils/ptr package provides generic wrapper functions,
which can be used instead of type-specific pointer wrapper functions.
This replaces the latter with the former, and migrates other uses of
the deprecated pointer package to ptr in affacted files.
See kubernetes/utils#283 for details.
Signed-off-by: Lan <gcslyp@gmail.com>
This commit is contained in:
@@ -61,7 +61,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/serviceaccount"
|
||||
"k8s.io/kubernetes/pkg/util/filesystem"
|
||||
"k8s.io/kubernetes/plugin/pkg/auth/authenticator/token/bootstrap"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -524,7 +524,7 @@ func (o *BuiltInAuthenticationOptions) ToAuthenticationConfig() (kubeauthenticat
|
||||
},
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Prefix: pointer.String(usernamePrefix),
|
||||
Prefix: ptr.To(usernamePrefix),
|
||||
Claim: o.OIDC.UsernameClaim,
|
||||
},
|
||||
},
|
||||
@@ -532,7 +532,7 @@ func (o *BuiltInAuthenticationOptions) ToAuthenticationConfig() (kubeauthenticat
|
||||
|
||||
if len(o.OIDC.GroupsClaim) > 0 {
|
||||
jwtAuthenticator.ClaimMappings.Groups = apiserver.PrefixedClaimOrExpression{
|
||||
Prefix: pointer.String(o.OIDC.GroupsPrefix),
|
||||
Prefix: ptr.To(o.OIDC.GroupsPrefix),
|
||||
Claim: o.OIDC.GroupsClaim,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ import (
|
||||
openapicommon "k8s.io/kube-openapi/pkg/common"
|
||||
kubeauthenticator "k8s.io/kubernetes/pkg/kubeapiserver/authenticator"
|
||||
"k8s.io/kubernetes/pkg/serviceaccount"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func TestAuthenticationValidate(t *testing.T) {
|
||||
@@ -345,7 +345,7 @@ func TestToAuthenticationConfig(t *testing.T) {
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String("https://testIssuerURL#"),
|
||||
Prefix: ptr.To("https://testIssuerURL#"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -731,7 +731,7 @@ jwt:
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String(""),
|
||||
Prefix: ptr.To(""),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -822,7 +822,7 @@ func TestToAuthenticationConfig_OIDC(t *testing.T) {
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String(""),
|
||||
Prefix: ptr.To(""),
|
||||
},
|
||||
},
|
||||
ClaimValidationRules: []apiserver.ClaimValidationRule{
|
||||
@@ -858,7 +858,7 @@ func TestToAuthenticationConfig_OIDC(t *testing.T) {
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String("https://testIssuerURL#"),
|
||||
Prefix: ptr.To("https://testIssuerURL#"),
|
||||
},
|
||||
},
|
||||
ClaimValidationRules: []apiserver.ClaimValidationRule{
|
||||
@@ -894,7 +894,7 @@ func TestToAuthenticationConfig_OIDC(t *testing.T) {
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "email",
|
||||
Prefix: pointer.String(""),
|
||||
Prefix: ptr.To(""),
|
||||
},
|
||||
},
|
||||
ClaimValidationRules: []apiserver.ClaimValidationRule{
|
||||
@@ -931,7 +931,7 @@ func TestToAuthenticationConfig_OIDC(t *testing.T) {
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String("k8s-"),
|
||||
Prefix: ptr.To("k8s-"),
|
||||
},
|
||||
},
|
||||
ClaimValidationRules: []apiserver.ClaimValidationRule{
|
||||
@@ -970,11 +970,11 @@ func TestToAuthenticationConfig_OIDC(t *testing.T) {
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String(""),
|
||||
Prefix: ptr.To(""),
|
||||
},
|
||||
Groups: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "groups",
|
||||
Prefix: pointer.String("oidc:"),
|
||||
Prefix: ptr.To("oidc:"),
|
||||
},
|
||||
},
|
||||
ClaimValidationRules: []apiserver.ClaimValidationRule{
|
||||
@@ -1017,7 +1017,7 @@ jwt:
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String(""),
|
||||
Prefix: ptr.To(""),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1370,7 +1370,7 @@ jwt:
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String(""),
|
||||
Prefix: ptr.To(""),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1446,7 +1446,7 @@ jwt:
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String(""),
|
||||
Prefix: ptr.To(""),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1522,7 +1522,7 @@ jwt:
|
||||
ClaimMappings: apiserver.ClaimMappings{
|
||||
Username: apiserver.PrefixedClaimOrExpression{
|
||||
Claim: "sub",
|
||||
Prefix: pointer.String(""),
|
||||
Prefix: ptr.To(""),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user