Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make capi/capv import alias generic so it doesn't need to change when upgrading to newer api versions #634

Closed
2 tasks done
Tracked by #127
mrajashree opened this issue Nov 15, 2021 · 0 comments
Closed
2 tasks done
Tracked by #127

Comments

@mrajashree
Copy link
Contributor

mrajashree commented Nov 15, 2021

The eks-anywhere code currently imports v1alpha3 api version of the following packages in multiple files:

sigs.k8s.io/cluster-api/api/v1alpha3
sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3
sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha3
github.com/mrajashree/etcdadm-controller/api/v1alpha3

In some files these packages are imported either without an import alias, or their import aliases are named based on the api version being used. For instance in vsphere.go,

  1. EKS-A imports capi v1alpha3. And anywhere we use variables/functions from that package we have to use v1alpha3
  2. It also imports KCP v1alpha3 but with an alias kubeadmnv1alpha3. And similarly everywhere in that file where variables from that package are used it is referred using kubeadmnv1alpha3

The issue with this is, when we upgrade these packages and start using newer api versions (such as v1beta1), it adds additional changes of refactoring the import alias and its usage.

Instead we can import all capi packages using a generic import alias. For instance

  1. The import for capi v1alpha3 can be named clusterv1.
  2. The import alias kubeadmnv1alpha3 can be renamed to kubeadmv1
  • Add import alias for all capi/capv imports that can stay constant across different api versions
  • Rename import aliases that are specific to an api version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants