Skip to content

Commit

Permalink
clusterctl: add in-cluster ipam provider
Browse files Browse the repository at this point in the history
  • Loading branch information
schrej committed Feb 15, 2024
1 parent 08fb445 commit 2893d10
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cmd/clusterctl/client/config/providers_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ const (
K0smotronControlPlaneProviderName = "k0sproject-k0smotron"
)

// IPAM providers.
const (
InClusterIPAMProviderName = "in-cluster"
)

// Add-on providers.
const (
HelmAddonProviderName = "helm"
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions cmd/clusterctl/client/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
config.VclusterProviderName,
config.VirtinkProviderName,
config.VSphereProviderName,
config.InClusterIPAMProviderName,
config.HelmAddonProviderName,
},
wantErr: false,
Expand Down Expand Up @@ -158,6 +159,7 @@ func Test_clusterctlClient_GetProvidersConfig(t *testing.T) {
config.VclusterProviderName,
config.VirtinkProviderName,
config.VSphereProviderName,
config.InClusterIPAMProviderName,
config.HelmAddonProviderName,
},
wantErr: false,
Expand Down
5 changes: 5 additions & 0 deletions cmd/clusterctl/cmd/config_repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions docs/book/src/clusterctl/provider-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions docs/book/src/reference/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down

0 comments on commit 2893d10

Please sign in to comment.