48 Commits

Author SHA1 Message Date
mightykhan
94a5ae243c MINOR: Remove duplicate rules to avoid validation warning when applying (#559)
* MINOR: Remove duplicate rules to avoid validation warning when applying

* optional fix for duplicate validation rule

* +optional validation should not be on type level, but field

---------

Co-authored-by: Kenneth Holm Seelig <xkhse@energinet.dk>
2025-10-24 17:39:56 +02:00
Lukas Kirylak
679ebc101d Add support for linked clones (#478) 2025-05-09 13:36:00 +00: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
bed7ddfbd4 fix: add tag validation to MatchTags (#410)
this fixes a small oversight in #343 and actually validates the individual tags against what is accepted by the API

https://github.com/proxmox/pve-common/blob/master/src/PVE/JSONSchema.pm#L706

```
our $PVE_TAG_RE = qr/[a-z0-9_][a-z0-9_\-\+\.]*/i;
```
2025-02-12 14:02:36 +00: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
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
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
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
Vic Kerr
e585c6d89a Bump go to 1.22
Plus relevant dependency updates.

fix #187
2024-08-20 10:27:56 +00:00
Mohamed Chiheb Ben Jemaa
4821298e4a USe cluster namespace if no namespace provided in credentials Ref (#248)
* USe cluster namespace if no namespace provided in credentials Ref

* Add note regarding secret Ref namespace
2024-06-26 11:06:27 +00: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
Mohamed Chiheb Ben Jemaa
74cf293378 🔥 Add external credentials (#215) 2024-06-03 16:39:53 +02: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)
22bcd1f576 bootstrap_test: testcases for getCommonInterfaceConfig 2024-04-16 14:25:20 +00:00
Felix Wischke (65278)
b0e8cb2c1d api/v1alpha1/proxmoxmachine_types: fix comment grammar 2024-04-16 14:25:20 +00:00
Felix Wischke (65278)
9cb60ac7ec unify FIB spelling 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)
a8ed5bbdae cluster-class: gofmt/lint 2024-04-16 12:40:35 +00:00
Vic Kerr
cb5cf9ba44 correct copyright years 2024-04-16 12:40:35 +00:00
Felix Wischke (65278)
b35a8b2bc9 clusterClass: add loadbalancers 2024-04-16 12:40:35 +00:00
Felix Wischke (65278)
964085d481 config/crd/kustomization.yaml: add proxmoxclustertemplates 2024-04-16 12:40:35 +00:00
Felix Wischke (65278)
cc023ad511 proxmoclustertemplate_types: port to capi 1.6 2024-04-16 12:40:35 +00:00
Felix Wischke (65278)
594a469f28 clusterClass: add no-cni and calico 2024-04-16 12:40:35 +00:00
Felix Wischke (65278)
17d5bd189c clusterClass: rework cluster to hold proxmox machine data 2024-04-16 12:40:35 +00:00
Felix Wischke (65278)
ce60cfc894 cluster-class-cilium: initial commit 2024-04-16 12:40:35 +00:00
Mario Valderrama
cf7fcb5cc1 docs: Adjust CRD field comments (#167)
* docs: Adjust CRD field comments

* Fix wording
2024-04-08 07:32:36 +00:00
Mohamed Chiheb Ben Jemaa
d0640dd29a Upgrade ipam to 0.1.0 and capi to 1.6.3 (#138)
* Upgrade ipam to 0.1.0 and capi to 1.6.3

* Update

* Fix circular dependency

* remove ipam deps from api pkg

* Update e2e tests

* Fix deps

* Rename Type

* Update godoc
2024-03-21 15:07:28 +01:00
Nicolò Ciraci
7dbe6e4ad1 feat(vlan): Add vlan tag support for VM reconcile. (#133)
* feat(vlan): Add vlan tag support for VM reconcile.

This commit implement VLAN tag support when creating - or more in general reconciling - a ProxmoxMachine. This feature implements a new optional value in the ProxmoxMachine CRS, defined in the NetworkDevice type. The value is an integer, delimited in the range 1-4094.

Tests have been also implemented to prevent regression, and e2e tests have been conducted creating both cluster using the new property and without - to check past compat.

* test(vlan): Add more testing and fix validation

* fix(test-vlan): Fix regression in test caused by a typo

* misc: Add more entry to gitignore

* refactor: Removed unused validator and refactor variable name

* refactor: Refactor variable name
2024-03-20 11:28:34 +00:00
Vic Kerr
a31de6ca05 misc: update copyright dates for 2024 2024-02-20 15:31:54 +00:00
Felix Wischke
de5099dfe1 Add VRF device to support egress gateways (#62)
* Add VRF device support

* cluster-template-cilium-load-balancer: metallb based loadbalancer nodes

* LoadBalancerNodes: Documentation

* load-balancer-nodes: taint and toleration for metallb

* cluster-template-cilium-load-balancer: force ipvs/strictARP for metallb
2024-02-13 13:53:32 +01:00
Mohamed Chiheb Ben Jemaa
c729eb7048 Add unit tests (#78)
* Add tests

* Add Comment for webhook

* Add tests

* Add minmal test for proxmoxmachine controller

* Add comment for mtu

* Rephrase special case for MTU

---------

Co-authored-by: Mario Valderrama <mario.valderrama@ionos.com>
2024-01-25 15:25:13 +00:00
dependabot[bot]
0ea3ac1a8c Bump sigs.k8s.io/cluster-api from 1.5.0 to 1.6.1 (#18)
* Bump sigs.k8s.io/cluster-api from 1.5.0 to 1.6.0

Bumps [sigs.k8s.io/cluster-api](https://github.com/kubernetes-sigs/cluster-api) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/kubernetes-sigs/cluster-api/releases)
- [Commits](https://github.com/kubernetes-sigs/cluster-api/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/cluster-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Adjust code to capi 1.6 and k8s 1.28

* Update to v1.6.1

* Fix link

* Rollback metrics bind address

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mohamed Chiheb Ben Jemaa <mc.benjemaa@gmail.com>
2024-01-23 15:23:40 +00:00
Vic Kerr
a06fd4b48e fix: remove boilerplate.go.txt (#75)
The copyright status of autogenerated files is at best dubious.
The copyright year does not change just because the calendar year has changed.
The header will only cause problems every January.
2024-01-23 16:07:26 +01:00
Lucas Pape
e4a915b93e feat: implement setting mtu for virtio network device (#42)
* feat: implement setting mtu for virtio network device

See https://git.proxmox.com/?p=qemu-server.git;a=commit;h=61a14cde8d568e552d3deaab2da76b479b8aca7b

* fix: split extractNetworkModelAndBridge into multiple functions

* fix: set maximum mtu to 65520

* test: should not allow mtu less than 1 or more than 65520

* feat: add validating webhook for proxmoxmachine

* fix: remove default mtu
2024-01-08 16:38:41 +01:00
Philipp Born
ccbae163ba feat(scheduler): allow for node overprovisioning (#47)
`ProxmoxCluster.spec.SchedulerHints.MemoryAdjustment=300` allows to (theoretically) allocate 300% of a host's memory for VMs (use with caution - enabling memory ballooning highly recommended)
`ProxmoxCluster.spec.SchedulerHints.MemoryAdjustment=95` allows to limit memory allocation to 95% of a host's memory
`ProxmoxCluster.spec.SchedulerHints.MemoryAdjustment=0` entirely disables scheduling memory constraints
2023-12-21 15:49:15 +00:00
Vic Kerr
45f5888c41 Initial open source release
Co-authored-by: Felix Wischke <felix.wischke@ionos.com>
Co-authored-by: Jonas Bender <90411737+jonas-be@users.noreply.github.com>
Co-authored-by: Ludwig Bedacht <132355999+lubedacht@users.noreply.github.com>
Co-authored-by: Mario Valderrama <15158349+avorima@users.noreply.github.com>
Co-authored-by: Mohamed Chiheb Ben jemaa <mohamed-chiheb.ben-jemaa@ionos.com>
Co-authored-by: Vic Kerr <318870+wikkyk@users.noreply.github.com>
2023-11-29 14:17:03 +00:00