Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
20 changes: 16 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,26 @@ linters:
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
# CAPI
- pkg: sigs.k8s.io/cluster-api/api/v1beta1
- pkg: sigs.k8s.io/cluster-api/api/core/v1beta2
alias: clusterv1
# CAPI exp
- pkg: sigs.k8s.io/cluster-api/exp/api/v1beta1
alias: expv1
- pkg: sigs.k8s.io/cluster-api/api/core/v1beta1
alias: clusterv1beta1
- pkg: sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions
alias: v1beta1conditions
- pkg: sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions/v1beta2
alias: v1beta2conditions
- pkg: sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch
alias: v1beta1patch
# CAPBK
- pkg: sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2
alias: bootstrapv1
- pkg: sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta1
alias: bootstrapv1beta1
# CAPZ
- pkg: sigs.k8s.io/cluster-api-provider-azure/api/v1beta1
alias: infrav1
- pkg: sigs.k8s.io/cluster-api-provider-azure/util/v1beta1
alias: clusterv1beta1util
# CAPZ exp
- pkg: sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1
alias: infrav1exp
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export GOPROXY
export GO111MODULE=on

# Kubebuilder.
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.32.0
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.34.0
export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT ?= 60s
export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT ?= 60s

Expand Down Expand Up @@ -70,11 +70,11 @@ ifneq ($(abspath $(ROOT_DIR)),$(GOPATH)/src/sigs.k8s.io/cluster-api-provider-azu
endif

# Binaries.
CONTROLLER_GEN_VER := v0.16.1
CONTROLLER_GEN_VER := v0.18.0
CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)

CONVERSION_GEN_VER := v0.31.0
CONVERSION_GEN_VER := v0.33.0
CONVERSION_GEN_BIN := conversion-gen
CONVERSION_GEN := $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN)-$(CONVERSION_GEN_VER)

Expand Down Expand Up @@ -142,7 +142,7 @@ CODESPELL_BIN := codespell
CODESPELL_DIST_DIR := codespell_dist
CODESPELL := $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/$(CODESPELL_BIN)

SETUP_ENVTEST_VER := release-0.19
SETUP_ENVTEST_VER := release-0.21
SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest
Expand Down Expand Up @@ -358,7 +358,7 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL) $(KIND) ## Create
./hack/create-custom-cloud-provider-config.sh

# Deploy CAPI
timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.10.7/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"
timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.11.2/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"

# Deploy CAAPH
timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm/releases/download/v0.4.1/addon-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"
Expand Down
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ settings = {
"deploy_cert_manager": True,
"preload_images_for_kind": True,
"kind_cluster_name": "capz",
"capi_version": "v1.10.7",
"capi_version": "v1.11.2",
"caaph_version": "v0.4.1",
"cert_manager_version": "v1.19.1",
"kubernetes_version": "v1.32.2",
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/azureasomanagedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
)

const (
Expand All @@ -38,7 +38,7 @@ type AzureASOManagedClusterSpec struct {
// Because this field is programmatically set by CAPZ after resource creation, we define it as +optional
// in the API schema to permit resource admission.
//+optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
}

// AzureASOManagedClusterStatus defines the observed state of AzureASOManagedCluster.
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/azureasomanagedcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
)

// AzureASOManagedControlPlaneKind is the kind for AzureASOManagedControlPlane.
Expand Down Expand Up @@ -51,7 +51,7 @@ type AzureASOManagedControlPlaneStatus struct {

// ControlPlaneEndpoint represents the endpoint for the cluster's API server.
//+optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
}

//+kubebuilder:object:root=true
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/azureasomanagedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
)

const (
Expand All @@ -38,7 +38,7 @@ type AzureASOManagedClusterSpec struct {
// Because this field is programmatically set by CAPZ after resource creation, we define it as +optional
// in the API schema to permit resource admission.
//+optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
}

// AzureASOManagedClusterStatus defines the observed state of AzureASOManagedCluster.
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/azureasomanagedcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
)

// AzureASOManagedControlPlaneKind is the kind for AzureASOManagedControlPlane.
Expand Down Expand Up @@ -51,7 +51,7 @@ type AzureASOManagedControlPlaneStatus struct {

// ControlPlaneEndpoint represents the endpoint for the cluster's API server.
//+optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
}

