mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
Merge pull request #131654 from vinayakankugoyal/anonGA
KEP-4633: Graduate to Stable.
This commit is contained in:
@@ -1186,6 +1186,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
|
||||
genericfeatures.AnonymousAuthConfigurableEndpoints: {
|
||||
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta},
|
||||
{Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||
},
|
||||
|
||||
genericfeatures.APIResponseCompression: {
|
||||
|
||||
@@ -321,7 +321,6 @@ func (o *BuiltInAuthenticationOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&o.AuthenticationConfigFile, "authentication-config", o.AuthenticationConfigFile, ""+
|
||||
"File with Authentication Configuration to configure the JWT Token authenticator or the anonymous authenticator. "+
|
||||
"Requires the StructuredAuthenticationConfiguration feature gate. "+
|
||||
"Also requires the feature gate AnonymousAuthConfigurableEndpoints to configure the anonymous authenticator in the config file. "+
|
||||
"This flag is mutually exclusive with the --oidc-* flags if the file configures the JWT Token authenticator. "+
|
||||
"This flag is mutually exclusive with --anonymous-auth if the file configures the Anonymous authenticator.")
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
"k8s.io/apimachinery/pkg/util/version"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apiserver/pkg/apis/apiserver"
|
||||
"k8s.io/apiserver/pkg/authentication/authenticator"
|
||||
@@ -64,6 +65,7 @@ func TestAuthenticationValidate(t *testing.T) {
|
||||
testAuthenticationConfigFile string
|
||||
expectErr string
|
||||
enabledFeatures, disabledFeatures []featuregate.Feature
|
||||
emulationVersion *version.Version
|
||||
}{
|
||||
{
|
||||
name: "test when OIDC and ServiceAccounts are nil",
|
||||
@@ -250,6 +252,9 @@ func TestAuthenticationValidate(t *testing.T) {
|
||||
Allow: true,
|
||||
FlagsSet: true,
|
||||
},
|
||||
// This allows us to disable the AnonymousAuthConfigurableEndpoints
|
||||
// feature-gate, otherwise this feature-gate cannot be disabled.
|
||||
emulationVersion: version.MustParse("1.33"),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -261,6 +266,12 @@ func TestAuthenticationValidate(t *testing.T) {
|
||||
options.ServiceAccounts = testcase.testSA
|
||||
options.WebHook = testcase.testWebHook
|
||||
options.AuthenticationConfigFile = testcase.testAuthenticationConfigFile
|
||||
|
||||
// SetFeatureGateEmulationVersionDuringTest needs to be called
|
||||
// before any calls to SetFeatureGateDuringTest to work reliably.
|
||||
if testcase.emulationVersion != nil {
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.33"))
|
||||
}
|
||||
for _, f := range testcase.enabledFeatures {
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, f, true)
|
||||
}
|
||||
@@ -747,7 +758,11 @@ jwt:
|
||||
|
||||
for _, testcase := range testCases {
|
||||
t.Run(testcase.name, func(t *testing.T) {
|
||||
if !testcase.enableAnonymousEndpoints {
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.33"))
|
||||
}
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.AnonymousAuthConfigurableEndpoints, testcase.enableAnonymousEndpoints)
|
||||
|
||||
opts := NewBuiltInAuthenticationOptions().WithAnonymous()
|
||||
pf := pflag.NewFlagSet("test-builtin-authentication-opts", pflag.ContinueOnError)
|
||||
opts.AddFlags(pf)
|
||||
|
||||
@@ -272,6 +272,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
|
||||
AnonymousAuthConfigurableEndpoints: {
|
||||
{Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta},
|
||||
{Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||
},
|
||||
|
||||
APIResponseCompression: {
|
||||
|
||||
@@ -77,6 +77,10 @@
|
||||
lockToDefault: false
|
||||
preRelease: Beta
|
||||
version: "1.32"
|
||||
- default: true
|
||||
lockToDefault: true
|
||||
preRelease: GA
|
||||
version: "1.34"
|
||||
- name: AnyVolumeDataSource
|
||||
versionedSpecs:
|
||||
- default: false
|
||||
|
||||
@@ -80,8 +80,6 @@ func TestStructuredAuthenticationConfig(t *testing.T) {
|
||||
t.Log("Testing anonymous authenticator with authentication config")
|
||||
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.StructuredAuthenticationConfiguration, true)
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.AnonymousAuthConfigurableEndpoints, true)
|
||||
|
||||
testCases := []struct {
|
||||
desc string
|
||||
authConfig string
|
||||
|
||||
Reference in New Issue
Block a user