integration etcd storage test

This commit is contained in:
Antonio Ojea 2025-01-20 13:26:49 +00:00
parent 8fcb4b5773
commit 09c82fc58a
2 changed files with 17 additions and 4 deletions

View File

@ -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",
},
// --

View File

@ -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)