Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (r *AzurePrivateLinkServiceReconciler) Reconcile(ctx context.Context, req c
controllerutil.AddFinalizer(azPLS, azurePrivateLinkServiceFinalizer)
if err := r.Update(ctx, azPLS); err != nil {
if apierrors.IsConflict(err) {
return ctrl.Result{Requeue: true}, nil
return ctrl.Result{RequeueAfter: time.Second}, nil
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why this change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Requeue is deprecated in controller-runtime v0.22.4 — the // Deprecated: Use RequeueAfter instead. annotation at vendor/sigs.k8s.io/controller-runtime/pkg/reconcile/reconcile.go:41 triggers staticcheck SA1019, which make lint enforces.

Upstream source: https://github.com/kubernetes-sigs/controller-runtime/blob/v0.22.4/pkg/reconcile/reconcile.go#L31-L42


AI-assisted response via Claude Code

}
return ctrl.Result{}, err
}
Expand Down Expand Up @@ -368,7 +368,7 @@ func (r *AzurePrivateLinkServiceReconciler) ensureHCPFinalizer(ctx context.Conte
controllerutil.AddFinalizer(hcp, hcpAzurePLSFinalizerName)
if err := r.Patch(ctx, hcp, client.MergeFromWithOptions(originalHCP, client.MergeFromWithOptimisticLock{})); err != nil {
if apierrors.IsConflict(err) {
return ctrl.Result{Requeue: true}, nil
return ctrl.Result{RequeueAfter: time.Second}, nil
}
return ctrl.Result{}, fmt.Errorf("failed to add HCP finalizer: %w", err)
}
Expand Down Expand Up @@ -400,7 +400,7 @@ func (r *AzurePrivateLinkServiceReconciler) reconcileHCPDeletion(ctx context.Con
controllerutil.RemoveFinalizer(hcp, hcpAzurePLSFinalizerName)
if err := r.Patch(ctx, hcp, client.MergeFromWithOptions(originalHCP, client.MergeFromWithOptimisticLock{})); err != nil {
if apierrors.IsConflict(err) {
return ctrl.Result{Requeue: true}, nil
return ctrl.Result{RequeueAfter: time.Second}, nil
}
return ctrl.Result{}, fmt.Errorf("failed to remove HCP finalizer: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"testing"
"time"

. "github.com/onsi/gomega"

Expand Down Expand Up @@ -3426,7 +3427,7 @@ func TestReconcile_WhenFinalizerAddConflicts_ItShouldRequeue(t *testing.T) {
})

g.Expect(err).ToNot(HaveOccurred())
g.Expect(result.Requeue).To(BeTrue(), "should requeue on conflict")
g.Expect(result.RequeueAfter).To(Equal(time.Second), "should requeue on conflict")
}

func TestEnsureHCPFinalizer_WhenPatchConflicts_ItShouldRequeue(t *testing.T) {
Expand Down Expand Up @@ -3457,7 +3458,7 @@ func TestEnsureHCPFinalizer_WhenPatchConflicts_ItShouldRequeue(t *testing.T) {

result, err := r.ensureHCPFinalizer(t.Context(), hcp, testr.New(t))
g.Expect(err).ToNot(HaveOccurred())
g.Expect(result.Requeue).To(BeTrue(), "should requeue on conflict")
g.Expect(result.RequeueAfter).To(Equal(time.Second), "should requeue on conflict")
}

func TestReconcileHCPDeletion_WhenPatchConflicts_ItShouldRequeue(t *testing.T) {
Expand Down Expand Up @@ -3499,7 +3500,7 @@ func TestReconcileHCPDeletion_WhenPatchConflicts_ItShouldRequeue(t *testing.T) {

result, err := r.reconcileHCPDeletion(t.Context(), azPLS, hcp, testr.New(t))
g.Expect(err).ToNot(HaveOccurred())
g.Expect(result.Requeue).To(BeTrue(), "should requeue on conflict")
g.Expect(result.RequeueAfter).To(Equal(time.Second), "should requeue on conflict")
}

func TestUpdatePrivateEndpointStatus_WhenStatusPatchFails_ItShouldReturnError(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func TestReconcile(t *testing.T) {
hcp *hyperv1.HostedControlPlane
existingPLS *hyperv1.AzurePrivateLinkService
expectError bool
expectRequeueAfter time.Duration
expectPLSCreated bool
expectedLoadBalancerIP string
}{
Expand Down Expand Up @@ -173,9 +174,10 @@ func TestReconcile(t *testing.T) {
svc.Status.LoadBalancer.Ingress = []corev1.LoadBalancerIngress{}
return svc
}(),
hcp: defaultHCP(),
expectError: false,
expectPLSCreated: false,
hcp: defaultHCP(),
expectError: false,
expectRequeueAfter: 30 * time.Second,
expectPLSCreated: false,
},
{
name: "When HCP is being deleted, it should not create CR",
Expand Down Expand Up @@ -318,7 +320,7 @@ func TestReconcile(t *testing.T) {
g.Expect(err).ToNot(HaveOccurred())
}

g.Expect(result.Requeue).To(BeFalse())
g.Expect(result.RequeueAfter).To(Equal(tt.expectRequeueAfter))

// Check if AzurePrivateLinkService CR was created/updated
if tt.expectPLSCreated {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gcpprivateserviceconnect
import (
"context"
"testing"
"time"

. "github.com/onsi/gomega"

Expand Down Expand Up @@ -103,7 +104,7 @@ func TestReconcileIntegration(t *testing.T) {
requestName string
service *corev1.Service
hcp *hyperv1.HostedControlPlane
expectRequeue bool
expectRequeueAfter time.Duration
expectError bool
expectGCPPSCCreated bool
}{
Expand Down Expand Up @@ -148,7 +149,7 @@ func TestReconcileIntegration(t *testing.T) {
},
},
},
expectRequeue: false,
expectRequeueAfter: 0,
expectError: false,
expectGCPPSCCreated: true,
},
Expand All @@ -172,7 +173,7 @@ func TestReconcileIntegration(t *testing.T) {
},
},
},
expectRequeue: false,
expectRequeueAfter: 0,
expectError: false,
expectGCPPSCCreated: false,
},
Expand All @@ -194,7 +195,7 @@ func TestReconcileIntegration(t *testing.T) {
},
},
},
expectRequeue: false,
expectRequeueAfter: 0,
expectError: false,
expectGCPPSCCreated: false,
},
Expand All @@ -218,7 +219,7 @@ func TestReconcileIntegration(t *testing.T) {
},
},
},
expectRequeue: false,
expectRequeueAfter: 0,
expectError: false,
expectGCPPSCCreated: false,
},
Expand Down Expand Up @@ -273,7 +274,7 @@ func TestReconcileIntegration(t *testing.T) {
g.Expect(err).ToNot(HaveOccurred())
}

