Skip to content

Commit

Permalink
🌱 add talos providers to defaults in clusterctl
Browse files Browse the repository at this point in the history
This PR will add the talos bootstrap and controlplane providers to the
list of default providers to enable with `clusterctl init`.

Signed-off-by: Spencer Smith <[email protected]>
  • Loading branch information
rsmitty committed Jun 30, 2020
1 parent ef2b61f commit 46073cc
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 21 deletions.
39 changes: 30 additions & 9 deletions cmd/clusterctl/client/config/providers_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,27 @@ import (
)

const (
ClusterAPIProviderName = "cluster-api"
KubeadmBootstrapProviderName = "kubeadm"
// Core providers
ClusterAPIProviderName = "cluster-api"

// Infra providers
AWSProviderName = "aws"
AzureProviderName = "azure"
Metal3ProviderName = "metal3"
OpenStackProviderName = "openstack"
PacketProviderName = "packet"
VSphereProviderName = "vsphere"

// Bootstrap providers
KubeadmBootstrapProviderName = "kubeadm"
TalosBootstrapProviderName = "talos"

// ControlPlane providers
KubeadmControlPlaneProviderName = "kubeadm"
AWSProviderName = "aws"
AzureProviderName = "azure"
Metal3ProviderName = "metal3"
OpenStackProviderName = "openstack"
VSphereProviderName = "vsphere"
PacketProviderName = "packet"
ProvidersConfigKey = "providers"
TalosControlPlaneProviderName = "talos"

// Other
ProvidersConfigKey = "providers"
)

// ProvidersClient has methods to work with provider configurations.
Expand Down Expand Up @@ -117,13 +128,23 @@ func (p *providersClient) defaults() []Provider {
url: "https://github.com/kubernetes-sigs/cluster-api/releases/latest/bootstrap-components.yaml",
providerType: clusterctlv1.BootstrapProviderType,
},
&provider{
name: TalosBootstrapProviderName,
url: "https://github.com/talos-systems/cluster-api-bootstrap-provider-talos/releases/latest/bootstrap-components.yaml",
providerType: clusterctlv1.BootstrapProviderType,
},

// ControlPlane providers
&provider{
name: KubeadmControlPlaneProviderName,
url: "https://github.com/kubernetes-sigs/cluster-api/releases/latest/control-plane-components.yaml",
providerType: clusterctlv1.ControlPlaneProviderType,
},
&provider{
name: TalosControlPlaneProviderName,
url: "https://github.com/talos-systems/cluster-api-control-plane-provider-talos/releases/latest/control-plane-components.yaml",
providerType: clusterctlv1.ControlPlaneProviderType,
},
}

return defaults
Expand Down
4 changes: 4 additions & 0 deletions cmd/clusterctl/client/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
wantProviders: []string{
config.ClusterAPIProviderName,
config.KubeadmBootstrapProviderName,
config.TalosBootstrapProviderName,
config.KubeadmControlPlaneProviderName,
config.TalosControlPlaneProviderName,
config.AWSProviderName,
config.AzureProviderName,
config.Metal3ProviderName,
Expand All @@ -74,7 +76,9 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
config.ClusterAPIProviderName,
customProviderConfig.Name(),
config.KubeadmBootstrapProviderName,
config.TalosBootstrapProviderName,
config.KubeadmControlPlaneProviderName,
config.TalosControlPlaneProviderName,
config.AWSProviderName,
config.AzureProviderName,
config.Metal3ProviderName,
Expand Down
34 changes: 22 additions & 12 deletions cmd/clusterctl/cmd/config_repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,20 @@ providers:
type: "CoreProvider"
`

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
kubeadm BootstrapProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ bootstrap-components.yaml
kubeadm ControlPlaneProvider https://github.com/kubernetes-sigs/cluster-api/releases/latest/ control-plane-components.yaml
aws InfrastructureProvider my-aws-infrastructure-components.yaml
azure InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-azure/releases/latest/ infrastructure-components.yaml
metal3 InfrastructureProvider https://github.com/metal3-io/cluster-api-provider-metal3/releases/latest/ infrastructure-components.yaml
my-infra-provider InfrastructureProvider /home/.cluster-api/overrides/infrastructure-docker/latest/ infrastructure-components.yaml
openstack InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-openstack/releases/latest/ infrastructure-components.yaml
packet InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-packet/releases/latest/ infrastructure-components.yaml
vsphere InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/latest/ infrastructure-components.yaml
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
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
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
azure InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-azure/releases/latest/ infrastructure-components.yaml
metal3 InfrastructureProvider https://github.com/metal3-io/cluster-api-provider-metal3/releases/latest/ infrastructure-components.yaml
my-infra-provider InfrastructureProvider /home/.cluster-api/overrides/infrastructure-docker/latest/ infrastructure-components.yaml
openstack InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-openstack/releases/latest/ infrastructure-components.yaml
packet InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-packet/releases/latest/ infrastructure-components.yaml
vsphere InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/latest/ infrastructure-components.yaml
`

var expectedOutputYaml = `- File: core_components.yaml
Expand All @@ -124,10 +126,18 @@ var expectedOutputYaml = `- File: core_components.yaml
Name: kubeadm
ProviderType: BootstrapProvider
URL: https://github.com/kubernetes-sigs/cluster-api/releases/latest/
- File: bootstrap-components.yaml
Name: talos
ProviderType: BootstrapProvider
URL: https://github.com/talos-systems/cluster-api-bootstrap-provider-talos/releases/latest/
- File: control-plane-components.yaml
Name: kubeadm
ProviderType: ControlPlaneProvider
URL: https://github.com/kubernetes-sigs/cluster-api/releases/latest/
- File: control-plane-components.yaml
Name: talos
ProviderType: ControlPlaneProvider
URL: https://github.com/talos-systems/cluster-api-control-plane-provider-talos/releases/latest/
- File: my-aws-infrastructure-components.yaml
Name: aws
ProviderType: InfrastructureProvider
Expand Down

0 comments on commit 46073cc

Please sign in to comment.