Skip to content

Commit 09c82fc

Browse files
committed
integration etcd storage test
1 parent 8fcb4b5 commit 09c82fc

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

test/integration/etcd/data.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,16 @@ func GetEtcdStorageDataForNamespaceServedAt(namespace string, v string, removeAl
273273
IntroducedVersion: "1.7",
274274
},
275275
gvr("networking.k8s.io", "v1", "ipaddresses"): {
276-
Stub: `{"metadata": {"name": "192.168.2.3"}, "spec": {"parentRef": {"resource": "services","name": "test", "namespace": "ns"}}}`,
277-
ExpectedEtcdPath: "/registry/ipaddresses/192.168.2.3",
276+
Stub: `{"metadata": {"name": "192.168.2.3"}, "spec": {"parentRef": {"resource": "services","name": "test", "namespace": "ns"}}}`,
277+
ExpectedEtcdPath: "/registry/ipaddresses/192.168.2.3",
278+
ExpectedGVK: gvkP("networking.k8s.io", "v1beta1", "IPAddress"),
279+
IntroducedVersion: "1.33",
278280
},
279281
gvr("networking.k8s.io", "v1", "servicecidrs"): {
280-
Stub: `{"metadata": {"name": "range-b2"}, "spec": {"cidrs": ["192.168.0.0/16","fd00:1::/120"]}}`,
281-
ExpectedEtcdPath: "/registry/servicecidrs/range-b2",
282+
Stub: `{"metadata": {"name": "range-b2"}, "spec": {"cidrs": ["192.168.0.0/16","fd00:1::/120"]}}`,
283+
ExpectedEtcdPath: "/registry/servicecidrs/range-b2",
284+
ExpectedGVK: gvkP("networking.k8s.io", "v1beta1", "ServiceCIDR"),
285+
IntroducedVersion: "1.33",
282286
},
283287
// --
284288

test/integration/etcd/etcd_storage_path_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import (
4545
featuregatetesting "k8s.io/component-base/featuregate/testing"
4646
componentbaseversion "k8s.io/component-base/version"
4747
"k8s.io/kubernetes/cmd/kube-apiserver/app/options"
48+
"k8s.io/kubernetes/pkg/features"
4849
)
4950

5051
// 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) {
9495
// Only test for beta and GA APIs with emulated version.
9596
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, version.MustParse(v))
9697
featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, "AllBeta", true)
98+
// Feature Gates that are GA and depend directly on the API version to work can not be emulated in previous versions.
99+
// Example feature:
100+
// v1.x-2 : FeatureGate alpha , API v1alpha1/feature
101+
// v1.x-1 : FeatureGate beta , API v1beta1/feature
102+
// v1.x : FeatureGate GA , API v1/feature
103+
// 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
104+
// only understand v1beta1.
105+
featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.MultiCIDRServiceAllocator, false)
97106
}
98107
registerEffectiveEmulationVersion(t)
99108

0 commit comments

Comments
 (0)