Skip to content

Commit 9d10713

Browse files
committed
feat(cluster-api): add Proxmox infrastructure provider package
Packages ionos-cloud/cluster-api-provider-proxmox (capmox) the same way capi-providers-infraprovider packages CAPK: vendored components gzipped into a ConfigMap, an InfrastructureProvider that fetches them by label. Two details differ from the KubeVirt package on purpose. The fetchConfig label is `infraprovider-provider: proxmox`, not the shared `infraprovider-components: cozy`. A shared label would put both providers in one match. capi-operator would still install the right one — it keys every matched ConfigMap by its name as the version and takes the one equal to spec.version — but it builds that repository in a single pass and returns an error for the whole list as soon as one match is malformed: a name that does not parse as semver, or missing metadata. Sharing the label would let a broken ConfigMap belonging to one provider stop the other from being installed. The bootstrap packages already separate on a `bootstrap-provider` key; this follows that. components.gz is produced with `gzip -n`. Without it the header carries a timestamp, so regenerating from identical input yields a different blob and the committed artifact appears to change when nothing has. `make components` records the version pin, the source URLs and the flag, so refreshing the vendored manifests is reproducible rather than remembered. Pinned to the v0.7 series: from v0.8 capmox declares the v1beta2 Cluster API contract, while capi-providers-core here is v1.10.1, which serves v1beta1. The package source depends on the in-cluster IPAM provider and deliberately not on cozystack.kubevirt: the KubeVirt provider needs it because its VMs run inside this cluster, whereas a Proxmox hypervisor is external and reached over its API with the credentials named by `credentialsSecretName`. That Secret is a precondition rather than an optional extra, and the chart does not create it — a hypervisor token belongs to the platform's secret management, not to a Helm release. capi-operator reads the Secret before it installs the provider, so while it is missing nothing is deployed at all. values.yaml carries what an operator needs at that point: the /api2/json suffix PROXMOX_URL must have, the full user@realm!tokenid form of PROXMOX_TOKEN, and the fact that a rotated token reaches the manager only after the next provider reconcile and a restart of its pod. Both edges are asserted in tests/sources_capi_provider_proxmox_test.yaml; losing the IPAM edge reproduces a failure mode whose symptom points nowhere near its cause. Signed-off-by: Marian Koreniuk <[email protected]> Assisted-by: LLM
1 parent 5063a5a commit 9d10713

11 files changed

Lines changed: 4281 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
apiVersion: cozystack.io/v1alpha1
3+
kind: PackageSource
4+
metadata:
5+
name: cozystack.capi-provider-infra-proxmox
6+
spec:
7+
sourceRef:
8+
kind: OCIRepository
9+
name: cozystack-packages
10+
namespace: cozy-system
11+
path: /
12+
variants:
13+
# The kubevirt infra provider depends on cozystack.kubevirt because its VMs run
14+
# inside this cluster. The proxmox one has no such edge: the hypervisor is
15+
# external, reached over the Proxmox API with the credentials in the package's
16+
# credentialsSecretName. What it does need is the IPAM provider — capmox
17+
# allocates static addresses from an InClusterIPPool rather than using DHCP,
18+
# so without it ProxmoxCluster never reaches Ready.
19+
- name: default
20+
dependsOn:
21+
- cozystack.networking
22+
- cozystack.capi-operator
23+
- cozystack.capi-provider-ipam-in-cluster
24+
components:
25+
- name: capi-providers-infraprovider-proxmox
26+
path: system/capi-providers-infraprovider-proxmox
27+
install:
28+
privileged: true
29+
namespace: cozy-cluster-api
30+
releaseName: capi-providers-infraprovider-proxmox
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
suite: proxmox infrastructure provider and its IPAM dependency
2+
# Two edges here are easy to get wrong and expensive when wrong, so they are
3+
# asserted rather than left to review.
4+
#
5+
# 1. The proxmox provider depends on the in-cluster IPAM provider — the reason
6+
# is written next to that edge in sources/capi-provider-infra-proxmox.yaml.
7+
#
8+
# 2. The proxmox provider must NOT depend on cozystack.kubevirt. The kubevirt
9+
# infra provider does, because its VMs run inside this cluster; the Proxmox
10+
# hypervisor is external and reached over its API.
11+
templates:
12+
- templates/sources.yaml
13+
release:
14+
name: cozystack
15+
namespace: cozy-system
16+
tests:
17+
- it: makes the proxmox provider depend on IPAM, the operator and networking
18+
documentSelector:
19+
path: metadata.name
20+
value: cozystack.capi-provider-infra-proxmox
21+
asserts:
22+
- equal:
23+
path: spec.variants[0].name
24+
value: default
25+
- contains:
26+
path: spec.variants[0].dependsOn
27+
content: cozystack.capi-provider-ipam-in-cluster
28+
- contains:
29+
path: spec.variants[0].dependsOn
30+
content: cozystack.capi-operator
31+
- contains:
32+
path: spec.variants[0].dependsOn
33+
content: cozystack.networking
34+
- notContains:
35+
path: spec.variants[0].dependsOn
36+
content: cozystack.kubevirt
37+
- contains:
38+
path: spec.variants[0].components
39+
content:
40+
name: capi-providers-infraprovider-proxmox
41+
path: system/capi-providers-infraprovider-proxmox
42+
install:
43+
privileged: true
44+
namespace: cozy-cluster-api
45+
releaseName: capi-providers-infraprovider-proxmox
46+
47+
- it: keeps the IPAM provider generic, with no edge back to proxmox
48+
documentSelector:
49+
path: metadata.name
50+
value: cozystack.capi-provider-ipam-in-cluster
51+
asserts:
52+
- equal:
53+
path: spec.variants[0].name
54+
value: default
55+
- contains:
56+
path: spec.variants[0].dependsOn
57+
content: cozystack.capi-operator
58+
- notContains:
59+
path: spec.variants[0].dependsOn
60+
content: cozystack.capi-provider-infra-proxmox
61+
- contains:
62+
path: spec.variants[0].components
63+
content:
64+
name: capi-providers-ipam-in-cluster
65+
path: system/capi-providers-ipam-in-cluster
66+
install:
67+
privileged: true
68+
namespace: cozy-cluster-api
69+
releaseName: capi-providers-ipam-in-cluster
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
files/*-components.yaml
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apiVersion: v2
2+
name: cozy-capi-providers-infraprovider-proxmox
3+
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export NAME=capi-providers-infraprovider-proxmox
2+
export NAMESPACE=cozy-cluster-api
3+
4+
CAPMOX_VERSION=v0.7.7
5+
CAPMOX_URL=https://github.com/ionos-cloud/cluster-api-provider-proxmox/releases/download/$(CAPMOX_VERSION)
6+
7+
include ../../../hack/package.mk
8+
9+
# Refresh the vendored provider manifests. Bump CAPMOX_VERSION, run this, and
10+
# update the version in templates/{configmaps,providers}.yaml to match.
11+
#
12+
# gzip -n matters: without it the header carries a timestamp, so every
13+
# regeneration produces a different blob for identical input and the committed
14+
# artifact looks changed when it is not.
15+
.PHONY: components
16+
components:
17+
curl -fL -o files/infrastructure-components.yaml $(CAPMOX_URL)/infrastructure-components.yaml
18+
curl -fL -o files/metadata.yaml $(CAPMOX_URL)/metadata.yaml
19+
gzip -9 -n -c files/infrastructure-components.yaml > files/components.gz
Binary file not shown.

0 commit comments

Comments
 (0)