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

[WIP] upgrade to CAPI 1.9.3 #5375

Closed
Closed
Changes from 1 commit
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
Next Next commit
Bump CAPI to v1.9.3
mboersma committed Jan 16, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit fc9207fb54b5201eb8fe251ad2c54e842da28fb5
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -70,11 +70,11 @@ ifneq ($(abspath $(ROOT_DIR)),$(GOPATH)/src/sigs.k8s.io/cluster-api-provider-azu
endif

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

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

@@ -135,11 +135,7 @@ CODESPELL_BIN := codespell
CODESPELL_DIST_DIR := codespell_dist
CODESPELL := $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/$(CODESPELL_BIN)

# This is a commit from CR main (22.05.2024).
# Intentionally using a commit from main to use a setup-envtest version
# that uses binaries from controller-tools, not GCS.
# CR PR: https://github.com/kubernetes-sigs/controller-runtime/pull/2811
SETUP_ENVTEST_VER := v0.0.0-20240522175850-2e9781e9fc60
SETUP_ENVTEST_VER := release-0.19
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
@@ -325,7 +321,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.8.8/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.9.3/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.2.5/addon-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"
4 changes: 2 additions & 2 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -20,9 +20,9 @@ settings = {
"deploy_cert_manager": True,
"preload_images_for_kind": True,
"kind_cluster_name": "capz",
"capi_version": "v1.8.8",
"capi_version": "v1.9.3",
"caaph_version": "v0.2.5",
"cert_manager_version": "v1.16.1",
"cert_manager_version": "v1.16.2",
"kubernetes_version": "v1.28.15",
"aks_kubernetes_version": "v1.28.15",
"flatcar_version": "3374.2.1",
2 changes: 1 addition & 1 deletion api/v1beta1/azurecluster_default_test.go
Original file line number Diff line number Diff line change
@@ -1602,7 +1602,7 @@ func TestAPIServerLBDefaults(t *testing.T) {
tc := c
t.Run(tc.name, func(t *testing.T) {
if tc.featureGate != "" {
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, tc.featureGate, true)()
featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, tc.featureGate, true)
}
tc.cluster.setAPIServerLBDefaults()
if !reflect.DeepEqual(tc.cluster, tc.output) {
2 changes: 1 addition & 1 deletion api/v1beta1/azurecluster_validation_test.go
Original file line number Diff line number Diff line change
@@ -1280,7 +1280,7 @@ func TestValidateAPIServerLB(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
g := NewWithT(t)
if test.featureGate == feature.APIServerILB {
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, test.featureGate, true)()
featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, test.featureGate, true)
}
err := validateAPIServerLB(&test.lb, &test.old, test.cpCIDRS, field.NewPath("apiServerLB"))
if test.wantErr {
3 changes: 1 addition & 2 deletions api/v1beta1/azuremachine_types.go
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/errors"
)

const (
@@ -219,7 +218,7 @@ type AzureMachineStatus struct {
// can be added as events to the Machine object and/or logged in the
// controller's output.
// +optional
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
FailureReason *string `json:"failureReason,omitempty"`

// ErrorMessage will be set in the event that there is a terminal problem
// reconciling the Machine and will contain a more verbose string suitable
2 changes: 1 addition & 1 deletion api/v1beta1/azuremanagedcluster_webhook_test.go
Original file line number Diff line number Diff line change
@@ -151,7 +151,7 @@ func TestAzureManagedCluster_ValidateCreateFailure(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
if tc.featureGateEnabled != nil {
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, *tc.featureGateEnabled)()
utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, *tc.featureGateEnabled)
}
g := NewWithT(t)
_, err := tc.amc.ValidateCreate()
2 changes: 1 addition & 1 deletion api/v1beta1/azuremanagedcontrolplane_webhook_test.go
Original file line number Diff line number Diff line change
@@ -1669,7 +1669,7 @@ func TestAzureManagedControlPlane_ValidateCreateFailure(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
g := NewWithT(t)
if tc.featureGateEnabled != nil {
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, *tc.featureGateEnabled)()
utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, *tc.featureGateEnabled)
}
mcpw := &azureManagedControlPlaneWebhook{
Client: client,
3 changes: 1 addition & 2 deletions api/v1beta1/azuremanagedmachinepool_types.go
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
capierrors "sigs.k8s.io/cluster-api/errors"
)

const (
@@ -464,7 +463,7 @@ type AzureManagedMachinePoolStatus struct {
// can be added as events to the Machine object and/or logged in the
// controller's output.
// +optional
ErrorReason *capierrors.MachineStatusError `json:"errorReason,omitempty"`
ErrorReason *string `json:"errorReason,omitempty"`

// Any transient errors that occur during the reconciliation of Machines
// can be added as events to the Machine object and/or logged in the
2 changes: 1 addition & 1 deletion api/v1beta1/azuremanagedmachinepool_webhook_test.go
Original file line number Diff line number Diff line change
@@ -1321,7 +1321,7 @@ func TestAzureManagedMachinePool_ValidateCreateFailure(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
if tc.featureGateEnabled != nil {
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, *tc.featureGateEnabled)()
utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, *tc.featureGateEnabled)
}
g := NewWithT(t)
mw := &azureManagedMachinePoolWebhook{}
5 changes: 2 additions & 3 deletions api/v1beta1/zz_generated.deepcopy.go

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

8 changes: 8 additions & 0 deletions azure/errors.go
Original file line number Diff line number Diff line change
@@ -62,6 +62,14 @@ const (
TransientErrorType ReconcileErrorType = "Transient"
// TerminalErrorType cannot be recovered, will not be requeued.
TerminalErrorType ReconcileErrorType = "Terminal"
// UnsupportedChange is returned when a change is not supported.
UnsupportedChange = "UnsupportedChange"
// InvalidConfiguration is returned when a configuration is invalid.
InvalidConfiguration = "InvalidConfiguration"
// CreateError is returned when an error occurs during creation.
CreateError = "CreateError"
// UpdateError is returned when an error occurs during update.
UpdateError = "UpdateError"
)

// Error returns the error message for a ReconcileError.
4 changes: 2 additions & 2 deletions azure/scope/cluster_test.go
Original file line number Diff line number Diff line change
@@ -2231,7 +2231,7 @@ func TestBackendPoolName(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
g := NewWithT(t)
if tc.featureGate == feature.APIServerILB {
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, tc.featureGate, true)()
featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, tc.featureGate, true)
}

cluster := &clusterv1.Cluster{
@@ -3161,7 +3161,7 @@ func TestClusterScope_LBSpecs(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
if tc.featureGate == feature.APIServerILB {
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, tc.featureGate, true)()
featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, tc.featureGate, true)
}
cluster := &clusterv1.Cluster{
ObjectMeta: metav1.ObjectMeta{
3 changes: 1 addition & 2 deletions azure/scope/machine.go
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
capierrors "sigs.k8s.io/cluster-api/errors"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/cluster-api/util/patch"
@@ -603,7 +602,7 @@
}

// SetFailureReason sets the AzureMachine status failure reason.
func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError) {
func (m *MachineScope) SetFailureReason(v string) {

Check warning on line 605 in azure/scope/machine.go

Codecov / codecov/patch

azure/scope/machine.go#L605

Added line #L605 was not covered by tests
m.AzureMachine.Status.FailureReason = &v
}

2 changes: 1 addition & 1 deletion azure/scope/machine_test.go
Original file line number Diff line number Diff line change
@@ -3118,7 +3118,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
if tt.featureGate == feature.APIServerILB {
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, tt.featureGate, true)()
featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, tt.featureGate, true)
}
gotNicSpecs := tt.machineScope.NICSpecs()
if !reflect.DeepEqual(gotNicSpecs, tt.want) {
3 changes: 1 addition & 2 deletions azure/scope/machinepool.go
Original file line number Diff line number Diff line change
@@ -33,7 +33,6 @@
"k8s.io/klog/v2"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
capierrors "sigs.k8s.io/cluster-api/errors"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/annotations"
@@ -648,7 +647,7 @@
}

// SetFailureReason sets the AzureMachinePool status failure reason.
func (m *MachinePoolScope) SetFailureReason(v capierrors.MachineStatusError) {
func (m *MachinePoolScope) SetFailureReason(v string) {

Check warning on line 650 in azure/scope/machinepool.go

Codecov / codecov/patch

azure/scope/machinepool.go#L650

Added line #L650 was not covered by tests
m.AzureMachinePool.Status.FailureReason = &v
}

3 changes: 1 addition & 2 deletions azure/scope/machinepoolmachine.go
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/controllers/noderefutil"
"sigs.k8s.io/cluster-api/controllers/remote"
capierrors "sigs.k8s.io/cluster-api/errors"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/cluster-api/util/patch"
@@ -277,7 +276,7 @@
}

// SetFailureReason sets the AzureMachinePoolMachine status failure reason.
func (s *MachinePoolMachineScope) SetFailureReason(v capierrors.MachineStatusError) {
func (s *MachinePoolMachineScope) SetFailureReason(v string) {

Check warning on line 279 in azure/scope/machinepoolmachine.go

Codecov / codecov/patch

azure/scope/machinepoolmachine.go#L279

Added line #L279 was not covered by tests
s.AzureMachinePoolMachine.Status.FailureReason = &v
}

3 changes: 1 addition & 2 deletions azure/services/aso/aso.go
Original file line number Diff line number Diff line change
@@ -378,8 +378,7 @@ func isOwnedBy(resource client.Object, owner client.Object, scheme *runtime.Sche
}

func hasLegacyOwnedByLabel(labels map[string]string, clusterName string) bool {
//nolint:staticcheck // Referencing this deprecated value is required for backwards compatibility.
return labels[infrav1.OwnedByClusterLabelKey] == clusterName
return labels[infrav1.OwnedByClusterLabelKey] == clusterName //nolint:staticcheck // Referencing this deprecated value is required for backwards compatibility.
}

// PauseResource pauses an ASO resource by updating its `reconcile-policy` to `skip`.
5 changes: 2 additions & 3 deletions azure/services/aso/aso_test.go
Original file line number Diff line number Diff line change
@@ -565,9 +565,8 @@ func TestCreateOrUpdateResource(t *testing.T) {
Name: "name",
Namespace: "namespace",
Labels: map[string]string{
clusterv1.ClusterNameLabel: clusterName,
//nolint:staticcheck // Referencing this deprecated value is required for backwards compatibility.
infrav1.OwnedByClusterLabelKey: clusterName,
clusterv1.ClusterNameLabel: clusterName,
infrav1.OwnedByClusterLabelKey: clusterName, //nolint:staticcheck // Referencing this deprecated value is required for backwards compatibility.
},
Annotations: map[string]string{
asoannotations.ReconcilePolicy: string(asoannotations.ReconcilePolicySkip),
2 changes: 1 addition & 1 deletion azure/services/resourcehealth/resourcehealth_test.go
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ func TestReconcileResourceHealth(t *testing.T) {
}{scopeMock, filtererMock}
}

defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.AKSResourceHealth, !tc.featureDisabled)()
utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.AKSResourceHealth, !tc.featureDisabled)

err := s.Reconcile(context.TODO())

Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: azureasomanagedclusters.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: azureasomanagedclustertemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: azureasomanagedcontrolplanes.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: azureasomanagedcontrolplanetemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: azureasomanagedmachinepools.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: azureasomanagedmachinepooltemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: azureclusteridentities.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
@@ -75,7 +75,6 @@ spec:
a label query over a set of resources. The result of matchLabels and
matchExpressions are ANDed.


A nil or empty selector indicates that AzureCluster cannot use this
AzureClusterIdentity from any namespace.
properties:
@@ -152,7 +151,6 @@ spec:
ResourceID is the Azure resource ID for the User Assigned MSI resource.
Only applicable when type is UserAssignedMSI.


Deprecated: This field no longer has any effect.
type: string
tenantID:
@@ -200,20 +198,20 @@ spec:
description: |-
The reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may not be empty.
This field may be empty.
type: string
severity:
description: |-
Severity provides an explicit classification of Reason code, so the users or machines can immediately
severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
description: status of the condition, one of True, False, Unknown.
type: string
type:
description: |-
Type of condition in CamelCase or in foo.example.com/CamelCase.
type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
type: string
Loading