Skip to content

Instantly share code, notes, and snippets.

@deads2k
Last active March 13, 2024 15:09
Show Gist options
  • Save deads2k/98751209925c8dfa986baf03f2d42d11 to your computer and use it in GitHub Desktop.
Save deads2k/98751209925c8dfa986baf03f2d42d11 to your computer and use it in GitHub Desktop.
featuregates
k8s.io/apiserver
rapid-reset, defaulted to off. In repos vendoring, I needed to enable/disable
k8s.io/client-go
aggregated-discovery - had a bug and needed way for every vendoring binary we cannot recompile to disable. We added env vars.
streaming-list - desire to have different default in kube-controller-manager versus kubelet
kube-controller-manager
client-go/streaming-list - disabled by default in library, kcm wants it enabled by default and controlled via flag.
other controllers and operators
client-go/streaming-list - disabled by default in library,operator wants it enabled, leave as env var
kubernetes-sigs/structured-merge-diff
how would we like to put featuregates in it? registered where and how? perhaps select a different cadence?
intersection with the API compatibility version
other projects (controllers and apiservers) vendor k8s.io/apiserver and k8s.io/cient-go.
other projects (especially apiservers) define their own featuregates
other projects specify their own versions
the featuregates in k8s.io/apiserver and k8s.io/client-go need to keep their gates separate to understand their compatibility version separately.
openshift binaries have their own featuregates and vendor kube
registering into a global variable produces problems: glog's usage golang global flags
global flags age less well than cobra flags
as libraries compose with other libraries, referring to local instances allows opt-in versus try to find a way to opt-out
func init() {
gates := featuregate.New()
runtime.Must(gates.Add(utilfeature.All))
runtime.Must(gates.Add(clientfeatures.All))
runtime.Must(utilfeature.SetDefault(gates))
runtime.Must(clientfeatures.SetDefault(gates))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment