Skip to content

Commit 732bf68

Browse files
committed
feat(platform): make the Proxmox substrate installable from a bundle
Until now the two Cluster API packages behind the Proxmox substrate existed but no bundle emitted them, so a Cozystack install shipped neither and the substrate was reachable only by applying Package CRs by hand. They join the iaas bundle as opt-in packages, where the KubeVirt infrastructure provider is unconditional. The asymmetry is the point: capmox drives a hypervisor outside this cluster and, without a Secret holding a Proxmox API token, comes up and reconciles nothing. Every Cozystack install should not carry a controller for infrastructure it does not have. Enabling capmox brings the in-cluster IPAM provider with it — capmox allocates worker addresses from an InClusterIPPool and has no DHCP mode, so on its own it never gets a ProxmoxCluster to Ready. IPAM stays independently enableable, since assigning addresses is a generic Cluster API concern rather than a Proxmox one. Naming capmox in enabledPackages while disabling IPAM stops the render: that combination otherwise produces a healthy-looking Package and clusters stuck on a CRD that was never installed, which reads as a broken provider rather than as the configuration that caused it. Signed-off-by: Marian Koreniuk <[email protected]> Assisted-by: LLM
1 parent 962e429 commit 732bf68

3 files changed

Lines changed: 174 additions & 0 deletions

File tree

