Skip to content

Commit 18b83a7

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 needs a Secret holding a Proxmox API token, which capi-operator reads before it installs anything — with no Secret the provider is never deployed at all. Enabling it by default would ask every Cozystack install that has no Proxmox to supply hypervisor credentials. 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. The cluster would catch that combination on its own: the capmox PackageSource depends on the IPAM Package, so with that Package absent capmox goes Ready=False with DependenciesNotReady and no HelmRelease is ever created. What it would not do is say why. Failing the render names the two conflicting list entries at the moment someone writes them, instead of leaving a condition to decode later. The negated containsDocument asserts in the wiring suite carry `any: true`. Without it a negated containsDocument passes whether the document is in the render or not, so the two properties the suite exists for — off by default, and disabledPackages winning — could not fail. Signed-off-by: Marian Koreniuk <[email protected]> Assisted-by: LLM
1 parent 67db200 commit 18b83a7

3 files changed

Lines changed: 184 additions & 0 deletions

File tree

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,44 @@
218218
{{include "cozystack.platform.package.default" (list "cozystack.capi-provider-core" $) }}
219219
{{include "cozystack.platform.package.default" (list "cozystack.capi-provider-cp-kamaji" $) }}
220220
{{include "cozystack.platform.package.default" (list "cozystack.capi-provider-infra-kubevirt" $) }}
221+
{{- /*
222+
The Proxmox infrastructure provider is opt-in where the KubeVirt one is not,
223+
and the asymmetry is not a matter of taste. capmox talks to a hypervisor that
224+
lives outside this cluster, and it needs a capmox-config Secret holding a
225+
Proxmox API token: capi-operator reads that Secret before it installs
226+
anything, so with no Secret the provider is never deployed at all. Enabling
227+
this by default would ask every Cozystack install that has no Proxmox to
228+
supply hypervisor credentials.
229+
230+
Enable it by adding cozystack.capi-provider-infra-proxmox to
231+
bundles.enabledPackages. The in-cluster IPAM provider comes with it, for the
232+
reason written next to the dependsOn edge in
233+
sources/capi-provider-infra-proxmox.yaml. IPAM is also independently
234+
enableable — it is a generic Cluster API addon, useful to any provider that
235+
assigns rather than leases.
236+
*/ -}}
237+
{{- $proxmoxName := "cozystack.capi-provider-infra-proxmox" -}}
238+
{{- $ipamName := "cozystack.capi-provider-ipam-in-cluster" -}}
239+
{{- $pkgDisabled := default (list) .Values.bundles.disabledPackages -}}
240+
{{- $pkgEnabled := default (list) .Values.bundles.enabledPackages -}}
241+
{{- $proxmoxEnabled := and (has $proxmoxName $pkgEnabled) (not (has $proxmoxName $pkgDisabled)) -}}
242+
{{- /*
243+
Naming the pair in conflicting lists is the one case worth stopping for. The
244+
cluster catches it on its own: the capmox PackageSource depends on the IPAM
245+
Package, so with that Package absent the capmox one goes Ready=False with
246+
DependenciesNotReady and no HelmRelease is created. What it does not do is
247+
say why. Failing the render names the two list entries that conflict, at the
248+
moment someone writes them, instead of leaving a condition to decode later.
249+
*/ -}}
250+
{{- if and $proxmoxEnabled (has $ipamName $pkgDisabled) -}}
251+
{{- 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) -}}
252+
{{- end -}}
253+
{{- if or $proxmoxEnabled (has $ipamName $pkgEnabled) }}
254+
{{include "cozystack.platform.package.default" (list $ipamName $) }}
255+
{{- end }}
256+
{{- if $proxmoxEnabled }}
257+
{{include "cozystack.platform.package.default" (list $proxmoxName $) }}
258+
{{- end }}
221259
{{include "cozystack.platform.package" (list "cozystack.kubernetes-application" "kubevirt" $) }}
222260
{{include "cozystack.platform.package" (list "cozystack.kubernetes-nodes-application" "kubevirt" $) }}
223261
{{include "cozystack.platform.package" (list "cozystack.computeplane-application" "kubevirt" $) }}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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 parking a Package at Ready=False with DependenciesNotReady and no message
7+
# naming the two list entries that conflict.
8+
templates:
9+
- templates/bundles/iaas.yaml
10+
release:
11+
name: cozystack
12+
namespace: cozy-system
13+
tests:
14+
- it: ships neither package by default
15+
set:
16+
bundles:
17+
system:
18+
enabled: true
19+
variant: isp-full
20+
iaas:
21+
enabled: true
22+
enabledPackages: []
23+
asserts:
24+
- containsDocument:
25+
apiVersion: cozystack.io/v1alpha1
26+
kind: Package
27+
name: cozystack.capi-provider-infra-proxmox
28+
any: true
29+
not: true
30+
- containsDocument:
31+
apiVersion: cozystack.io/v1alpha1
32+
kind: Package
33+
name: cozystack.capi-provider-ipam-in-cluster
34+
any: true
35+
not: true
36+
# The KubeVirt provider stays unconditional — this wiring must not have
37+
# made the default substrate opt-in by accident.
38+
- containsDocument:
39+
apiVersion: cozystack.io/v1alpha1
40+
kind: Package
41+
name: cozystack.capi-provider-infra-kubevirt
42+
any: true
43+
44+
- it: pulls in the IPAM provider when capmox is enabled
45+
set:
46+
bundles:
47+
system:
48+
enabled: true
49+
variant: isp-full
50+
iaas:
51+
enabled: true
52+
enabledPackages:
53+
- cozystack.capi-provider-infra-proxmox
54+
asserts:
55+
- containsDocument:
56+
apiVersion: cozystack.io/v1alpha1
57+
kind: Package
58+
name: cozystack.capi-provider-infra-proxmox
59+
any: true
60+
- containsDocument:
61+
apiVersion: cozystack.io/v1alpha1
62+
kind: Package
63+
name: cozystack.capi-provider-ipam-in-cluster
64+
any: true
65+
66+
- it: emits the IPAM provider on its own, without dragging capmox in
67+
set:
68+
bundles:
69+
system:
70+
enabled: true
71+
variant: isp-full
72+
iaas:
73+
enabled: true
74+
enabledPackages:
75+
- cozystack.capi-provider-ipam-in-cluster
76+
asserts:
77+
- containsDocument:
78+
apiVersion: cozystack.io/v1alpha1
79+
kind: Package
80+
name: cozystack.capi-provider-ipam-in-cluster
81+
any: true
82+
- containsDocument:
83+
apiVersion: cozystack.io/v1alpha1
84+
kind: Package
85+
name: cozystack.capi-provider-infra-proxmox
86+
any: true
87+
not: true
88+
89+
- it: emits neither when capmox is enabled and disabled at once
90+
set:
91+
bundles:
92+
system:
93+
enabled: true
94+
variant: isp-full
95+
iaas:
96+
enabled: true
97+
enabledPackages:
98+
- cozystack.capi-provider-infra-proxmox
99+
disabledPackages:
100+
- cozystack.capi-provider-infra-proxmox
101+
asserts:
102+
- containsDocument:
103+
apiVersion: cozystack.io/v1alpha1
104+
kind: Package
105+
name: cozystack.capi-provider-infra-proxmox
106+
any: true
107+
not: true
108+
- containsDocument:
109+
apiVersion: cozystack.io/v1alpha1
110+
kind: Package
111+
name: cozystack.capi-provider-ipam-in-cluster
112+
any: true
113+
not: true
114+
115+
- it: refuses to ship capmox with its IPAM provider disabled
116+
set:
117+
bundles:
118+
system:
119+
enabled: true
120+
variant: isp-full
121+
iaas:
122+
enabled: true
123+
enabledPackages:
124+
- cozystack.capi-provider-infra-proxmox
125+
disabledPackages:
126+
- cozystack.capi-provider-ipam-in-cluster
127+
asserts:
128+
- failedTemplate:
129+
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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,23 @@ bundles:
6363
naas:
6464
enabled: false
6565
disabledPackages: []
66+
# Packages the platform ships but does not deploy unless named here. Two of
67+
# them belong to the Proxmox substrate, where worker VMs run on an external
68+
# hypervisor instead of on KubeVirt in this cluster:
69+
#
70+
# cozystack.capi-provider-infra-proxmox
71+
# capmox, the Cluster API infrastructure provider for Proxmox VE. Needs a
72+
# capmox-config Secret with a Proxmox API token before it can do anything;
73+
# enabling it pulls in the IPAM provider below automatically.
74+
# cozystack.capi-provider-ipam-in-cluster
75+
# Cluster API in-cluster IPAM. Required by capmox, which assigns static
76+
# addresses and has no DHCP mode. Listed separately because it is a
77+
# generic addon, not a Proxmox one.
78+
#
79+
# Both are emitted by the iaas bundle. disabledPackages still wins over this
80+
# list, except that disabling IPAM while capmox is enabled stops the render:
81+
# the cluster would only park capmox at Ready=False with DependenciesNotReady,
82+
# and nothing there would name the two list entries that conflict.
6683
enabledPackages: []
6784
# Network configuration
6885
networking:

0 commit comments

Comments
 (0)