g.Expect(result.Requeue).To(Equal(tt.expectRequeue))
g.Expect(result.RequeueAfter).To(Equal(tt.expectRequeueAfter))

// Check if GCPPrivateServiceConnect CR was created
if tt.expectGCPPSCCreated {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,16 +1136,30 @@ func TestReconcileOAuthService(t *testing.T) {
if err := fakeClient.List(ctx, &actualServices); err != nil {
t.Fatalf("failed to list services: %v", err)
}
if actualServices.Items == nil {
actualServices.Items = []corev1.Service{}
}

if diff := testutil.MarshalYamlAndDiff(&actualServices, &corev1.ServiceList{Items: tc.expectedServices}, t); diff != "" {
expectedServices := tc.expectedServices
if expectedServices == nil {
expectedServices = []corev1.Service{}
}
if diff := testutil.MarshalYamlAndDiff(&actualServices, &corev1.ServiceList{Items: expectedServices}, t); diff != "" {
t.Errorf("actual services differ from expected: %s", diff)
}

var actualRoutes routev1.RouteList
if err := fakeClient.List(ctx, &actualRoutes); err != nil {
t.Fatalf("failed to list routes: %v", err)
}
if diff := testutil.MarshalYamlAndDiff(&actualRoutes, &routev1.RouteList{Items: tc.expectedRoutes}, t); diff != "" {
if actualRoutes.Items == nil {
actualRoutes.Items = []routev1.Route{}
}
expectedRoutes := tc.expectedRoutes
if expectedRoutes == nil {
expectedRoutes = []routev1.Route{}
}
if diff := testutil.MarshalYamlAndDiff(&actualRoutes, &routev1.RouteList{Items: expectedRoutes}, t); diff != "" {
t.Errorf("actual routes differ from expected: %s", diff)
}
})
Expand Down Expand Up @@ -1451,16 +1465,30 @@ func TestReconcileAPIServerService(t *testing.T) {
if err := fakeClient.List(ctx, &actualServices); err != nil {
t.Fatalf("failed to list services: %v", err)
}
if actualServices.Items == nil {
actualServices.Items = []corev1.Service{}
}

if diff := testutil.MarshalYamlAndDiff(&actualServices, &corev1.ServiceList{Items: tc.expectedServices}, t); diff != "" {
expectedServices := tc.expectedServices
if expectedServices == nil {
expectedServices = []corev1.Service{}
}
if diff := testutil.MarshalYamlAndDiff(&actualServices, &corev1.ServiceList{Items: expectedServices}, t); diff != "" {
t.Errorf("actual services differ from expected: %s", diff)
}

var actualRoutes routev1.RouteList
if err := fakeClient.List(ctx, &actualRoutes); err != nil {
t.Fatalf("failed to list routes: %v", err)
}
if diff := testutil.MarshalYamlAndDiff(&actualRoutes, &routev1.RouteList{Items: tc.expectedRoutes}, t); diff != "" {
if actualRoutes.Items == nil {
actualRoutes.Items = []routev1.Route{}
}
expectedRoutes := tc.expectedRoutes
if expectedRoutes == nil {
expectedRoutes = []routev1.Route{}
}
if diff := testutil.MarshalYamlAndDiff(&actualRoutes, &routev1.RouteList{Items: expectedRoutes}, t); diff != "" {
t.Errorf("actual routes differ from expected: %s", diff)
}
})
Expand Down Expand Up @@ -1671,7 +1699,14 @@ func TestReconcileHCPRouterServices(t *testing.T) {
if err := c.List(ctx, &services); err != nil {
t.Fatalf("failed to list services: %v", err)
}
if diff := testutil.MarshalYamlAndDiff(&services, &corev1.ServiceList{Items: tc.expectedServices}, t); diff != "" {
expectedServices := tc.expectedServices
if expectedServices == nil {
expectedServices = []corev1.Service{}
}
if services.Items == nil {
services.Items = []corev1.Service{}
}
if diff := testutil.MarshalYamlAndDiff(&services, &corev1.ServiceList{Items: expectedServices}, t); diff != "" {
t.Errorf("actual services differ from expected: %s", diff)
}
})
Expand Down
9 changes: 3 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ require (
github.com/openshift/cloud-credential-operator v0.0.0-20250225003505-216fd1a30ec3
github.com/openshift/cluster-api-provider-agent/api v0.0.0-20260120122324-898e638ec7d1
github.com/openshift/cluster-autoscaler-operator v0.0.1-0.20241204142113-43631b045675
github.com/openshift/cluster-node-tuning-operator v0.0.0-20250225115807-f166846b7256
github.com/openshift/cluster-node-tuning-operator v0.0.0-20260527203700-73801cc280b3
github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87
github.com/openshift/hypershift/api v0.0.0-20240604072534-cd2d5291e2b7
github.com/openshift/hypershift/api v0.0.0-20250724113115-0281b49cc465
github.com/openshift/library-go v0.0.0-20251204132909-8814e976a023
github.com/openshift/multi-operator-manager v0.0.0-20260112172834-b64ebc8c627b
github.com/operator-framework/api v0.37.0
Expand Down Expand Up @@ -301,7 +301,7 @@ require (
k8s.io/csi-translation-lib v0.35.0 // indirect
k8s.io/kms v0.35.1 // indirect
k8s.io/kube-openapi v0.0.0-20251125145642-4e65d59e963e // indirect
k8s.io/kubelet v0.32.2 // indirect
k8s.io/kubelet v0.33.3 // indirect
kubevirt.io/controller-lifecycle-operator-sdk/api v0.2.4 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.33.0 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
Expand All @@ -319,9 +319,6 @@ replace github.com/k-orc/openstack-resource-controller => sigs.k8s.io/cluster-ap
// CVE-2025-30204
replace github.com/golang-jwt/jwt/v4 => github.com/golang-jwt/jwt/v4 v4.5.2

// webhook.Validator deprecation in v0.20 breaks everything, conversion is nontrivial
replace sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.19.7

// Use our openshift version of karpenter instead of upstream
replace github.com/aws/karpenter-provider-aws => github.com/openshift/aws-karpenter-provider-aws v0.0.0-20260311064431-f0be9c72e5bf

Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ github.com/openshift/cluster-api-provider-agent/api v0.0.0-20260120122324-898e63
github.com/openshift/cluster-api-provider-agent/api v0.0.0-20260120122324-898e638ec7d1/go.mod h1:/hEmyZ903PeqntDSxLgZcje96/2lC3PmvsnUABQpR8Q=
github.com/openshift/cluster-autoscaler-operator v0.0.1-0.20241204142113-43631b045675 h1:hPFyXtaR42wqKKGMVP4G7M2vmp5iBxBqKetMguh4Td0=
github.com/openshift/cluster-autoscaler-operator v0.0.1-0.20241204142113-43631b045675/go.mod h1:0tGCwMCgKq7KhJWDGr6Tsqqb6Sk3epz/b6tfFDFK1Ug=
github.com/openshift/cluster-node-tuning-operator v0.0.0-20250225115807-f166846b7256 h1:YLqKXRH7DTukM1sxLOi++uUe7R2m0ivK7yqf0X6emok=
github.com/openshift/cluster-node-tuning-operator v0.0.0-20250225115807-f166846b7256/go.mod h1:nMuHN1oKtpWkQlV1jwqMYV0UfF6wWb+e3TazrWTbNSY=
github.com/openshift/cluster-node-tuning-operator v0.0.0-20260527203700-73801cc280b3 h1:oZXGbNRqAqe+mPEvC2GP4fWtkkn5isB6G+PyxpNKaEQ=
github.com/openshift/cluster-node-tuning-operator v0.0.0-20260527203700-73801cc280b3/go.mod h1:8aR3IFSv4aq7edM3U8UDpWHUFP/nKQneNPoiheWRsYU=
github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87 h1:cHyxR+Y8rAMT6m1jQCaYGRwikqahI0OjjUDhFNf3ySQ=
github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87/go.mod h1:DB/Mf2oTeiAmVVX1gN+NEqweonAPY0TKUwADizj8+ZA=
github.com/openshift/kubernetes-sigs-karpenter v0.0.0-20260310165629-67e201b559d5 h1:vkWMN8h47VGeqtES4jvRDfWWDqPIGTMtm2ltcg8GcuA=
Expand Down Expand Up @@ -1056,8 +1056,8 @@ k8s.io/kube-scheduler v0.35.1 h1:xhF7M/4Hclq69IAG6K6qW2Y2P3jf9btRqccon3hKz9s=
k8s.io/kube-scheduler v0.35.1/go.mod h1:6wg+wyqGBuT93PRNmk7b/xPvYZ28K4JmUfWgeIz/JAU=
k8s.io/kubectl v0.35.1 h1:zP3Er8C5i1dcAFUMh9Eva0kVvZHptXIn/+8NtRWMxwg=
k8s.io/kubectl v0.35.1/go.mod h1:cQ2uAPs5IO/kx8R5s5J3Ihv3VCYwrx0obCXum0CvnXo=
k8s.io/kubelet v0.32.2 h1:WFTSYdt3BB1aTApDuKNI16x/4MYqqX8WBBBBh3KupDg=
k8s.io/kubelet v0.32.2/go.mod h1:cC1ms5RS+lu0ckVr6AviCQXHLSPKEBC3D5oaCBdTGkI=
k8s.io/kubelet v0.33.3 h1:Cvy8+7Lq9saZds2ib7YBXbKvkMMJu3f5mzucmhSIJno=
k8s.io/kubelet v0.33.3/go.mod h1:Q1Cfr6VQq1m9v9XsE/mDmhTxPdN6NPU6Ug0e6mAqi58=
k8s.io/pod-security-admission v0.35.1 h1:Ra7QA/mTXVabzzgQAe36trllpQdGSvwuq9pdnXsIqoI=
k8s.io/pod-security-admission v0.35.1/go.mod h1:J2OnqW+rNItdl6XZeySa4m2nDqrZ+nBpk1Mr6Vf9M/U=
k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
Expand Down Expand Up @@ -1088,8 +1088,8 @@ sigs.k8s.io/cluster-api-provider-openstack v0.13.3 h1:qBPgWG1E3wiiK8+VR5a3jnKGTy
sigs.k8s.io/cluster-api-provider-openstack v0.13.3/go.mod h1:McuqrgmgsbK4yaC1HKqJ7dxKnOERmXQedUUL15sqelQ=
sigs.k8s.io/cluster-api-provider-openstack/orc v0.0.0-20250113192833-e4f56a2b4f32 h1:AkFSgi+dAnPLtg+SXjtCf3rDzjI/mskDiJ1PWHZoRno=
sigs.k8s.io/cluster-api-provider-openstack/orc v0.0.0-20250113192833-e4f56a2b4f32/go.mod h1:hQOMZZjzuAt9pdLaE/tj5ByDTVNBkqNaP10ijnqNZfU=
sigs.k8s.io/controller-runtime v0.19.7 h1:DLABZfMr20A+AwCZOHhcbcu+TqBXnJZaVBri9K3EO48=
sigs.k8s.io/controller-runtime v0.19.7/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4=
sigs.k8s.io/controller-runtime v0.22.4 h1:GEjV7KV3TY8e+tJ2LCTxUTanW4z/FmNB7l327UfMq9A=
sigs.k8s.io/controller-runtime v0.22.4/go.mod h1:+QX1XUpTXN4mLoblf4tqr5CQcyHPAki2HLXqQMY6vh8=
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ func TestCreateOrUpdateWithAnnotationFactory(t *testing.T) {
return func() error { return nil }
},
expected: &corev1.ConfigMap{
TypeMeta: metav1.TypeMeta{
Kind: "ConfigMap",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: "bar",
Expand Down Expand Up @@ -77,10 +73,6 @@ func TestCreateOrUpdateWithAnnotationFactory(t *testing.T) {
}
},
expected: &corev1.ConfigMap{
TypeMeta: metav1.TypeMeta{
Kind: "ConfigMap",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: "bar",
Expand All @@ -106,10 +98,6 @@ func TestCreateOrUpdateWithAnnotationFactory(t *testing.T) {
return func() error { return nil }
},
expected: &corev1.Namespace{
TypeMeta: metav1.TypeMeta{
Kind: "Namespace",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
},
Expand Down

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

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

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

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

2 changes: 1 addition & 1 deletion hypershift-operator/controllers/proxy/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Setup(mgr manager.Manager, deploymentNamespace string, deploymentName strin
// We do not want this controller to require leader election, as that slows things down drastically when there is a proxy
// and if we have multiple instances running, they should all attempt to do the same change. This means we can not use
// the builder and have to wrap the controller.
c, err := controller.NewUnmanaged("proxy", mgr, controller.Options{
c, err := controller.NewUnmanaged("proxy", controller.Options{
Reconciler: &reconciler{
client: mgr.GetClient(),
deploymentNamespace: deploymentNamespace,
Expand Down
8 changes: 5 additions & 3 deletions support/upsert/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ func TestApplyManifest(t *testing.T) {
existingDeployment.DeletionTimestamp = &metav1.Time{Time: time.Now()}
existingDeployment.ManagedFields = []metav1.ManagedFieldsEntry{
{
Manager: "hypershift-controlplane-manager",
Operation: metav1.ManagedFieldsOperationUpdate,
Time: &metav1.Time{},
Manager: "hypershift-controlplane-manager",
Operation: metav1.ManagedFieldsOperationUpdate,
APIVersion: "apps/v1",
FieldsType: "FieldsV1",
Time: &metav1.Time{},
},
}

Expand Down
Loading