Skip to content

Commit 8fc3a33

Browse files
Refactor compatibility version code
Replace DefaultComponentGlobalsRegistry with new instance of componentGlobalsRegistry in test api server. Signed-off-by: Siyuan Zhang <[email protected]> move kube effective version validation out of component base. Signed-off-by: Siyuan Zhang <[email protected]> move DefaultComponentGlobalsRegistry out of component base. Signed-off-by: Siyuan Zhang <[email protected]> move ComponentGlobalsRegistry out of featuregate pkg. Signed-off-by: Siyuan Zhang <[email protected]> remove usage of DefaultComponentGlobalsRegistry in test files. Signed-off-by: Siyuan Zhang <[email protected]> change non-test DefaultKubeEffectiveVersion to use DefaultBuildEffectiveVersion. Signed-off-by: Siyuan Zhang <[email protected]> Restore useDefaultBuildBinaryVersion in effective version. Signed-off-by: Siyuan Zhang <[email protected]> rename DefaultKubeEffectiveVersion to DefaultKubeEffectiveVersionForTest. Signed-off-by: Siyuan Zhang <[email protected]> pass options.ComponentGlobalsRegistry into config for controller manager and scheduler. Signed-off-by: Siyuan Zhang <[email protected]> Pass apiserver effective version to DefaultResourceEncodingConfig. Signed-off-by: Siyuan Zhang <[email protected]> change statusz registry to take effective version from the components. Signed-off-by: Siyuan Zhang <[email protected]> Address review comments Signed-off-by: Siyuan Zhang <[email protected]> update vendor Signed-off-by: Siyuan Zhang <[email protected]>
1 parent 22f25ef commit 8fc3a33

File tree

66 files changed

+1007
-804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1007
-804
lines changed