‎packages/core/platform/templates/bundles/iaas.yaml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,41 @@
163163
{{include "cozystack.platform.package.default" (list "cozystack.capi-provider-core" $) }}
164164
{{include "cozystack.platform.package.default" (list "cozystack.capi-provider-cp-kamaji" $) }}
165165
{{include "cozystack.platform.package.default" (list "cozystack.capi-provider-infra-kubevirt" $) }}
166+
{{- /*
167+
The Proxmox infrastructure provider is opt-in where the KubeVirt one is not,
168+
and the asymmetry is not a matter of taste. capmox talks to a hypervisor that
169+
lives outside this cluster: without a capmox-config Secret holding a Proxmox
170+
API token, and an address pool the operator has agreed to hand out, the
171+
provider comes up and reconciles nothing. Deploying it by default would put a
172+
controller in every Cozystack install that has no Proxmox to control.
173+
174+
Enable it by adding cozystack.capi-provider-infra-proxmox to
175+
bundles.enabledPackages. The in-cluster IPAM provider comes with it: capmox
176+
assigns static addresses out of an InClusterIPPool and has no DHCP mode, so
177+
without the IPAM CRDs a ProxmoxCluster never reaches Ready. IPAM is also
178+
independently enableable — it is a generic Cluster API addon, useful to any
179+
provider that assigns rather than leases.
180+
*/ -}}
181+
{{- $proxmoxName := "cozystack.capi-provider-infra-proxmox" -}}
182+
{{- $ipamName := "cozystack.capi-provider-ipam-in-cluster" -}}
183+
{{- $pkgDisabled := default (list) .Values.bundles.disabledPackages -}}
184+
{{- $pkgEnabled := default (list) .Values.bundles.enabledPackages -}}
185+
{{- $proxmoxEnabled := and (has $proxmoxName $pkgEnabled) (not (has $proxmoxName $pkgDisabled)) -}}
186+
{{- /*
187+
Naming the pair in conflicting lists is the one case worth stopping for.
188+
Emitting the provider without its IPAM would leave the Package Ready and every
189+
ProxmoxCluster stuck on a missing CRD — a failure that reads as a broken
190+
provider rather than as the configuration that caused it.
191+
*/ -}}
192+
{{- if and $proxmoxEnabled (has $ipamName $pkgDisabled) -}}
193+
{{- fail (printf "%s requires %s, which is listed in bundles.disabledPackages: capmox allocates worker addresses from an InClusterIPPool and has no DHCP mode, so without the IPAM provider no ProxmoxCluster ever becomes Ready" $proxmoxName $ipamName) -}}
194+
{{- end -}}
195+
{{- if or $proxmoxEnabled (has $ipamName $pkgEnabled) }}
196+
{{include "cozystack.platform.package.default" (list $ipamName $) }}
197+
{{- end }}
198+
{{- if $proxmoxEnabled }}
199+
{{include "cozystack.platform.package.default" (list $proxmoxName $) }}
200+
{{- end }}
166201
{{include "cozystack.platform.package" (list "cozystack.kubernetes-application" "kubevirt" $) }}
167202
{{include "cozystack.platform.package" (list "cozystack.kubernetes-nodes-application" "kubevirt" $) }}
168203
{{include "cozystack.platform.package" (list "cozystack.computeplane-application" "kubevirt" $) }}
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
suite: bundles.iaas proxmox substrate wiring
2+
# capmox is opt-in where the KubeVirt infra provider is not: it drives a
3+
# hypervisor outside this cluster and does nothing without a Proxmox API token.
4+
# What is pinned here is that opting in is enough — the IPAM provider it cannot
5+
# work without comes along — and that opting in halfway stops the render instead
6+
# of shipping a provider that silently reconciles nothing.
7+
templates:
8+
- templates/bundles/iaas.yaml
9+
release:
10+
name: cozystack
11+
namespace: cozy-system
12+
tests:
13+
- it: ships neither package by default
14+
set:
15+
bundles:
16+
system:
17+
enabled: true
18+
variant: isp-full
19+
iaas:
20+
enabled: true
21+
enabledPackages: []
22+
asserts:
23+
- containsDocument:
24+
apiVersion: cozystack.io/v1alpha1
25+
kind: Package
26+
name: cozystack.capi-provider-infra-proxmox
27+
not: true
28+
- containsDocument:
29+
apiVersion: cozystack.io/v1alpha1
30+
kind: Package
31+
name: cozystack.capi-provider-ipam-in-cluster
32+
not: true
33+
# The KubeVirt provider stays unconditional — this wiring must not have
34+
# made the default substrate opt-in by accident.
35+
- containsDocument:
36+
apiVersion: cozystack.io/v1alpha1
37+
kind: Package
38+
name: cozystack.capi-provider-infra-kubevirt
39+
any: true
40+
41+
- it: pulls in the IPAM provider when capmox is enabled
42+
set:
43+
bundles:
44+
system:
45+
enabled: true
46+
variant: isp-full
47+
iaas:
48+
enabled: true
49+
enabledPackages:
50+
- cozystack.capi-provider-infra-proxmox
51+
asserts:
52+
- containsDocument:
53+
apiVersion: cozystack.io/v1alpha1
54+
kind: Package
55+
name: cozystack.capi-provider-infra-proxmox
56+
any: true
57+
- containsDocument:
58+
apiVersion: cozystack.io/v1alpha1
59+
kind: Package
60+
name: cozystack.capi-provider-ipam-in-cluster
61+
any: true
62+
63+
- it: emits the IPAM provider on its own, without dragging capmox in
64+
set:
65+
bundles:
66+
system:
67+
enabled: true
68+
variant: isp-full
69+
iaas:
70+
enabled: true
71+
enabledPackages:
72+
- cozystack.capi-provider-ipam-in-cluster
73+
asserts:
74+
- containsDocument:
75+
apiVersion: cozystack.io/v1alpha1
76+
kind: Package
77+
name: cozystack.capi-provider-ipam-in-cluster
78+
any: true
79+
- containsDocument:
80+
apiVersion: cozystack.io/v1alpha1
81+
kind: Package
82+
name: cozystack.capi-provider-infra-proxmox
83+
not: true
84+
85+
- it: emits neither when capmox is enabled and disabled at once
86+
set:
87+
bundles:
88+
system:
89+
enabled: true
90+
variant: isp-full
91+
iaas:
92+
enabled: true
93+
enabledPackages:
94+
- cozystack.capi-provider-infra-proxmox
95+
disabledPackages:
96+
- cozystack.capi-provider-infra-proxmox
97+
asserts:
98+
- containsDocument:
99+
apiVersion: cozystack.io/v1alpha1
100+
kind: Package
101+
name: cozystack.capi-provider-infra-proxmox
102+
not: true
103+
- containsDocument:
104+
apiVersion: cozystack.io/v1alpha1
105+
kind: Package
106+
name: cozystack.capi-provider-ipam-in-cluster
107+
not: true
108+
109+
- it: refuses to ship capmox with its IPAM provider disabled
110+
set:
111+
bundles:
112+
system:
113+
enabled: true
114+
variant: isp-full
115+
iaas:
116+
enabled: true
117+
enabledPackages:
118+
- cozystack.capi-provider-infra-proxmox
119+
disabledPackages:
120+
- cozystack.capi-provider-ipam-in-cluster
121+
asserts:
122+
- failedTemplate:
123+
errorMessage: "cozystack.capi-provider-infra-proxmox requires cozystack.capi-provider-ipam-in-cluster, which is listed in bundles.disabledPackages: capmox allocates worker addresses from an InClusterIPPool and has no DHCP mode, so without the IPAM provider no ProxmoxCluster ever becomes Ready"

‎packages/core/platform/values.yaml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ bundles:
5656
naas:
5757
enabled: false
5858
disabledPackages: []
59+
# Packages the platform ships but does not deploy unless named here. Two of
60+
# them belong to the Proxmox substrate, where worker VMs run on an external
61+
# hypervisor instead of on KubeVirt in this cluster:
62+
#
63+
# cozystack.capi-provider-infra-proxmox
64+
# capmox, the Cluster API infrastructure provider for Proxmox VE. Needs a
65+
# capmox-config Secret with a Proxmox API token before it can do anything;
66+
# enabling it pulls in the IPAM provider below automatically.
67+
# cozystack.capi-provider-ipam-in-cluster
68+
# Cluster API in-cluster IPAM. Required by capmox, which assigns static
69+
# addresses and has no DHCP mode. Listed separately because it is a
70+
# generic addon, not a Proxmox one.
71+
#
72+
# Both are emitted by the iaas bundle. disabledPackages still wins over this
73+
# list, except that disabling IPAM while capmox is enabled stops the render
74+
# rather than shipping a provider that cannot reconcile.
5975
enabledPackages: []
6076
# Network configuration
6177
networking:

0 commit comments

Comments
 (0)