@@ -24,31 +24,13 @@ import (
2424 "k8s.io/apimachinery/pkg/util/sets"
2525 "k8s.io/apimachinery/pkg/util/wait"
2626
27- clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2827 "sigs.k8s.io/cluster-api/cmd/clusterctl/client/config"
2928 "sigs.k8s.io/cluster-api/cmd/clusterctl/client/repository"
3029 yaml "sigs.k8s.io/cluster-api/cmd/clusterctl/client/yamlprocessor"
3130 logf "sigs.k8s.io/cluster-api/cmd/clusterctl/log"
31+ "sigs.k8s.io/cluster-api/internal/contract"
3232)
3333
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-
5234// Kubeconfig is a type that specifies inputs related to the actual
5335// kubeconfig.
5436type Kubeconfig struct {
@@ -233,8 +215,8 @@ func newClusterClient(kubeconfig Kubeconfig, configClient config.Client, options
233215 configClient : configClient ,
234216 kubeconfig : kubeconfig ,
235217 processor : yaml .NewSimpleProcessor (),
236- currentContractVersion : CurrentContractVersion ,
237- getCompatibleContractVersions : GetCompatibleContractVersions ,
218+ currentContractVersion : contract . Version ,
219+ getCompatibleContractVersions : contract . GetCompatibleVersions ,
238220 }
239221 for _ , o := range options {
240222 o (client )
0 commit comments