cmd/kube-apiserver/app/options/options_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ import (
3535
auditbuffered "k8s.io/apiserver/plugin/pkg/audit/buffered"
3636
audittruncate "k8s.io/apiserver/plugin/pkg/audit/truncate"
3737
cliflag "k8s.io/component-base/cli/flag"
38+
basecompatibility "k8s.io/component-base/compatibility"
3839
"k8s.io/component-base/featuregate"
3940
"k8s.io/component-base/logs"
4041
"k8s.io/component-base/metrics"
41-
utilversion "k8s.io/component-base/version"
4242
kapi "k8s.io/kubernetes/pkg/apis/core"
4343
controlplaneapiserver "k8s.io/kubernetes/pkg/controlplane/apiserver/options"
4444
"k8s.io/kubernetes/pkg/controlplane/reconcilers"
@@ -49,14 +49,12 @@ import (
4949
)
5050

5151
func TestAddFlags(t *testing.T) {
52-
componentGlobalsRegistry := featuregate.DefaultComponentGlobalsRegistry
53-
t.Cleanup(func() {
54-
componentGlobalsRegistry.Reset()
55-
})
52+
componentGlobalsRegistry := basecompatibility.NewComponentGlobalsRegistry()
5653
fs := pflag.NewFlagSet("addflagstest", pflag.PanicOnError)
5754

58-
utilruntime.Must(componentGlobalsRegistry.Register("test", utilversion.NewEffectiveVersion("1.32"), featuregate.NewFeatureGate()))
55+
utilruntime.Must(componentGlobalsRegistry.Register("test", basecompatibility.NewEffectiveVersionFromString("1.32", "1.31", "1.31"), featuregate.NewFeatureGate()))
5956
s := NewServerRunOptions()
57+
s.GenericServerRunOptions.ComponentGlobalsRegistry = componentGlobalsRegistry
6058
for _, f := range s.Flags().FlagSets {
6159
fs.AddFlagSet(f)
6260
}
@@ -150,7 +148,7 @@ func TestAddFlags(t *testing.T) {
150148
JSONPatchMaxCopyBytes: int64(3 * 1024 * 1024),
151149
MaxRequestBodyBytes: int64(3 * 1024 * 1024),
152150
ComponentGlobalsRegistry: componentGlobalsRegistry,
153-
ComponentName: featuregate.DefaultKubeComponent,
151+
ComponentName: basecompatibility.DefaultKubeComponent,
154152
},
155153
Admission: &kubeoptions.AdmissionOptions{
156154
GenericAdmission: &apiserveroptions.AdmissionOptions{

cmd/kube-apiserver/app/options/validation.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424

2525
genericoptions "k8s.io/apiserver/pkg/server/options"
2626
utilfeature "k8s.io/apiserver/pkg/util/feature"
27-
utilversion "k8s.io/component-base/version"
2827
netutils "k8s.io/utils/net"
2928

3029
controlplaneapiserver "k8s.io/kubernetes/pkg/controlplane/apiserver/options"
@@ -142,10 +141,5 @@ func (s CompletedOptions) Validate() []error {
142141
errs = append(errs, fmt.Errorf("--apiserver-count should be a positive number, but value '%d' provided", s.MasterCount))
143142
}
144143

145-
effectiveVersion := s.GenericServerRunOptions.ComponentGlobalsRegistry.EffectiveVersionFor(s.GenericServerRunOptions.ComponentName)
146-
if err := utilversion.ValidateKubeEffectiveVersion(effectiveVersion); err != nil {
147-
errs = append(errs, err)
148-
}
149-
150144
return errs
151145
}

cmd/kube-apiserver/app/server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
"k8s.io/client-go/rest"
4242
cliflag "k8s.io/component-base/cli/flag"
4343
"k8s.io/component-base/cli/globalflag"
44+
basecompatibility "k8s.io/component-base/compatibility"
4445
"k8s.io/component-base/featuregate"
4546
"k8s.io/component-base/logs"
4647
logsapi "k8s.io/component-base/logs/api/v1"
@@ -64,10 +65,9 @@ func init() {
6465

6566
// NewAPIServerCommand creates a *cobra.Command object with default parameters
6667
func NewAPIServerCommand() *cobra.Command {
67-
_, featureGate := featuregate.DefaultComponentGlobalsRegistry.ComponentGlobalsOrRegister(
68-
featuregate.DefaultKubeComponent, utilversion.DefaultBuildEffectiveVersion(), utilfeature.DefaultMutableFeatureGate)
6968
s := options.NewServerRunOptions()
7069
ctx := genericapiserver.SetupSignalContext()
70+
featureGate := s.GenericServerRunOptions.ComponentGlobalsRegistry.FeatureGateFor(basecompatibility.DefaultKubeComponent)
7171

7272
cmd := &cobra.Command{
7373
Use: "kube-apiserver",
@@ -79,7 +79,7 @@ cluster's shared state through which all other components interact.`,
7979
// stop printing usage when the command errors
8080
SilenceUsage: true,
8181
PersistentPreRunE: func(*cobra.Command, []string) error {
82-
if err := featuregate.DefaultComponentGlobalsRegistry.Set(); err != nil {
82+
if err := s.GenericServerRunOptions.ComponentGlobalsRegistry.Set(); err != nil {
8383
return err
8484
}
8585
// silence client-go warnings.
@@ -108,7 +108,7 @@ cluster's shared state through which all other components interact.`,
108108
return utilerrors.NewAggregate(errs)
109109
}
110110
// add feature enablement metrics
111-
featureGate.AddMetrics()
111+
featureGate.(featuregate.MutableFeatureGate).AddMetrics()
112112
return Run(ctx, completedOptions)
113113
},
114114
Args: func(cmd *cobra.Command, args []string) error {

cmd/kube-apiserver/app/testing/testserver.go

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,20 @@ import (
4343
"k8s.io/apimachinery/pkg/api/errors"
4444
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4545
utilerrors "k8s.io/apimachinery/pkg/util/errors"
46-
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
47-
"k8s.io/apimachinery/pkg/util/version"
4846
"k8s.io/apimachinery/pkg/util/wait"
4947
serveroptions "k8s.io/apiserver/pkg/server/options"
5048
"k8s.io/apiserver/pkg/storage/storagebackend"
5149
"k8s.io/apiserver/pkg/storageversion"
50+
"k8s.io/apiserver/pkg/util/compatibility"
5251
utilfeature "k8s.io/apiserver/pkg/util/feature"
5352
"k8s.io/client-go/kubernetes"
5453
restclient "k8s.io/client-go/rest"
5554
clientgotransport "k8s.io/client-go/transport"
5655
"k8s.io/client-go/util/cert"
5756
"k8s.io/client-go/util/keyutil"
58-
"k8s.io/component-base/featuregate"
57+
basecompatibility "k8s.io/component-base/compatibility"
5958
featuregatetesting "k8s.io/component-base/featuregate/testing"
6059
logsapi "k8s.io/component-base/logs/api/v1"
61-
utilversion "k8s.io/component-base/version"
6260
"k8s.io/klog/v2"
6361
"k8s.io/kube-aggregator/pkg/apiserver"
6462
"k8s.io/kubernetes/pkg/features"
@@ -104,11 +102,8 @@ type TestServerInstanceOptions struct {
104102
// an apiserver version skew scenario where all apiservers use the same proxyCA to verify client connections.
105103
ProxyCA *ProxyCA
106104
// Set the BinaryVersion of server effective version.
107-
// If empty, effective version will default to version.DefaultKubeBinaryVersion.
105+
// If empty, effective version will default to DefaultKubeEffectiveVersion.
108106
BinaryVersion string
109-
// Set the EmulationVersion of server effective version.
110-
// If empty, emulation version will default to the effective version.
111-
EmulationVersion string
112107
// Set non-default request timeout in the server.
113108
RequestTimeout time.Duration
114109
}
@@ -194,21 +189,20 @@ func StartTestServer(t ktesting.TB, instanceOptions *TestServerInstanceOptions,
194189

195190
fs := pflag.NewFlagSet("test", pflag.PanicOnError)
196191

197-
featureGate := utilfeature.DefaultMutableFeatureGate
198-
featureGate.AddMetrics()
199-
effectiveVersion := utilversion.DefaultKubeEffectiveVersion()
192+
featureGate := utilfeature.DefaultMutableFeatureGate.DeepCopy()
193+
effectiveVersion := compatibility.DefaultKubeEffectiveVersionForTest()
200194
if instanceOptions.BinaryVersion != "" {
201-
effectiveVersion = utilversion.NewEffectiveVersion(instanceOptions.BinaryVersion)
195+
effectiveVersion = basecompatibility.NewEffectiveVersionFromString(instanceOptions.BinaryVersion, "", "")
202196
}
203-
if instanceOptions.EmulationVersion != "" {
204-
effectiveVersion.SetEmulationVersion(version.MustParse(instanceOptions.EmulationVersion))
197+
effectiveVersion.SetEmulationVersion(featureGate.EmulationVersion())
198+
componentGlobalsRegistry := basecompatibility.NewComponentGlobalsRegistry()
199+
if err := componentGlobalsRegistry.Register(basecompatibility.DefaultKubeComponent, effectiveVersion, featureGate); err != nil {
200+
return result, err
205201
}
206-
// need to call SetFeatureGateEmulationVersionDuringTest to reset the feature gate emulation version at the end of the test.
207-
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, featureGate, effectiveVersion.EmulationVersion())
208-
featuregate.DefaultComponentGlobalsRegistry.Reset()
209-
utilruntime.Must(featuregate.DefaultComponentGlobalsRegistry.Register(featuregate.DefaultKubeComponent, effectiveVersion, featureGate))
210202

211203
s := options.NewServerRunOptions()
204+
// set up new instance of ComponentGlobalsRegistry instead of using the DefaultComponentGlobalsRegistry to avoid contention in parallel tests.
205+
s.Options.GenericServerRunOptions.ComponentGlobalsRegistry = componentGlobalsRegistry
212206
if instanceOptions.RequestTimeout > 0 {
213207
s.GenericServerRunOptions.RequestTimeout = instanceOptions.RequestTimeout
214208
}
@@ -330,15 +324,6 @@ func StartTestServer(t ktesting.TB, instanceOptions *TestServerInstanceOptions,
330324
return result, err
331325
}
332326
s.Authentication.ClientCert.ClientCA = clientCACertFile
333-
if utilfeature.DefaultFeatureGate.Enabled(features.UnknownVersionInteroperabilityProxy) {
334-
// TODO: set up a general clean up for testserver
335-
if clientgotransport.DialerStopCh == wait.NeverStop {
336-
ctx, cancel := context.WithTimeout(context.Background(), time.Hour)
337-
t.Cleanup(cancel)
338-
clientgotransport.DialerStopCh = ctx.Done()
339-
}
340-
s.PeerCAFile = filepath.Join(s.SecureServing.ServerCert.CertDirectory, s.SecureServing.ServerCert.PairName+".crt")
341-
}
342327
}
343328

344329
s.SecureServing.ExternalAddress = s.SecureServing.Listener.Addr().(*net.TCPAddr).IP // use listener addr although it is a loopback device
@@ -374,8 +359,32 @@ func StartTestServer(t ktesting.TB, instanceOptions *TestServerInstanceOptions,
374359
s.Authentication.RequestHeader.ExtraHeaderPrefixes = extraHeaders
375360
}
376361

377-
if err := featuregate.DefaultComponentGlobalsRegistry.Set(); err != nil {
378-
return result, err
362+
if err := componentGlobalsRegistry.Set(); err != nil {
363+
return result, fmt.Errorf("%w\nIf you are using SetFeatureGate*DuringTest, try using --emulated-version and --feature-gates flags instead", err)
364+
}
365+
// If the local ComponentGlobalsRegistry is changed by the flags,
366+
// we need to copy the new feature values back to the DefaultFeatureGate because most feature checks still use the DefaultFeatureGate.
367+
// We cannot directly use DefaultFeatureGate in ComponentGlobalsRegistry because the changes done by ComponentGlobalsRegistry.Set() will not be undone at the end of the test.
368+
if !featureGate.EmulationVersion().EqualTo(utilfeature.DefaultMutableFeatureGate.EmulationVersion()) {
369+
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultMutableFeatureGate, effectiveVersion.EmulationVersion())
370+
}
371+
for f := range utilfeature.DefaultMutableFeatureGate.GetAll() {
372+
if featureGate.Enabled(f) != utilfeature.DefaultFeatureGate.Enabled(f) {
373+
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, f, featureGate.Enabled(f))
374+
}
375+
}
376+
utilfeature.DefaultMutableFeatureGate.AddMetrics()
377+
378+
if instanceOptions.EnableCertAuth {
379+
if featureGate.Enabled(features.UnknownVersionInteroperabilityProxy) {
380+
// TODO: set up a general clean up for testserver
381+
if clientgotransport.DialerStopCh == wait.NeverStop {
382+
ctx, cancel := context.WithTimeout(context.Background(), time.Hour)
383+
t.Cleanup(cancel)
384+
clientgotransport.DialerStopCh = ctx.Done()
385+
}
386+
s.PeerCAFile = filepath.Join(s.SecureServing.ServerCert.CertDirectory, s.SecureServing.ServerCert.PairName+".crt")
387+
}
379388
}
380389

381390
saSigningKeyFile, err := os.CreateTemp("/tmp", "insecure_test_key")

cmd/kube-controller-manager/app/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
clientset "k8s.io/client-go/kubernetes"
2222
restclient "k8s.io/client-go/rest"
2323
"k8s.io/client-go/tools/record"
24+
basecompatibility "k8s.io/component-base/compatibility"
2425
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
2526
)
2627

@@ -43,6 +44,9 @@ type Config struct {
4344

4445
EventBroadcaster record.EventBroadcaster
4546
EventRecorder record.EventRecorder
47+
48+
// ComponentGlobalsRegistry is the registry where the effective versions and feature gates for all components are stored.
49+
ComponentGlobalsRegistry basecompatibility.ComponentGlobalsRegistry
4650
}
4751

4852
type completedConfig struct {

cmd/kube-controller-manager/app/controllermanager.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import (
5454
"k8s.io/client-go/util/keyutil"
5555
cliflag "k8s.io/component-base/cli/flag"
5656
"k8s.io/component-base/cli/globalflag"
57+
basecompatibility "k8s.io/component-base/compatibility"
5758
"k8s.io/component-base/configz"
5859
"k8s.io/component-base/featuregate"
5960
"k8s.io/component-base/logs"
@@ -99,9 +100,6 @@ const (
99100

100101
// NewControllerManagerCommand creates a *cobra.Command object with default parameters
101102
func NewControllerManagerCommand() *cobra.Command {
102-
_, _ = featuregate.DefaultComponentGlobalsRegistry.ComponentGlobalsOrRegister(
103-
featuregate.DefaultKubeComponent, utilversion.DefaultBuildEffectiveVersion(), utilfeature.DefaultMutableFeatureGate)
104-
105103
s, err := options.NewKubeControllerManagerOptions()
106104
if err != nil {
107105
klog.Background().Error(err, "Unable to initialize command options")
@@ -142,7 +140,7 @@ controller, and serviceaccounts controller.`,
142140
}
143141

144142
// add feature enablement metrics
145-
fg := s.ComponentGlobalsRegistry.FeatureGateFor(featuregate.DefaultKubeComponent)
143+
fg := s.ComponentGlobalsRegistry.FeatureGateFor(basecompatibility.DefaultKubeComponent)
146144
fg.(featuregate.MutableFeatureGate).AddMetrics()
147145
return Run(context.Background(), c.Complete())
148146
},
@@ -218,7 +216,7 @@ func Run(ctx context.Context, c *config.CompletedConfig) error {
218216
slis.SLIMetricsWithReset{}.Install(unsecuredMux)
219217

220218
if utilfeature.DefaultFeatureGate.Enabled(zpagesfeatures.ComponentStatusz) {
221-
statusz.Install(unsecuredMux, kubeControllerManager, statusz.NewRegistry())
219+
statusz.Install(unsecuredMux, kubeControllerManager, statusz.NewRegistry(c.ComponentGlobalsRegistry.EffectiveVersionFor(basecompatibility.DefaultKubeComponent)))
222220
}
223221

224222
handler := genericcontrollermanager.BuildHandlerChain(unsecuredMux, &c.Authorization, &c.Authentication)
@@ -289,11 +287,11 @@ func Run(ctx context.Context, c *config.CompletedConfig) error {
289287
}
290288

291289
if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.CoordinatedLeaderElection) {
292-
binaryVersion, err := semver.ParseTolerant(featuregate.DefaultComponentGlobalsRegistry.EffectiveVersionFor(featuregate.DefaultKubeComponent).BinaryVersion().String())
290+
binaryVersion, err := semver.ParseTolerant(c.ComponentGlobalsRegistry.EffectiveVersionFor(basecompatibility.DefaultKubeComponent).BinaryVersion().String())
293291
if err != nil {
294292
return err
295293
}
296-
emulationVersion, err := semver.ParseTolerant(featuregate.DefaultComponentGlobalsRegistry.EffectiveVersionFor(featuregate.DefaultKubeComponent).EmulationVersion().String())
294+
emulationVersion, err := semver.ParseTolerant(c.ComponentGlobalsRegistry.EffectiveVersionFor(basecompatibility.DefaultKubeComponent).EmulationVersion().String())
297295
if err != nil {
298296
return err
299297
}

cmd/kube-controller-manager/app/options/options.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
utilerrors "k8s.io/apimachinery/pkg/util/errors"
2626
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
2727
apiserveroptions "k8s.io/apiserver/pkg/server/options"
28+
"k8s.io/apiserver/pkg/util/compatibility"
2829
utilfeature "k8s.io/apiserver/pkg/util/feature"
2930
clientgofeaturegate "k8s.io/client-go/features"
3031
clientset "k8s.io/client-go/kubernetes"
@@ -36,11 +37,11 @@ import (
3637
cpnames "k8s.io/cloud-provider/names"
3738
cpoptions "k8s.io/cloud-provider/options"
3839
cliflag "k8s.io/component-base/cli/flag"
40+
basecompatibility "k8s.io/component-base/compatibility"
3941
"k8s.io/component-base/featuregate"
4042
"k8s.io/component-base/logs"
4143
logsapi "k8s.io/component-base/logs/api/v1"
4244
"k8s.io/component-base/metrics"
43-
utilversion "k8s.io/component-base/version"
4445
cmoptions "k8s.io/controller-manager/options"
4546
"k8s.io/klog/v2"
4647
kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1"
@@ -106,7 +107,7 @@ type KubeControllerManagerOptions struct {
106107
ShowHiddenMetricsForVersion string
107108

108109
// ComponentGlobalsRegistry is the registry where the effective versions and feature gates for all components are stored.
109-
ComponentGlobalsRegistry featuregate.ComponentGlobalsRegistry
110+
ComponentGlobalsRegistry basecompatibility.ComponentGlobalsRegistry
110111
}
111112

112113
// NewKubeControllerManagerOptions creates a new KubeControllerManagerOptions with a default config.
@@ -116,10 +117,12 @@ func NewKubeControllerManagerOptions() (*KubeControllerManagerOptions, error) {
116117
return nil, err
117118
}
118119

119-
if featuregate.DefaultComponentGlobalsRegistry.EffectiveVersionFor(featuregate.DefaultKubeComponent) == nil {
120+
componentGlobalsRegistry := compatibility.DefaultComponentGlobalsRegistry
121+
122+
if componentGlobalsRegistry.EffectiveVersionFor(basecompatibility.DefaultKubeComponent) == nil {
120123
featureGate := utilfeature.DefaultMutableFeatureGate
121-
effectiveVersion := utilversion.DefaultKubeEffectiveVersion()
122-
utilruntime.Must(featuregate.DefaultComponentGlobalsRegistry.Register(featuregate.DefaultKubeComponent, effectiveVersion, featureGate))
124+
effectiveVersion := compatibility.DefaultBuildEffectiveVersion()
125+
utilruntime.Must(componentGlobalsRegistry.Register(basecompatibility.DefaultKubeComponent, effectiveVersion, featureGate))
123126
}
124127

125128
s := KubeControllerManagerOptions{
@@ -211,7 +214,7 @@ func NewKubeControllerManagerOptions() (*KubeControllerManagerOptions, error) {
211214
Authorization: apiserveroptions.NewDelegatingAuthorizationOptions(),
212215
Metrics: metrics.NewOptions(),
213216
Logs: logs.NewOptions(),
214-
ComponentGlobalsRegistry: featuregate.DefaultComponentGlobalsRegistry,
217+
ComponentGlobalsRegistry: componentGlobalsRegistry,
215218
}
216219

217220
s.Authentication.RemoteKubeConfigFileOptional = true
@@ -230,7 +233,6 @@ func NewKubeControllerManagerOptions() (*KubeControllerManagerOptions, error) {
230233
s.GarbageCollectorController.GCIgnoredResources = gcIgnoredResources
231234
s.Generic.LeaderElection.ResourceName = "kube-controller-manager"
232235
s.Generic.LeaderElection.ResourceNamespace = "kube-system"
233-
234236
return &s, nil
235237
}
236238

@@ -452,7 +454,6 @@ func (s *KubeControllerManagerOptions) Validate(allControllers []string, disable
452454
errs = append(errs, s.Authentication.Validate()...)
453455
errs = append(errs, s.Authorization.Validate()...)
454456
errs = append(errs, s.Metrics.Validate()...)
455-
errs = append(errs, utilversion.ValidateKubeEffectiveVersion(s.ComponentGlobalsRegistry.EffectiveVersionFor(featuregate.DefaultKubeComponent)))
456457

457458
// in-tree cloud providers are disabled since v1.31 (KEP-2395)
458459
if len(s.KubeCloudShared.CloudProvider.Name) > 0 && !cloudprovider.IsExternal(s.KubeCloudShared.CloudProvider.Name) {
@@ -498,10 +499,11 @@ func (s KubeControllerManagerOptions) Config(allControllers []string, disabledBy
498499
eventRecorder := eventBroadcaster.NewRecorder(clientgokubescheme.Scheme, v1.EventSource{Component: KubeControllerManagerUserAgent})
499500

500501
c := &kubecontrollerconfig.Config{
501-
Client: client,
502-
Kubeconfig: kubeconfig,
503-
EventBroadcaster: eventBroadcaster,
504-
EventRecorder: eventRecorder,
502+
Client: client,
503+
Kubeconfig: kubeconfig,
504+
EventBroadcaster: eventBroadcaster,
505+
EventRecorder: eventRecorder,
506+
ComponentGlobalsRegistry: s.ComponentGlobalsRegistry,
505507
}
506508
if err := s.ApplyTo(c, allControllers, disabledByDefaultControllers, controllerAliases); err != nil {
507509
return nil, err

0 commit comments

Comments
 (0)