From 2893d10ea2d47ee8165cfd418c9776a1353ea4ea Mon Sep 17 00:00:00 2001 From: Jakob Schrettenbrunner Date: Wed, 7 Jun 2023 12:34:29 +0200 Subject: [PATCH] clusterctl: add in-cluster ipam provider --- cmd/clusterctl/client/config/providers_client.go | 12 ++++++++++++ cmd/clusterctl/client/config_test.go | 2 ++ cmd/clusterctl/cmd/config_repositories_test.go | 5 +++++ cmd/clusterctl/cmd/init.go | 2 +- docs/book/src/clusterctl/provider-contract.md | 1 + docs/book/src/reference/glossary.md | 3 +++ 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/cmd/clusterctl/client/config/providers_client.go b/cmd/clusterctl/client/config/providers_client.go index 3adad5719b5c..499f16639ea9 100644 --- a/cmd/clusterctl/client/config/providers_client.go +++ b/cmd/clusterctl/client/config/providers_client.go @@ -91,6 +91,11 @@ const ( K0smotronControlPlaneProviderName = "k0sproject-k0smotron" ) +// IPAM providers. +const ( + InClusterIPAMProviderName = "in-cluster" +) + // Add-on providers. const ( HelmAddonProviderName = "helm" @@ -369,6 +374,13 @@ func (p *providersClient) defaults() []Provider { providerType: clusterctlv1.ControlPlaneProviderType, }, + // IPAM providers + &provider{ + name: InClusterIPAMProviderName, + url: "https://github.com/kubernetes-sigs/cluster-api-ipam-provider-in-cluster/releases/latest/ipam-components.yaml", + providerType: clusterctlv1.IPAMProviderType, + }, + // Add-on providers &provider{ name: HelmAddonProviderName, diff --git a/cmd/clusterctl/client/config_test.go b/cmd/clusterctl/client/config_test.go index 864b894f9277..48fdd1ad8e11 100644 --- a/cmd/clusterctl/client/config_test.go +++ b/cmd/clusterctl/client/config_test.go @@ -101,6 +101,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) { config.VclusterProviderName, config.VirtinkProviderName, config.VSphereProviderName, + config.InClusterIPAMProviderName, config.HelmAddonProviderName, }, wantErr: false, @@ -158,6 +159,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) { config.VclusterProviderName, config.VirtinkProviderName, config.VSphereProviderName, + config.InClusterIPAMProviderName, config.HelmAddonProviderName, }, wantErr: false, diff --git a/cmd/clusterctl/cmd/config_repositories_test.go b/cmd/clusterctl/cmd/config_repositories_test.go index 3f522a203a26..4a6be85f2035 100644 --- a/cmd/clusterctl/cmd/config_repositories_test.go +++ b/cmd/clusterctl/cmd/config_repositories_test.go @@ -150,6 +150,7 @@ vcd InfrastructureProvider https://github.com/vmware/cluste vcluster InfrastructureProvider https://github.com/loft-sh/cluster-api-provider-vcluster/releases/latest/ infrastructure-components.yaml virtink InfrastructureProvider https://github.com/smartxworks/cluster-api-provider-virtink/releases/latest/ infrastructure-components.yaml vsphere InfrastructureProvider https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/latest/ infrastructure-components.yaml +in-cluster IPAMProvider https://github.com/kubernetes-sigs/cluster-api-ipam-provider-in-cluster/releases/latest/ ipam-components.yaml helm AddonProvider https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm/releases/latest/ addon-components.yaml ` @@ -341,6 +342,10 @@ var expectedOutputYaml = `- File: core_components.yaml Name: vsphere ProviderType: InfrastructureProvider URL: https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/latest/ +- File: ipam-components.yaml + Name: in-cluster + ProviderType: IPAMProvider + URL: https://github.com/kubernetes-sigs/cluster-api-ipam-provider-in-cluster/releases/latest/ - File: addon-components.yaml Name: helm ProviderType: AddonProvider diff --git a/cmd/clusterctl/cmd/init.go b/cmd/clusterctl/cmd/init.go index e19eee9796da..18dd3edab328 100644 --- a/cmd/clusterctl/cmd/init.go +++ b/cmd/clusterctl/cmd/init.go @@ -103,7 +103,7 @@ func init() { initCmd.PersistentFlags().StringSliceVarP(&initOpts.controlPlaneProviders, "control-plane", "c", nil, "Control plane providers and versions (e.g. kubeadm:v1.1.5) to add to the management cluster. If unspecified, the Kubeadm control plane provider's latest release is used.") initCmd.PersistentFlags().StringSliceVar(&initOpts.ipamProviders, "ipam", nil, - "IPAM providers and versions (e.g. infoblox:v0.0.1) to add to the management cluster.") + "IPAM providers and versions (e.g. in-cluster:v0.1.0) to add to the management cluster.") initCmd.PersistentFlags().StringSliceVar(&initOpts.runtimeExtensionProviders, "runtime-extension", nil, "Runtime extension providers and versions to add to the management cluster; please note that clusterctl doesn't include any default runtime extensions and thus it is required to use custom configuration files to register runtime extensions.") initCmd.PersistentFlags().StringSliceVar(&initOpts.addonProviders, "addon", nil, diff --git a/docs/book/src/clusterctl/provider-contract.md b/docs/book/src/clusterctl/provider-contract.md index da52a09dfc46..ec6bae165172 100644 --- a/docs/book/src/clusterctl/provider-contract.md +++ b/docs/book/src/clusterctl/provider-contract.md @@ -336,6 +336,7 @@ providers. | CAPZ | cluster.x-k8s.io/provider=infrastructure-azure | | CAPOSC | cluster.x-k8s.io/provider=infrastructure-outscale | | CAPK0S | cluster.x-k8s.io/provider=infrastructure-k0smotron | +| CAIPAMIC | cluster.x-k8s.io/provider=ipam-in-cluster | ### Workload cluster templates diff --git a/docs/book/src/reference/glossary.md b/docs/book/src/reference/glossary.md index dd22362c30af..7774924ae9a0 100644 --- a/docs/book/src/reference/glossary.md +++ b/docs/book/src/reference/glossary.md @@ -108,6 +108,9 @@ Cluster API Provider VMware Cloud Director ### CAPZ Cluster API Provider Azure +### CAIPAMIC +Cluster API IPAM Provider In Cluster + ### Cloud provider Or __Cloud service provider__