diff --git a/test/integration/etcd/data.go b/test/integration/etcd/data.go index f2df5ee01e7..03ad87ad582 100644 --- a/test/integration/etcd/data.go +++ b/test/integration/etcd/data.go @@ -273,12 +273,16 @@ func GetEtcdStorageDataForNamespaceServedAt(namespace string, v string, removeAl IntroducedVersion: "1.7", }, gvr("networking.k8s.io", "v1", "ipaddresses"): { - Stub: `{"metadata": {"name": "192.168.2.3"}, "spec": {"parentRef": {"resource": "services","name": "test", "namespace": "ns"}}}`, - ExpectedEtcdPath: "/registry/ipaddresses/192.168.2.3", + Stub: `{"metadata": {"name": "192.168.2.3"}, "spec": {"parentRef": {"resource": "services","name": "test", "namespace": "ns"}}}`, + ExpectedEtcdPath: "/registry/ipaddresses/192.168.2.3", + ExpectedGVK: gvkP("networking.k8s.io", "v1beta1", "IPAddress"), + IntroducedVersion: "1.33", }, gvr("networking.k8s.io", "v1", "servicecidrs"): { - Stub: `{"metadata": {"name": "range-b2"}, "spec": {"cidrs": ["192.168.0.0/16","fd00:1::/120"]}}`, - ExpectedEtcdPath: "/registry/servicecidrs/range-b2", + Stub: `{"metadata": {"name": "range-b2"}, "spec": {"cidrs": ["192.168.0.0/16","fd00:1::/120"]}}`, + ExpectedEtcdPath: "/registry/servicecidrs/range-b2", + ExpectedGVK: gvkP("networking.k8s.io", "v1beta1", "ServiceCIDR"), + IntroducedVersion: "1.33", }, // -- diff --git a/test/integration/etcd/etcd_storage_path_test.go b/test/integration/etcd/etcd_storage_path_test.go index 2e015d2470e..768d9a540e5 100644 --- a/test/integration/etcd/etcd_storage_path_test.go +++ b/test/integration/etcd/etcd_storage_path_test.go @@ -45,6 +45,7 @@ import ( featuregatetesting "k8s.io/component-base/featuregate/testing" componentbaseversion "k8s.io/component-base/version" "k8s.io/kubernetes/cmd/kube-apiserver/app/options" + "k8s.io/kubernetes/pkg/features" ) // Only add kinds to this list when this a virtual resource with get and create verbs that doesn't actually @@ -94,6 +95,14 @@ func testEtcdStoragePathWithVersion(t *testing.T, v string) { // Only test for beta and GA APIs with emulated version. featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, version.MustParse(v)) featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, "AllBeta", true) + // Feature Gates that are GA and depend directly on the API version to work can not be emulated in previous versions. + // Example feature: + // v1.x-2 : FeatureGate alpha , API v1alpha1/feature + // v1.x-1 : FeatureGate beta , API v1beta1/feature + // v1.x : FeatureGate GA , API v1/feature + // The code in v1.x uses the clients with the v1 API, if we emulate v1.x-1 it will not work against apiserver that + // only understand v1beta1. + featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.MultiCIDRServiceAllocator, false) } registerEffectiveEmulationVersion(t)