Skip to content

Commit 5e52ded

Browse files
committed
Revert "feat: add svc export trackability (Azure#1061)"
This reverts commit 22dc1a0.
1 parent b0efd02 commit 5e52ded

File tree

5 files changed

+3
-363
lines changed

5 files changed

+3
-363
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/spf13/pflag v1.0.5
2020
github.com/stretchr/testify v1.10.0
2121
github.com/wI2L/jsondiff v0.6.0
22-
go.goms.io/fleet-networking v0.3.5
22+
go.goms.io/fleet-networking v0.3.3
2323
go.uber.org/atomic v1.11.0
2424
go.uber.org/zap v1.27.0
2525
golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcY
253253
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
254254
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
255255
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
256-
go.goms.io/fleet-networking v0.3.5 h1:nR0LFEbpu9cfBwYFVV8cGB8OARemIwtzaaFpRpp1GtQ=
257-
go.goms.io/fleet-networking v0.3.5/go.mod h1:zegH1iEZScjUWiGnXL67D/ZfWTM9DBUaSo1gPWaxLek=
256+
go.goms.io/fleet-networking v0.3.3 h1:5rwBntaUoLF+E1CzaWAEL4GdvLJPQorKhjgkbLlllPE=
257+
go.goms.io/fleet-networking v0.3.3/go.mod h1:Qgbi8M1fGaz/p5rtb6HJPmTDATWRnMt9HD1gz57WKUc=
258258
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA=
259259
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg=
260260
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=

pkg/controllers/workapplier/availability_tracker.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,13 @@ import (
1414
policyv1 "k8s.io/api/policy/v1"
1515
apiextensionshelpers "k8s.io/apiextensions-apiserver/pkg/apihelpers"
1616
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
17-
"k8s.io/apimachinery/pkg/api/meta"
1817
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1918
"k8s.io/apimachinery/pkg/runtime"
2019
"k8s.io/apimachinery/pkg/runtime/schema"
2120
"k8s.io/component-helpers/apps/poddisruptionbudget"
2221
"k8s.io/klog/v2"
2322

24-
fleetnetworkingv1alpha1 "go.goms.io/fleet-networking/api/v1alpha1"
25-
"go.goms.io/fleet-networking/pkg/common/objectmeta"
26-
2723
"go.goms.io/fleet/pkg/utils"
28-
"go.goms.io/fleet/pkg/utils/condition"
2924
"go.goms.io/fleet/pkg/utils/controller"
3025
)
3126

@@ -88,8 +83,6 @@ func trackInMemberClusterObjAvailabilityByGVR(
8883
return trackCRDAvailability(inMemberClusterObj)
8984
case utils.PodDisruptionBudgetGVR:
9085
return trackPDBAvailability(inMemberClusterObj)
91-
case utils.ServiceExportGVR:
92-
return trackServiceExportAvailability(inMemberClusterObj)
9386
default:
9487
if isDataResource(*gvr) {
9588
klog.V(2).InfoS("The object from the member cluster is a data object, consider it to be immediately available",
@@ -254,44 +247,6 @@ func trackPDBAvailability(curObj *unstructured.Unstructured) (ManifestProcessing
254247
return ManifestProcessingAvailabilityResultTypeNotYetAvailable, nil
255248
}
256249

257-
// trackServiceExportAvailability tracks the availability of a service export in the member cluster.
258-
// It is available if the ServiceExportValid condition is true (will be false if annotation value is invalid).
259-
// If the weight is not 0, ServiceExportValid condition must be true and the ServiceExportConflict condition must be false.
260-
func trackServiceExportAvailability(curObj *unstructured.Unstructured) (ManifestProcessingAvailabilityResultType, error) {
261-
var svcExport fleetnetworkingv1alpha1.ServiceExport
262-
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(curObj.Object, &svcExport); err != nil {
263-
return ManifestProcessingAvailabilityResultTypeFailed, controller.NewUnexpectedBehaviorError(err)
264-
}
265-
266-
// Check if ServiceExport is valid and up to date
267-
svcExportObj := klog.KObj(curObj)
268-
validCond := meta.FindStatusCondition(svcExport.Status.Conditions, string(fleetnetworkingv1alpha1.ServiceExportValid))
269-
if !condition.IsConditionStatusTrue(validCond, svcExport.Generation) {
270-
klog.V(2).InfoS("Still need to wait for ServiceExport to be valid", "serviceExport", svcExportObj, "validCondition", validCond)
271-
return ManifestProcessingAvailabilityResultTypeNotYetAvailable, nil
272-
}
273-
// Validate annotation weight. Updating the annotation won't change the object generation,
274-
// so the current status is not reliable and need to validate the annotation again here
275-
weight, err := objectmeta.ExtractWeightFromServiceExport(&svcExport)
276-
if err != nil {
277-
klog.Errorf(err.Error(), "ServiceExport has invalid weight", "serviceExport", svcExportObj)
278-
return ManifestProcessingAvailabilityResultTypeNotYetAvailable, err
279-
}
280-
if weight != 0 {
281-
// Check conflict condition for non-zero weight
282-
conflictCond := meta.FindStatusCondition(svcExport.Status.Conditions, string(fleetnetworkingv1alpha1.ServiceExportConflict))
283-
if !condition.IsConditionStatusFalse(conflictCond, svcExport.Generation) {
284-
klog.V(2).InfoS("Still need to wait for ServiceExport to not have conflicts", "serviceExport", svcExportObj, "conflictCondition", conflictCond)
285-
return ManifestProcessingAvailabilityResultTypeNotYetAvailable, nil
286-
}
287-
} else {
288-
klog.V(2).InfoS("Skipping checking the conflict condition for the weight 0", "serviceExport", svcExportObj)
289-
}
290-
291-
klog.V(2).InfoS("ServiceExport is available", "serviceExport", svcExportObj)
292-
return ManifestProcessingAvailabilityResultTypeAvailable, nil
293-
}
294-
295250
// isDataResource checks if the resource is a data resource; such resources are
296251
// available immediately after creation.
297252
func isDataResource(gvr schema.GroupVersionResource) bool {

0 commit comments

Comments
 (0)