Skip to content

WIP: CNTRLPLANE-5: Set client-go CBOR feature gates #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pkg/operator/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,25 @@ func RunOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
go featureGateAccessor.Run(ctx)
go configInformers.Start(ctx.Done())

var featureGates featuregates.FeatureGate
select {
case <-featureGateAccessor.InitialFeatureGatesObserved():
featureGates, _ := featureGateAccessor.CurrentFeatureGates()
featureGates, _ = featureGateAccessor.CurrentFeatureGates()
klog.Infof("FeatureGates initialized: knownFeatureGates=%v", featureGates.KnownFeatures())
case <-time.After(1 * time.Minute):
klog.Errorf("timed out waiting for FeatureGate detection")
return fmt.Errorf("timed out waiting for FeatureGate detection")
}

for _, fgName := range []string{"ClientsPreferCBOR", "ClientsAllowCBOR"} {
if featureGates.Enabled(configv1.FeatureGateName(fgName)) {
clientGoFeatureGate := fmt.Sprintf("KUBE_FEATURE_%s", fgName)
if err := os.Setenv(clientGoFeatureGate, "true"); err != nil {
return fmt.Errorf("failed to set client-go feature gate with environment variable %s: %w", clientGoFeatureGate, err)
}
}
}

resourceSyncController, err := resourcesynccontroller.NewResourceSyncController(
operatorClient,
kubeInformersForNamespaces,
Expand Down