Skip to content

Commit

Permalink
Remove ipam dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbenjemaa committed Mar 20, 2024
1 parent cd6280b commit 9388f67
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 35 deletions.
26 changes: 20 additions & 6 deletions api/v1alpha1/proxmoxcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"

"k8s.io/utils/ptr"
ipamicv1 "sigs.k8s.io/cluster-api-ipam-provider-in-cluster/api/v1alpha2"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

const (
Expand Down Expand Up @@ -55,20 +54,35 @@ type ProxmoxClusterSpec struct {
// either IPv4Config or IPv6Config must be provided.
// +optional
// +kubebuilder:validation:XValidation:rule="self.addresses.size() > 0",message="IPv4Config addresses must be provided"
IPv4Config *ipamicv1.InClusterIPPoolSpec `json:"ipv4Config,omitempty"`
IPv4Config *IPPoolSpec `json:"ipv4Config,omitempty"`

// IPv6Config contains information about available IPV6 address pools and the gateway.
// this can be combined with ipv4Config in order to enable dual stack.
// either IPv4Config or IPv6Config must be provided.
// +optional
// +kubebuilder:validation:XValidation:rule="self.addresses.size() > 0",message="IPv6Config addresses must be provided"
IPv6Config *ipamicv1.InClusterIPPoolSpec `json:"ipv6Config,omitempty"`
IPv6Config *IPPoolSpec `json:"ipv6Config,omitempty"`

// DNSServers contains information about nameservers used by machines network-config.
// +kubebuilder:validation:MinItems=1
DNSServers []string `json:"dnsServers"`
}

// IPPoolSpec defines the desired state of IP Pool.
type IPPoolSpec struct {
// Addresses is a list of IP addresses that can be assigned. This set of
// addresses can be non-contiguous.
Addresses []string `json:"addresses"`

// Prefix is the network prefix to use.
// +kubebuilder:validation:Maximum=128
Prefix int `json:"prefix"`

// Gateway
// +optional
Gateway string `json:"gateway,omitempty"`
}

// SchedulerHints allows to pass the scheduler instructions to (dis)allow over- or enforce underprovisioning of resources.
type SchedulerHints struct {
// MemoryAdjustment allows to adjust a node's memory by a given percentage.
Expand Down Expand Up @@ -172,7 +186,7 @@ func (c *ProxmoxCluster) SetConditions(conditions clusterv1.Conditions) {

// SetInClusterIPPoolRef will set the reference to the provided InClusterIPPool.
// If nil was provided, the status field will be cleared.
func (c *ProxmoxCluster) SetInClusterIPPoolRef(pool *ipamicv1.InClusterIPPool) {
func (c *ProxmoxCluster) SetInClusterIPPoolRef(pool client.Object) {
if pool == nil || pool.GetName() == "" {
c.Status.InClusterIPPoolRef = nil
return
Expand Down
25 changes: 22 additions & 3 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,6 @@ spec:
items:
type: string
type: array
allocateReservedIPAddresses:
description: AllocateReservedIPAddresses causes the provider to
allocate the network address (the first address in the inferred
subnet) and broadcast address (the last address in the inferred
subnet) when IPv4. The provider will allocate the anycast address
address (the first address in the inferred subnet) when IPv6.
type: boolean
excludedAddresses:
description: ExcludedAddresses is a list of IP addresses, which
will be excluded from the set of assignable IP addresses.
items:
type: string
type: array
gateway:
description: Gateway
type: string
Expand All @@ -130,19 +117,6 @@ spec:
items:
type: string
type: array
allocateReservedIPAddresses:
description: AllocateReservedIPAddresses causes the provider to
allocate the network address (the first address in the inferred
subnet) and broadcast address (the last address in the inferred
subnet) when IPv4. The provider will allocate the anycast address
address (the first address in the inferred subnet) when IPv6.
type: boolean
excludedAddresses:
description: ExcludedAddresses is a list of IP addresses, which
will be excluded from the set of assignable IP addresses.
items:
type: string
type: array
gateway:
description: Gateway
type: string
Expand Down

0 comments on commit 9388f67

Please sign in to comment.