@@ -117,6 +117,10 @@ type introducedInterface interface {
117
117
APILifecycleIntroduced () (major , minor int )
118
118
}
119
119
120
+ type replacementInterface interface {
121
+ APILifecycleReplacement () schema.GroupVersionKind
122
+ }
123
+
120
124
func emulatedStorageVersion (binaryVersionOfResource schema.GroupVersion , example runtime.Object , effectiveVersion version.EffectiveVersion , scheme * runtime.Scheme ) (schema.GroupVersion , error ) {
121
125
if example == nil || effectiveVersion == nil {
122
126
return binaryVersionOfResource , nil
@@ -170,6 +174,14 @@ func emulatedStorageVersion(binaryVersionOfResource schema.GroupVersion, example
170
174
// If it was introduced after current compatibility version, don't use it
171
175
// skip the introduced check for test when currentVersion is 0.0 to test all apis
172
176
if introduced , hasIntroduced := exampleOfGVK .(introducedInterface ); hasIntroduced && (compatibilityVersion .Major () > 0 || compatibilityVersion .Minor () > 0 ) {
177
+
178
+ // Skip versions that have a replacement.
179
+ // This can be used to override this storage version selection by
180
+ // marking a storage version has having a replacement and preventing a
181
+ // that storage version from being selected.
182
+ if _ , hasReplacement := exampleOfGVK .(replacementInterface ); hasReplacement {
183
+ continue
184
+ }
173
185
// API resource lifecycles should be relative to k8s api version
174
186
majorIntroduced , minorIntroduced := introduced .APILifecycleIntroduced ()
175
187
introducedVer := apimachineryversion .MajorMinor (uint (majorIntroduced ), uint (minorIntroduced ))
0 commit comments