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] Bump CAPI to v1.9.2 #5316

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ 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.0
CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.5/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.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.2.5/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 @@ -20,7 +20,7 @@ settings = {
"deploy_cert_manager": True,
"preload_images_for_kind": True,
"kind_cluster_name": "capz",
"capi_version": "v1.8.5",
"capi_version": "v1.9.2",
"caaph_version": "v0.2.5",
"cert_manager_version": "v1.16.1",
"kubernetes_version": "v1.28.3",
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azurecluster_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azurecluster_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions api/v1beta1/azuremachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azuremanagedcluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,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()
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azuremanagedcontrolplane_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,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,
Expand Down
3 changes: 1 addition & 2 deletions api/v1beta1/azuremanagedmachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azuremanagedmachinepool_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,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{}
Expand Down
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
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions azure/scope/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down
3 changes: 1 addition & 2 deletions azure/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

View check run for this annotation

Codecov / codecov/patch

azure/scope/machine.go#L605

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

Expand Down
2 changes: 1 addition & 1 deletion azure/scope/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions azure/scope/machinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

View check run for this annotation

Codecov / codecov/patch

azure/scope/machinepool.go#L650

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

Expand Down
3 changes: 1 addition & 2 deletions azure/scope/machinepoolmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

View check run for this annotation

Codecov / codecov/patch

azure/scope/machinepoolmachine.go#L279

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

Expand Down
3 changes: 1 addition & 2 deletions azure/services/aso/aso.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
5 changes: 2 additions & 3 deletions azure/services/aso/aso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion azure/services/resourcehealth/resourcehealth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
name: azureasomanagedclusters.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
name: azureasomanagedclustertemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
name: azureasomanagedcontrolplanes.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
name: azureasomanagedcontrolplanetemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
name: azureasomanagedmachinepools.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
name: azureasomanagedmachinepooltemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
name: azureclusteridentities.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Loading
Loading