Skip to content

Commit

Permalink
Merge pull request #3271 from rsmitty/master
Browse files Browse the repository at this point in the history
🌱 add talos providers to defaults in clusterctl
  • Loading branch information
k8s-ci-robot authored Jul 1, 2020
2 parents 1daed58 + f4d15f6 commit faa6e09
Show file tree
Hide file tree
Showing 4 changed files with 82 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
26 changes: 26 additions & 0 deletions cmd/clusterctl/client/repository/metadata_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ func (f *metadataClient) getEmbeddedMetadata() *clusterctlv1.Metadata {
// older version are not supported by clusterctl
},
}
case config.TalosBootstrapProviderName:
return &clusterctlv1.Metadata{
TypeMeta: metav1.TypeMeta{
APIVersion: clusterctlv1.GroupVersion.String(),
Kind: "Metadata",
},
ReleaseSeries: []clusterctlv1.ReleaseSeries{
// v1alpha3 release series
{Major: 0, Minor: 2, Contract: "v1alpha3"},
// v1alpha2 release series are supported only for upgrades
{Major: 0, Minor: 1, Contract: "v1alpha2"},
// older version are not supported by clusterctl
},
}
default:
return nil
}
Expand All @@ -159,6 +173,18 @@ func (f *metadataClient) getEmbeddedMetadata() *clusterctlv1.Metadata {
// there are no older version for KCP
},
}
case config.TalosControlPlaneProviderName:
return &clusterctlv1.Metadata{
TypeMeta: metav1.TypeMeta{
APIVersion: clusterctlv1.GroupVersion.String(),
Kind: "Metadata",
},
ReleaseSeries: []clusterctlv1.ReleaseSeries{
// v1alpha3 release series
{Major: 0, Minor: 1, Contract: "v1alpha3"},
// there are no older version for Talos controlplane
},
}
default:
return nil
}
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 faa6e09

Please sign in to comment.