Validate unsupported feature gates are not accidentally enabled
This commit checks to ensure that the unsupported EndpointSlice
and EndpointSliceProxying feature gates are disabled. If somehow,
the user runs a daemonset that enables these feature gates, the proxy
setup will error out.
@@ -6,6 +6,9 @@ import (
"net/http"
"time"
+ sdnproxy "github.com/openshift/sdn/pkg/network/proxy"
+ "github.com/openshift/sdn/pkg/network/proxyimpl/hybrid"
+ "github.com/openshift/sdn/pkg/network/proxyimpl/unidler"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
utilnet "k8s.io/apimachinery/pkg/util/net"
@@ -13,10 +16,14 @@ import (
utilwait "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apiserver/pkg/server/mux"
"k8s.io/apiserver/pkg/server/routes"
+ utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/kubernetes/scheme"
kv1core "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/record"
+ "k8s.io/component-base/metrics/legacyregistry"
+ "k8s.io/klog/v2"
kubeproxyoptions "k8s.io/kubernetes/cmd/kube-proxy/app"
+ "k8s.io/kubernetes/pkg/features"
proxy "k8s.io/kubernetes/pkg/proxy"
kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config"
pconfig "k8s.io/kubernetes/pkg/proxy/config"
@@ -28,12 +35,6 @@ import (
utiliptables "k8s.io/kubernetes/pkg/util/iptables"
utilsysctl "k8s.io/kubernetes/pkg/util/sysctl"
utilexec "k8s.io/utils/exec"
-
- sdnproxy "github.com/openshift/sdn/pkg/network/proxy"
- "github.com/openshift/sdn/pkg/network/proxyimpl/hybrid"
- "github.com/openshift/sdn/pkg/network/proxyimpl/unidler"
- "k8s.io/component-base/metrics/legacyregistry"
- "k8s.io/klog/v2"
)
// readProxyConfig reads the proxy config from a file
@@ -66,6 +67,13 @@ func (sdn *OpenShiftSDN) runProxy(waitChan chan<- bool) {
return
}
+ if utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice) ||
+ utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying) {
+ klog.Warningf("kube-proxy has unsupported EndpointSlice/EndpointSliceProxying gates enabled")
+ close(waitChan)
+ return
+ }
+
bindAddr := net.ParseIP(sdn.ProxyConfig.BindAddress)
nodeAddr := bindAddr