// +kubebuilder:object:root=true
Expand Down
12 changes: 6 additions & 6 deletions api/v1beta1/azurecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
)

const (
Expand Down Expand Up @@ -53,7 +53,7 @@ type AzureClusterSpec struct {
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. It is not recommended to set
// this when creating an AzureCluster as CAPZ will set this for you. However, if it is set, CAPZ will not change it.
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint,omitempty"`
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint,omitempty"`
}

// AzureClusterStatus defines the observed state of AzureCluster.
Expand All @@ -65,15 +65,15 @@ type AzureClusterStatus struct {
// See: https://learn.microsoft.com/azure/reliability/availability-zones-overview
// This list will be used by Cluster API to try and spread the machines across the failure domains.
// +optional
FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"`
FailureDomains clusterv1beta1.FailureDomains `json:"failureDomains,omitempty"`

// Ready is true when the provider resource is ready.
// +optional
Ready bool `json:"ready"`

// Conditions defines current service state of the AzureCluster.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`

// LongRunningOperationStates saves the states for Azure long-running operations so they can be continued on the
// next reconciliation loop.
Expand Down Expand Up @@ -114,12 +114,12 @@ type AzureClusterList struct {
}

// GetConditions returns the list of conditions for an AzureCluster API object.
func (c *AzureCluster) GetConditions() clusterv1.Conditions {
func (c *AzureCluster) GetConditions() clusterv1beta1.Conditions {
return c.Status.Conditions
}

// SetConditions will set the given conditions on an AzureCluster object.
func (c *AzureCluster) SetConditions(conditions clusterv1.Conditions) {
func (c *AzureCluster) SetConditions(conditions clusterv1beta1.Conditions) {
c.Status.Conditions = conditions
}

Expand Down
10 changes: 5 additions & 5 deletions api/v1beta1/azurecluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"

. "github.com/onsi/gomega"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
)

func TestAzureCluster_ValidateCreate(t *testing.T) {
Expand All @@ -38,7 +38,7 @@ func TestAzureCluster_ValidateCreate(t *testing.T) {
name: "azurecluster with pre-existing control plane endpoint - valid spec",
cluster: func() *AzureCluster {
cluster := createValidCluster()
cluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{
cluster.Spec.ControlPlaneEndpoint = clusterv1beta1.APIEndpoint{
Host: "apiserver.example.com",
Port: 8443,
}
Expand Down Expand Up @@ -129,15 +129,15 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) {
name: "azurecluster with pre-existing control plane endpoint - valid spec",
oldCluster: func() *AzureCluster {
cluster := createValidCluster()
cluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{
cluster.Spec.ControlPlaneEndpoint = clusterv1beta1.APIEndpoint{
Host: "apiserver.example.com",
Port: 8443,
}
return cluster
}(),
cluster: func() *AzureCluster {
cluster := createValidCluster()
cluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{
cluster.Spec.ControlPlaneEndpoint = clusterv1beta1.APIEndpoint{
Host: "apiserver.example.io",
Port: 6443,
}
Expand All @@ -150,7 +150,7 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) {
oldCluster: createValidCluster(),
cluster: func() *AzureCluster {
cluster := createValidCluster()
cluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{
cluster.Spec.ControlPlaneEndpoint = clusterv1beta1.APIEndpoint{
Host: "apiserver.example.com",
Port: 8443,
}
Expand Down
8 changes: 4 additions & 4 deletions api/v1beta1/azureclusteridentity_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
)

// AllowedNamespaces defines the namespaces the clusters are allowed to use the identity from
Expand Down Expand Up @@ -89,7 +89,7 @@ type AzureClusterIdentitySpec struct {
type AzureClusterIdentityStatus struct {
// Conditions defines current service state of the AzureClusterIdentity.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -118,12 +118,12 @@ type AzureClusterIdentityList struct {
}

// GetConditions returns the list of conditions for an AzureClusterIdentity API object.
func (c *AzureClusterIdentity) GetConditions() clusterv1.Conditions {
func (c *AzureClusterIdentity) GetConditions() clusterv1beta1.Conditions {
return c.Status.Conditions
}

// SetConditions will set the given conditions on an AzureClusterIdentity object.
func (c *AzureClusterIdentity) SetConditions(conditions clusterv1.Conditions) {
func (c *AzureClusterIdentity) SetConditions(conditions clusterv1beta1.Conditions) {
c.Status.Conditions = conditions
}

Expand Down
6 changes: 3 additions & 3 deletions api/v1beta1/azuremachine_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"golang.org/x/crypto/ssh"
kerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/uuid"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"

utilSSH "sigs.k8s.io/cluster-api-provider-azure/util/ssh"
Expand Down Expand Up @@ -172,7 +172,7 @@ func (s *AzureMachineSpec) SetNetworkInterfacesDefaults() {
func GetOwnerAzureClusterNameAndNamespace(cli client.Client, clusterName string, namespace string, maxAttempts int) (azureClusterName string, azureClusterNamespace string, err error) {
ctx := context.Background()

ownerCluster := &clusterv1.Cluster{}
ownerCluster := &clusterv1beta1.Cluster{}
key := client.ObjectKey{
Namespace: namespace,
Name: clusterName,
Expand Down Expand Up @@ -223,7 +223,7 @@ func (m *AzureMachine) SetDefaults(client client.Client) error {
}

// Fetch the Cluster.
clusterName, ok := m.Labels[clusterv1.ClusterNameLabel]
clusterName, ok := m.Labels[clusterv1beta1.ClusterNameLabel]
if !ok {
errs = append(errs, errors.Errorf("failed to fetch ClusterName for AzureMachine %s/%s", m.Namespace, m.Name))
}
Expand Down
12 changes: 6 additions & 6 deletions api/v1beta1/azuremachine_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

Expand Down Expand Up @@ -564,15 +564,15 @@ func (m mockClient) Get(ctx context.Context, key client.ObjectKey, obj client.Ob
switch obj := obj.(type) {
case *AzureCluster:
obj.Spec.SubscriptionID = "test-subscription-id"
case *clusterv1.Cluster:
obj.Spec = clusterv1.ClusterSpec{
case *clusterv1beta1.Cluster:
obj.Spec = clusterv1beta1.ClusterSpec{
InfrastructureRef: &corev1.ObjectReference{
Kind: AzureClusterKind,
Name: "test-cluster",
Namespace: "default",
},
ClusterNetwork: &clusterv1.ClusterNetwork{
Services: &clusterv1.NetworkRanges{
ClusterNetwork: &clusterv1beta1.ClusterNetwork{
Services: &clusterv1beta1.NetworkRanges{
CIDRBlocks: []string{"192.168.0.0/26"},
},
},
Expand Down Expand Up @@ -607,7 +607,7 @@ func hardcodedAzureMachineWithSSHKey(sshPublicKey string) *AzureMachine {
return &AzureMachine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
clusterv1.ClusterNameLabel: "test-cluster",
clusterv1beta1.ClusterNameLabel: "test-cluster",
},
},
Spec: AzureMachineSpec{
Expand Down
8 changes: 4 additions & 4 deletions api/v1beta1/azuremachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
)

const (
Expand Down Expand Up @@ -246,7 +246,7 @@ type AzureMachineStatus struct {

// Conditions defines current service state of the AzureMachine.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`

// LongRunningOperationStates saves the states for Azure long-running operations so they can be continued on the
// next reconciliation loop.
Expand Down Expand Up @@ -297,12 +297,12 @@ type AzureMachineList struct {
}

// GetConditions returns the list of conditions for an AzureMachine API object.
func (m *AzureMachine) GetConditions() clusterv1.Conditions {
func (m *AzureMachine) GetConditions() clusterv1beta1.Conditions {
return m.Status.Conditions
}

// SetConditions will set the given conditions on an AzureMachine object.
func (m *AzureMachine) SetConditions(conditions clusterv1.Conditions) {
func (m *AzureMachine) SetConditions(conditions clusterv1beta1.Conditions) {
m.Status.Conditions = conditions
}

Expand Down
Loading
Loading