@@ -44,6 +44,7 @@ import (
44
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
45
45
utilerrors "k8s.io/apimachinery/pkg/util/errors"
46
46
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
47
+ "k8s.io/apimachinery/pkg/util/version"
47
48
"k8s.io/apimachinery/pkg/util/wait"
48
49
serveroptions "k8s.io/apiserver/pkg/server/options"
49
50
"k8s.io/apiserver/pkg/storage/storagebackend"
@@ -102,8 +103,11 @@ type TestServerInstanceOptions struct {
102
103
// an apiserver version skew scenario where all apiservers use the same proxyCA to verify client connections.
103
104
ProxyCA * ProxyCA
104
105
// Set the BinaryVersion of server effective version.
105
- // Default to 1.31
106
+ // If empty, effective version will default to version.DefaultKubeBinaryVersion.
106
107
BinaryVersion string
108
+ // Set the EmulationVersion of server effective version.
109
+ // If empty, emulation version will default to the effective version.
110
+ EmulationVersion string
107
111
// Set non-default request timeout in the server.
108
112
RequestTimeout time.Duration
109
113
}
@@ -194,6 +198,9 @@ func StartTestServer(t ktesting.TB, instanceOptions *TestServerInstanceOptions,
194
198
if instanceOptions .BinaryVersion != "" {
195
199
effectiveVersion = utilversion .NewEffectiveVersion (instanceOptions .BinaryVersion )
196
200
}
201
+ if instanceOptions .EmulationVersion != "" {
202
+ effectiveVersion .SetEmulationVersion (version .MustParse (instanceOptions .EmulationVersion ))
203
+ }
197
204
// need to call SetFeatureGateEmulationVersionDuringTest to reset the feature gate emulation version at the end of the test.
198
205
featuregatetesting .SetFeatureGateEmulationVersionDuringTest (t , featureGate , effectiveVersion .EmulationVersion ())
199
206
utilversion .DefaultComponentGlobalsRegistry .Reset ()
0 commit comments