@@ -10,7 +10,6 @@ import (
1010 kustomizev1beta2 "github.com/fluxcd/kustomize-controller/api/v1beta2"
1111 sourcev1 "github.com/fluxcd/source-controller/api/v1"
1212 "github.com/grafana/flux-commit-tracker/internal/oci"
13- lru "github.com/hashicorp/golang-lru/v2/expirable"
1413 otel "go.opentelemetry.io/otel"
1514 "go.opentelemetry.io/otel/attribute"
1615 "go.opentelemetry.io/otel/codes"
@@ -33,10 +32,6 @@ const (
3332 MetricE2EExportTime = Prefix + ".e2e.export-time"
3433
3534 InstrumentationScope = "tracker"
36-
37- ociRepositoryKind = "OCIRepository"
38- kubeManifestsOCIRepositoryName = "kube-manifests-oci"
39- o11yAppsPlatformOCIRepositoryName = "kube-manifests-oci-o11y-apps-platform"
4035)
4136
4237var (
@@ -74,10 +69,9 @@ func init() {
7469// taken from deployment-tools commits to flux apply.
7570type KustomizationReconciler struct {
7671 client.Client
77- Scheme * runtime.Scheme
78- Log * slog.Logger
79- OCI oci.Resolver
80- exporterInfoCache * lru.LRU [exporterInfoCacheKey , oci.ExporterInfo ]
72+ Scheme * runtime.Scheme
73+ Log * slog.Logger
74+ OCI oci.Resolver
8175}
8276
8377type reconciledState struct {
@@ -88,19 +82,6 @@ type reconciledState struct {
8882 TimeApplied time.Time
8983}
9084
91- func isTrackedKustomization (k * kustomizev1.Kustomization ) bool {
92- if k .Spec .SourceRef .Kind != ociRepositoryKind {
93- return false
94- }
95-
96- switch k .Spec .SourceRef .Name {
97- case kubeManifestsOCIRepositoryName , o11yAppsPlatformOCIRepositoryName :
98- return true
99- default :
100- return false
101- }
102- }
103-
10485// getKustomization fetches the Kustomization object from the cluster. It
10586// returns `nil, nil` if the object is not found.
10687func (r * KustomizationReconciler ) getKustomization (ctx context.Context , req ctrl.Request ) (* kustomizev1.Kustomization , error ) {
@@ -217,15 +198,6 @@ func (r *KustomizationReconciler) fetchExporterInfoFromOCI(ctx context.Context,
217198 return oci.ExporterInfo {}, fmt .Errorf ("failed to resolve OCIRepository URL: %w" , err )
218199 }
219200
220- cacheKey := exporterInfoCacheKey {
221- repositoryURL : repositoryURL ,
222- revision : appliedRevision ,
223- }
224- if info , ok := r .exporterInfoCache .Get (cacheKey ); ok {
225- log .DebugContext (ctx , "reusing cached exporter-info" , "oci.repository_url" , repositoryURL , "kustomization.revision" , appliedRevision )
226- return info , nil
227- }
228-
229201 timeoutCtx , cancel := context .WithTimeout (ctx , 30 * time .Second )
230202 defer cancel ()
231203
@@ -234,7 +206,6 @@ func (r *KustomizationReconciler) fetchExporterInfoFromOCI(ctx context.Context,
234206 return oci.ExporterInfo {}, fmt .Errorf ("failed to fetch exporter info from OCI layer: %w" , err )
235207 }
236208
237- r .exporterInfoCache .Add (cacheKey , info )
238209 return info , nil
239210}
240211
@@ -281,12 +252,6 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
281252 }
282253 span .SetAttributes (attribute .String ("k8s.resource.uid" , string (kustomization .UID )))
283254
284- if ! isTrackedKustomization (kustomization ) {
285- span .SetStatus (codes .Ok , "Kustomization is outside tracker scope" )
286- log .DebugContext (ctx , "ignoring unsupported kustomization" )
287- return ctrl.Result {}, nil
288- }
289-
290255 // 2. Extract Data
291256 state , err := extractReconciledState (ctx , log , kustomization )
292257 if err != nil {
@@ -340,7 +305,6 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
340305// SetupWithManager sets up the controller with the Manager
341306func (r * KustomizationReconciler ) SetupWithManager (mgr ctrl.Manager ) error {
342307 r .Scheme = mgr .GetScheme ()
343- r .exporterInfoCache = newExporterInfoCache ()
344308 return ctrl .NewControllerManagedBy (mgr ).
345309 For (& kustomizev1.Kustomization {}).
346310 WithEventFilter (kustomizationPredicate {}).
@@ -367,10 +331,6 @@ func (p kustomizationPredicate) Update(e event.UpdateEvent) bool {
367331 return false
368332 }
369333
370- if ! isTrackedKustomization (newKustomization ) {
371- return false
372- }
373-
374334 // Reconcile only if LastAppliedRevision changes and the new revision is not empty
375335 newRevision := newKustomization .Status .LastAppliedRevision
376336 if oldKustomization .Status .LastAppliedRevision != newRevision && newRevision != "" {
0 commit comments