@@ -24,31 +24,13 @@ import (
24
24
"k8s.io/apimachinery/pkg/util/sets"
25
25
"k8s.io/apimachinery/pkg/util/wait"
26
26
27
- clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
28
27
"sigs.k8s.io/cluster-api/cmd/clusterctl/client/config"
29
28
"sigs.k8s.io/cluster-api/cmd/clusterctl/client/repository"
30
29
yaml "sigs.k8s.io/cluster-api/cmd/clusterctl/client/yamlprocessor"
31
30
logf "sigs.k8s.io/cluster-api/cmd/clusterctl/log"
31
+ "sigs.k8s.io/cluster-api/internal/contract"
32
32
)
33
33
34
- var (
35
- // CurrentContractVersion is the contract version supported by this Cluster API version.
36
- // Note: Each Cluster API version supports one contract version, and by convention the contract version matches the current API version.
37
- CurrentContractVersion = clusterv1 .GroupVersion .Version
38
- )
39
-
40
- // GetCompatibleContractVersions return the list of contract version compatible with a given contract version.
41
- // NOTE: A contract version might be temporarily compatible with older contract versions e.g. to allow users time to transition to the new API.
42
- // NOTE: The return value must include also the contract version received in input.
43
- func GetCompatibleContractVersions (contract string ) sets.Set [string ] {
44
- compatibleContracts := sets .New (contract )
45
- // v1beta2 contract is temporarily be compatible with v1beta1 (until v1beta1 is EOL).
46
- if contract == "v1beta2" {
47
- compatibleContracts .Insert ("v1beta1" )
48
- }
49
- return compatibleContracts
50
- }
51
-
52
34
// Kubeconfig is a type that specifies inputs related to the actual
53
35
// kubeconfig.
54
36
type Kubeconfig struct {
@@ -233,8 +215,8 @@ func newClusterClient(kubeconfig Kubeconfig, configClient config.Client, options
233
215
configClient : configClient ,
234
216
kubeconfig : kubeconfig ,
235
217
processor : yaml .NewSimpleProcessor (),
236
- currentContractVersion : CurrentContractVersion ,
237
- getCompatibleContractVersions : GetCompatibleContractVersions ,
218
+ currentContractVersion : contract . Version ,
219
+ getCompatibleContractVersions : contract . GetCompatibleVersions ,
238
220
}
239
221
for _ , o := range options {
240
222
o (client )
0 commit comments