Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade ipam to 0.1.0 and capi to 1.6.3 #138

Merged
merged 8 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 *IPConfigSpec `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 *IPConfigSpec `json:"ipv6Config,omitempty"`

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

// IPConfigSpec defines the desired state of IP Pool.
mcbenjemaa marked this conversation as resolved.
Show resolved Hide resolved
type IPConfigSpec 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
6 changes: 3 additions & 3 deletions api/v1alpha1/proxmoxcluster_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func defaultCluster() *ProxmoxCluster {
Namespace: metav1.NamespaceDefault,
},
Spec: ProxmoxClusterSpec{
IPv4Config: &ipamicv1.InClusterIPPoolSpec{
IPv4Config: &IPConfigSpec{
Addresses: []string{"10.0.0.0/24"},
Prefix: 24,
},
Expand Down Expand Up @@ -132,7 +132,7 @@ var _ = Describe("ProxmoxCluster Test", func() {
Context("IPV6Config", func() {
It("Should not allow empty addresses", func() {
dc := defaultCluster()
dc.Spec.IPv6Config = &ipamicv1.InClusterIPPoolSpec{
dc.Spec.IPv6Config = &IPConfigSpec{
Addresses: []string{},
Prefix: 0,
Gateway: "",
Expand All @@ -142,7 +142,7 @@ var _ = Describe("ProxmoxCluster Test", func() {

It("Should not allow prefix higher than 128", func() {
dc := defaultCluster()
dc.Spec.IPv6Config = &ipamicv1.InClusterIPPoolSpec{
dc.Spec.IPv6Config = &IPConfigSpec{
Addresses: []string{},
Prefix: 129,
Gateway: "",
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.

60 changes: 31 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ module github.com/ionos-cloud/cluster-api-provider-proxmox

go 1.21

replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.6.1
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.6.3

replace github.com/google/cel-go => github.com/google/cel-go v0.17.8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this to fix the circular dependency caused by the k8s api v1.29


require (
github.com/go-logr/logr v1.4.1
Expand All @@ -16,29 +18,29 @@ require (
github.com/stretchr/testify v1.9.0
go4.org/netipx v0.0.0-20230303233057-f1b76eb4bb35
golang.org/x/tools v0.18.0
k8s.io/api v0.29.2
k8s.io/apimachinery v0.29.2
k8s.io/client-go v0.29.2
k8s.io/api v0.29.3
k8s.io/apimachinery v0.29.3
k8s.io/client-go v0.29.3
k8s.io/klog/v2 v2.120.1
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/cluster-api v1.6.1
sigs.k8s.io/cluster-api-ipam-provider-in-cluster v0.1.0-alpha.3
sigs.k8s.io/cluster-api/test v1.6.2
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
sigs.k8s.io/cluster-api v1.6.3
sigs.k8s.io/cluster-api-ipam-provider-in-cluster v0.1.0
sigs.k8s.io/cluster-api/test v1.6.3
sigs.k8s.io/controller-runtime v0.17.2
)

require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/buger/goterm v1.0.4 // indirect
Expand All @@ -53,19 +55,19 @@ require (
github.com/docker/go-units v0.4.0 // indirect
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/swag v0.22.7 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobuffalo/flect v1.0.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/cel-go v0.17.7 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.18.2 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-github/v53 v53.2.0 // indirect
Expand All @@ -75,8 +77,8 @@ require (
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jinzhu/copier v0.3.4 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down Expand Up @@ -106,29 +108,29 @@ require (
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/viper v1.17.0 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/valyala/fastjson v1.6.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.14.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/time v0.5.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/djherbis/times.v1 v1.2.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand All @@ -137,9 +139,9 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.29.0 // indirect
k8s.io/apiserver v0.29.0 // indirect
k8s.io/cluster-bootstrap v0.28.4 // indirect
k8s.io/component-base v0.29.0 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/cluster-bootstrap v0.29.2 // indirect
k8s.io/component-base v0.29.2 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kind v0.20.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
Expand Down
Loading