69 Commits

Author SHA1 Message Date
Mohamed Chiheb Ben Jemaa
9d389c200f Add missing RBAC for patching Cluster (#520) 2025-07-28 14:06:46 +02:00
Vic Kerr
2e63a10909 go: bump to 1.24 (#507)
* go: bump to 1.24

* Bump go to v1.24

* Bump dependecies

* Update e2e config

* Bump go-proxmox client to latest commit, Fixes tests, and linting

* Revert "Bump dependecies"

This reverts commit dbf1ff80ebafe4c263b61919123e547703faa7e8.

* Pin CAPI to v1.10.4 and update/fix e2e tests

* Fix unit tests

* Bump GO v1.24.5

---------

Co-authored-by: Mohamed Chiheb Ben Jemaa <mc.benjemaa@gmail.com>
2025-07-28 11:13:27 +00:00
Mohamed Chiheb Ben Jemaa
8d9280bf67 Fix the cluster failed state bug, by checking over the root cluster and patch it 2025-05-20 14:43:24 +01:00
Mohamed Chiheb Ben Jemaa
c2563bcee6 Improve the template and error logs 2025-03-25 12:38:43 +01:00
Vic Kerr
92ac7a597d update copyright 2025-03-13 16:52:28 +01:00
Mohamed Chiheb Ben Jemaa
b6635a09fa Add API spec for machine ip pool ref (#429)
* WIP: Add API spec for machine ip pool ref

* Adjusting code to comply with the new API

* Implement the logic for the IP Pool Ref for proxmoxmachines

* Make Default network required when setting network and add tests
2025-03-13 13:25:20 +00:00
Mohamed Chiheb Ben Jemaa
4fd0cb6c84 Add custom tags to machines (#158)
* Add custom tags to machines

* Add test cases

* Revive add tags

* Revive  tags

* Address reviews

* Remove default description

* Add kustomize when running e2e
2025-03-13 11:40:50 +00:00
Vic Kerr
de65752ea1 CAPI 1.9.5, k8s/* 0.31.6, controller-runtime 0.19.6, controller-gen 0.16.5 (#388)
* config/{crd,rbac}: regen
* bump github.com/google/cel-go to 0.20.1
* docs, e2e: bump kubernetes to 1.31.6
* */*.go: silence lint about cluster-api/errors and Failure{Message,Reason} deprecation
2025-03-12 14:39:57 +00:00
Mohamed Chiheb Ben Jemaa
74a599293b Add test for ScheduleVM (#423) 2025-02-24 13:23:31 +01:00
Philipp Born
604ae96879 feat: allow vmtemplate selection based on tags (#343)
* feat: allow template selection based on tags

* `sourceNode + templateID` and `templateSelector` are mutually exclusive
* automatically detects both `sourceNode` + `templateID`
* errors out if anything but one (1) VM template with desired flags was found

* revert webhook changes

* introduce TemplateSource

* comment on TemplateSource

* add testcase for VMTemplateNotFound

* add test for SourceNode, TemplateID and TemplateSelector being unset

* revert GetNode() changes

* remove redundant TemplateSelector check

* update TemplateSelector description

* introduce ErrTemplateNotFound error

* add FindVMTemplateByTags test-case with nil vmTags

* Update api/v1alpha1/proxmoxmachine_types_test.go

Co-authored-by: Vic Kerr <wiktor.kerr@ionos.com>

* make the linter happy

* Update proxmoxmachine_types.go

* Update advanced-setups.md

* Update proxmoxmachine_types.go

* refaormat

---------

Co-authored-by: Vic Kerr <wiktor.kerr@ionos.com>
Co-authored-by: Mohamed Chiheb Ben Jemaa <mc.benjemaa@gmail.com>
2025-02-05 16:25:17 +00:00
Vic Kerr
baa4acb9fd fix conditions.MarkFalse usage where error strings are passed as formats
Fixes "printf: non-constant format string in call to sigs.k8s.io/cluster-api/util/conditions.MarkFalse (govet)"
2025-02-05 12:24:38 +01:00
Mohamed Chiheb Ben Jemaa
7afed1ba3c 🌱 Refactoring: move NetworkConfigData out of cloudinit pkg (#378)
* Refactorring: move NetworkConfigData out of cloudinit pkg

* Copyright year

---------

Co-authored-by: Vic Kerr <wiktor.kerr@ionos.com>
2025-01-20 15:15:26 +00:00
Nicolai Rybnikar
9beeb31680 Split TestReconcileBootstrapData_Formats into CloudConfig and Ignition variants, add format to createBootstrapSecret helper function 2025-01-16 12:01:53 +00:00
Nicolai Rybnikar
e5c1dff417 Make ignitionISOInjector overridable (like isoInjector already is) to make it mockable for testing 2025-01-16 12:01:53 +00:00
Nicolai Rybnikar
00485cdf6e Add test TestReconcileBootstrapDataFormats 2025-01-16 12:01:53 +00:00
Nicolai Rybnikar
cab54fed4f Add kubernetes-version to metadata 2025-01-16 12:01:53 +00:00
Knut Ahlers
96eeffdf11 Add optional TLS certificate checking when talking to Proxmox (#336)
* Add optional TLS certificate checking when talking to Proxmox

* Fix: Define behavior for containers without RootCA store

* Fix: Allow all true-ish YAML values
2024-12-09 12:19:34 +00:00
Philipp Born
cf427570ab bootstrap: default to format=cloud-config (#355)
* bootstrap: default to `format=cloud-config`

Not every bootstrap provider sets the `format` key and i wasn't able to find any requirement for it in the capi contract.

With this change we default to cloud-config, as it was without this check, to restore functionality with other non-kubeadm bootstrap providers.

Takes care of cases where the CAPMOX controller errored out with
```
err="failed to reconcile VM: error retrieving format data: secret `format` key is missing"
```

* make the linter happy
2024-12-06 11:11:44 +01:00
Vic Kerr
690c13ee05 update copyright 2024-12-05 13:45:51 +01:00
Mohamed Chiheb Ben Jemaa
3f6355d0fd Add Option to control the injection of provider-id to metadata (#347)
* Add Option to control the injection of provider-id to metadata

* typo and more comment in the field
2024-12-05 12:52:24 +01:00
Mohamed Chiheb Ben Jemaa
acddc389ff Support Flatcar and provide ignition bootstrap data (#308)
* add metadata handling for proxmox node name

* First draft: flatcar and ignition support

* Revert "add metadata handling for proxmox node name"

This reverts commit 3dd5aae409a70da006e35c7130ca9ecc39fe73f0.

* Make The Ignition ISO able to be unmounted

* Fixes lints

* Fixes Tests

* remove unsed config and Fixes Test

* Set ipv6

* add tests

* add tests for injector

* more test coverage

* Fix lint

* Provide a correct cluster template

* Provide docs on how to provision cluster with flatcar

* Address reviews

* Update envtest

* Address reviwes and try e2e test with skip label

* Implement networkd config units with VRFs

* Tidy

* E2e test for flatcar

* Use correct template for flatcar

* Add more tests

* Simpler units name

* add comment for netdev index

* Address reviews

* remove uncessary variable

* Add note about EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION

* Address reviews

* Change ignition docs

* Remove quotes

* pkg/ignition/network.go: fix VRF routing rules policy table, add tests

---------

Co-authored-by: tuunit <jan@larwig.com>
Co-authored-by: Felix Wischke (65278) <felix@zeynix.de>
2024-12-05 12:12:11 +01:00
Nico
5f3ba2f72b feat: Add ability to specify range of VM IDs to use (#286)
* Return VMIDFreeErr or the error object itself if CheckID returns true/an error

* Rename VMIDFreeErr to ErrVMIDFree and fix comment to make linter happy

* feat: Add ability to specify range of VM IDs to use

* Fix codespell error: fix spelling

* When checking if a vmid is free, first check the existing ProxmoxMachines before querying the Proxmox API.

* Check that the vmid of the Proxmox machine is set (not -1) before adding it to usedVMIDs

* Move spec.vmidRange from ProxmoxCluster to ProxmoxMachine

* Update github.com/luthermonson/go-proxmox to v0.2.0

* Revert "Update github.com/luthermonson/go-proxmox to v0.2.0"

This reverts commit c5d15e56ef7c61ab884c3726e2e9707ba8038a27.

Because of this bug https://github.com/luthermonson/go-proxmox/pull/169

* Update github.com/luthermonson/go-proxmox to v0.2.1

* Add test for ClusterScope.ListProxmoxMachinesForCluster

* Fix wording in ProxmoxMachine types test

* Rename vmidRange to vmIDRange to follow k8s API conventions

* Add validation for vmIDRange: end should be greater than or equal to start

* Set failureMessage and failureReason when ErrNoVMIDInRangeFree is thrown

* Refactor getVMID to improve code quality

---------

Co-authored-by: Mohamed Chiheb Ben Jemaa <mc.benjemaa@gmail.com>
2024-12-05 09:58:23 +00:00
Vic Kerr
11692d339c webhook_suite_test: goimports 2024-11-12 11:52:49 +01:00
Vic Kerr
fbbec81a9b proxmoxcluster_webhook: goimports 2024-11-12 11:52:49 +01:00
Vic Kerr
b4d79c2a20 utils_test: goimports 2024-11-12 11:52:49 +01:00
Vic Kerr
2a33573014 power_test: goimports 2024-11-12 11:52:49 +01:00
Vic Kerr
cd9f628806 delete: goimports 2024-11-12 11:52:49 +01:00
Vic Kerr
646c1935ea vmscheduler: goimports 2024-11-12 11:52:49 +01:00
Vic Kerr
3dafc132e6 proxmoxmachine_controller: goimports 2024-11-12 11:52:49 +01:00
Vic Kerr
65fe60e82d internal/service/vmservice/bootstrap: more tests 2024-11-12 11:52:49 +01:00
Vic Kerr
3436c35d44 internal/service/taskservice/error: add test 2024-11-12 11:52:49 +01:00
Dario Tranchitella
c8cc3a4ce1 feat: support for externally managed control plane (#106)
* feat: support for externally managed control plane

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* proxmoxcluster_controller.go: check for nil ControlPlaneEnpoint

* gofmt -s

---------

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>
Co-authored-by: Vic Kerr <wiktor.kerr@ionos.com>
2024-11-04 15:27:55 +00:00
Mohamed Chiheb Ben Jemaa
a67b48d0e8 fix/cluster state failed reconcile (#317)
* Fix Cluster state failed when controller restarted with proper credentials

* Refactor the code
2024-10-31 12:51:06 +01:00
Endre Karlson
0d011ceb1c Support toggling provisioning checks (#290)
* Support toggling provisioning checks

Signed-off-by: ekarlso <endre.karlson@gmail.com>

* Generate descriptions

Signed-off-by: ekarlso <endre.karlson@gmail.com>

* Fix tests

Signed-off-by: ekarlso <endre.karlson@gmail.com>

---------

Signed-off-by: ekarlso <endre.karlson@gmail.com>
2024-10-13 14:56:40 +02:00
Erwin Kok
7d9b12bce9 Adding Finalizer on Secret (#279)
* Bumped some versions as the controller-gen crashed

* Added ProxmoxClusterTemplate properly

* Proper alignment //+kubebuilder, and provide annotatons as specified by spec

* Added concurrency to controllers. Added constructors to controllers

* Added capiflags

* metrics-bind-address is obsolete. Use diagnostics address

* Add finalizer on secret

* Cleanup to minimize differences

* Processing review feedback

* Processing feedback

* Update

* Processing feedback

* Fixing tests

* Update

* Delete capi cluster first

* Processing review feedback

* Renamed test context

* Processing review feedback: solve linting issues

---------

Co-authored-by: Mohamed Chiheb Ben Jemaa <mc.benjemaa@gmail.com>
2024-10-09 18:14:54 +00:00
Nico
1905624a0e Check if VM exists before deletion (#278) 2024-09-03 19:53:03 +02:00
Mohamed Chiheb Ben Jemaa
9bba25568b Fix CNI cluster templates (#264)
* Fix CNI cluster templates

* Add condition to skip webhook when network is not set
2024-08-21 13:07:37 +02:00
Felix Wischke
1d2a859e20 api/v1alpha1/proxmoxcluster_types: validate controlplane port (#241)
* api/v1alpha1/proxmoxcluster_types: validate controlplane port

* pkg/scope/cluster: remove unused clusterScope.ControlPlaneEndpoint (make coverage happy)

* api/v1alpha1/proxmoxcluster_types: add port 0 test

---------

Co-authored-by: Felix Wischke (65278) <felix@zeynix.de>
2024-06-26 10:45:39 +00:00
Felix Wischke (65278)
f34e4dac0c add metric annotation support to IPPool objects 2024-06-06 14:57:46 +00:00
Vic Kerr
43fe9fff17 misc: update copyright dates for 2024 2024-04-19 14:33:20 +00:00
Mohamed Chiheb Ben Jemaa
d8c09291f8 Check cloud-init status as part of machine provisioning (#166)
* Check cloud-init status and throw error state if cloud-init fails
2024-04-19 11:16:07 +00:00
Philipp Born
59ad710fe0 fix: allow FQDNs as controlPlaneEndpoint (#157)
* fix: allow FQDNs as controlPlaneEndpoint

* add testcases with plain ip4/ip6 endpoints
2024-04-17 09:04:48 +00:00
Felix Wischke (65278)
736a064997 proxmox_webhook: check routing policy tables (netplan lied more) 2024-04-16 14:25:20 +00:00
Felix Wischke (65278)
b7d130df26 proxmox_webhook_test: add LinkMTU test 2024-04-16 14:25:20 +00:00
Felix Wischke (65278)
22bcd1f576 bootstrap_test: testcases for getCommonInterfaceConfig 2024-04-16 14:25:20 +00:00
Felix Wischke (65278)
c575eaa0a5 api/v1alpha1/proxmoxmachine_types: netplan lied about common interface settings 2024-04-16 14:25:20 +00:00
Felix Wischke (65278)
e00c558ad7 api/v1alpha1/proxmoxmachine_types: introduce per linkMTU 2024-04-16 14:25:20 +00:00
Felix Wischke (65278)
14d30499b3 api/v1alpha/proxmoxmachine_types: refactor networking to share features 2024-04-16 14:25:20 +00:00
Felix Wischke (65278)
d4e607b0c6 proxmoxmachine_types: refactor AdditionalNetworkInterfaces 2024-04-16 14:25:20 +00:00
Felix Wischke (65278)
2579d8c709 proxmoxclustertemplate_controller: remove as it serves no function 2024-04-16 12:40:35 +00:00