Skip to content

Commit

Permalink
feat: add EKS controlplane provider
Browse files Browse the repository at this point in the history
Add the EKS control plane provider to `clusterctl` which will be
available in the **0.6.1** release of CAPA.

refactor: changed the name of the eks providers

The EKS bootstrap and control plane providers have had their names
changes so they are prefixed with aws and both end up being
`aws-eks`.

The apidiff test fails if anything is changed `EKSBootstrapProviderName`
so this has been kept. The new provider `AWSEKSBootstrapProviderName`
will be used instead in documentation and the providers list. If anyone
uses the `EKSBootstrapProviderName` then it will return the same as the
`AWSEKSBootstrapProviderName`.
  • Loading branch information
richardcase committed Oct 1, 2020
1 parent 3158562 commit 94df36c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
11 changes: 9 additions & 2 deletions cmd/clusterctl/client/config/providers_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ const (
// Bootstrap providers
KubeadmBootstrapProviderName = "kubeadm"
TalosBootstrapProviderName = "talos"
EKSBootstrapProviderName = "eks"
EKSBootstrapProviderName = "eks" // DEPRECATED: if this provider is used it returns the same as aws-eks
AWSEKSBootstrapProviderName = "aws-eks"

// ControlPlane providers
KubeadmControlPlaneProviderName = "kubeadm"
TalosControlPlaneProviderName = "talos"
AWSEKSControlPlaneProviderName = "aws-eks"

// Other
ProvidersConfigKey = "providers"
Expand Down Expand Up @@ -154,7 +156,7 @@ func (p *providersClient) defaults() []Provider {
providerType: clusterctlv1.BootstrapProviderType,
},
&provider{
name: EKSBootstrapProviderName,
name: AWSEKSBootstrapProviderName,
url: "https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/latest/eks-bootstrap-components.yaml",
providerType: clusterctlv1.BootstrapProviderType,
},
Expand All @@ -169,6 +171,11 @@ func (p *providersClient) defaults() []Provider {
url: "https://github.com/talos-systems/cluster-api-control-plane-provider-talos/releases/latest/control-plane-components.yaml",
providerType: clusterctlv1.ControlPlaneProviderType,
},
&provider{
name: AWSEKSControlPlaneProviderName,
url: "https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/latest/eks-controlplane-components.yaml",
providerType: clusterctlv1.ControlPlaneProviderType,
},
}

return defaults
Expand Down
6 changes: 4 additions & 2 deletions cmd/clusterctl/client/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
// note: these will be sorted by name by the Providers() call, so be sure they are in alphabetical order here too
wantProviders: []string{
config.ClusterAPIProviderName,
config.EKSBootstrapProviderName,
config.AWSEKSBootstrapProviderName,
config.KubeadmBootstrapProviderName,
config.TalosBootstrapProviderName,
config.AWSEKSControlPlaneProviderName,
config.KubeadmControlPlaneProviderName,
config.TalosControlPlaneProviderName,
config.AWSProviderName,
Expand All @@ -80,10 +81,11 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
// note: these will be sorted by name by the Providers() call, so be sure they are in alphabetical order here too
wantProviders: []string{
config.ClusterAPIProviderName,
config.AWSEKSBootstrapProviderName,
customProviderConfig.Name(),
config.EKSBootstrapProviderName,
config.KubeadmBootstrapProviderName,
config.TalosBootstrapProviderName,
config.AWSEKSControlPlaneProviderName,
config.KubeadmControlPlaneProviderName,
config.TalosControlPlaneProviderName,
config.AWSProviderName,
Expand Down
12 changes: 11 additions & 1 deletion cmd/clusterctl/client/repository/metadata_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (f *metadataClient) getEmbeddedMetadata() *clusterctlv1.Metadata {
// older version are not supported by clusterctl
},
}
case config.EKSBootstrapProviderName:
case config.EKSBootstrapProviderName, config.AWSEKSBootstrapProviderName:
return &clusterctlv1.Metadata{
TypeMeta: metav1.TypeMeta{
APIVersion: clusterctlv1.GroupVersion.String(),
Expand Down Expand Up @@ -196,6 +196,16 @@ func (f *metadataClient) getEmbeddedMetadata() *clusterctlv1.Metadata {
// there are no older version for Talos controlplane
},
}
case config.AWSEKSControlPlaneProviderName:
return &clusterctlv1.Metadata{
TypeMeta: metav1.TypeMeta{
APIVersion: clusterctlv1.GroupVersion.String(),
Kind: "Metadata",
},
ReleaseSeries: []clusterctlv1.ReleaseSeries{
{Major: 0, Minor: 6, Contract: "v1alpha3"},
},
}
default:
return nil
}
Expand Down
9 changes: 7 additions & 2 deletions cmd/clusterctl/cmd/config_repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ providers:
var expectedOutputText = `NAME TYPE URL FILE
cluster-api CoreProvider https://github.com/myorg/myforkofclusterapi/releases/latest/ core_components.yaml
another-provider BootstrapProvider ./ bootstrap-components.yaml
eks BootstrapProvider https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/latest/ eks-bootstrap-components.yaml
aws-eks BootstrapProvider https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/latest/ eks-bootstrap-components.yaml
kubeadm BootstrapProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ bootstrap-components.yaml
talos BootstrapProvider https://github.com/talos-systems/cluster-api-bootstrap-provider-talos/releases/latest/ bootstrap-components.yaml
aws-eks ControlPlaneProvider https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/latest/ eks-controlplane-components.yaml
kubeadm ControlPlaneProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ control-plane-components.yaml
talos ControlPlaneProvider https://github.com/talos-systems/cluster-api-control-plane-provider-talos/releases/latest/ control-plane-components.yaml
aws InfrastructureProvider my-aws-infrastructure-components.yaml
Expand All @@ -128,7 +129,7 @@ var expectedOutputYaml = `- File: core_components.yaml
ProviderType: BootstrapProvider
URL: ./
- File: eks-bootstrap-components.yaml
Name: eks
Name: aws-eks
ProviderType: BootstrapProvider
URL: https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/latest/
- File: bootstrap-components.yaml
Expand All @@ -139,6 +140,10 @@ var expectedOutputYaml = `- File: core_components.yaml
Name: talos
ProviderType: BootstrapProvider
URL: https://github.com/talos-systems/cluster-api-bootstrap-provider-talos/releases/latest/
- File: eks-controlplane-components.yaml
Name: aws-eks
ProviderType: ControlPlaneProvider
URL: https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/latest/
- File: control-plane-components.yaml
Name: kubeadm
ProviderType: ControlPlaneProvider
Expand Down

0 comments on commit 94df36c

Please sign in to comment.