diff --git a/pkg/agent/controller/service_export_client.go b/pkg/agent/controller/service_export_client.go index e2d5a6d5..ea939ec6 100644 --- a/pkg/agent/controller/service_export_client.go +++ b/pkg/agent/controller/service_export_client.go @@ -26,7 +26,6 @@ import ( "github.com/pkg/errors" "github.com/submariner-io/admiral/pkg/log" - "github.com/submariner-io/admiral/pkg/slices" "github.com/submariner-io/lighthouse/pkg/constants" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -50,27 +49,6 @@ func NewServiceExportClient(client dynamic.Interface, scheme *runtime.Scheme) *S } } -func (c *ServiceExportClient) RemoveStatusCondition(ctx context.Context, name, namespace string, - condType mcsv1a1.ServiceExportConditionType, reason string, -) { - c.doUpdate(ctx, name, namespace, func(toUpdate *mcsv1a1.ServiceExport) bool { - condition := FindServiceExportStatusCondition(toUpdate.Status.Conditions, condType) - if condition != nil && reflect.DeepEqual(condition.Reason, &reason) { - logger.V(log.DEBUG).Infof("Removing status condition (Type: %q, Reason: %q) from ServiceExport (%s/%s)", - condType, reason, namespace, name) - - toUpdate.Status.Conditions, _ = slices.Remove(toUpdate.Status.Conditions, *condition, - func(c mcsv1a1.ServiceExportCondition) mcsv1a1.ServiceExportConditionType { - return c.Type - }) - - return true - } - - return false - }) -} - func (c *ServiceExportClient) UpdateStatusConditions(ctx context.Context, name, namespace string, conditions ...mcsv1a1.ServiceExportCondition, ) { diff --git a/pkg/agent/controller/service_export_client_test.go b/pkg/agent/controller/service_export_client_test.go index 95bcda7a..d3e48611 100644 --- a/pkg/agent/controller/service_export_client_test.go +++ b/pkg/agent/controller/service_export_client_test.go @@ -100,34 +100,6 @@ var _ = Describe("ServiceExportClient", func() { }) }) - Context("RemoveStatusCondition", func() { - BeforeEach(func() { - initialServiceExport.Status.Conditions = []mcsv1a1.ServiceExportCondition{ - { - Type: constants.ServiceExportReady, - Status: corev1.ConditionFalse, - Reason: ptr.To("Failed"), - }, - } - }) - - It("should remove the condition if the reason matches", func() { - serviceExportClient.RemoveStatusCondition(context.TODO(), serviceName, serviceNamespace, - constants.ServiceExportReady, "Failed") - - Expect(controller.FindServiceExportStatusCondition(getServiceExport().Status.Conditions, - constants.ServiceExportReady)).To(BeNil()) - }) - - It("should not remove the condition if the reason does not match", func() { - serviceExportClient.RemoveStatusCondition(context.TODO(), serviceName, serviceNamespace, - constants.ServiceExportReady, "NotMatching") - - Expect(controller.FindServiceExportStatusCondition(getServiceExport().Status.Conditions, - constants.ServiceExportReady)).ToNot(BeNil()) - }) - }) - Context("with Conflict condition type", func() { It("should aggregate the different reasons and messages", func() { // The condition shouldn't be added with Status False.