diff --git a/adapter/internal/operator/controllers/dp/api_controller.go b/adapter/internal/operator/controllers/dp/api_controller.go index 21a302200b..4ad8cf06d8 100644 --- a/adapter/internal/operator/controllers/dp/api_controller.go +++ b/adapter/internal/operator/controllers/dp/api_controller.go @@ -109,13 +109,11 @@ type APIReconciler struct { statusUpdater *status.UpdateHandler mgr manager.Manager apiPropagationEnabled bool - apiHashes map[string]string } // NewAPIController creates a new API controller instance. API Controllers watches for dpv1alpha2.API and gwapiv1b1.HTTPRoute. func NewAPIController(mgr manager.Manager, operatorDataStore *synchronizer.OperatorDataStore, statusUpdater *status.UpdateHandler, ch *chan *synchronizer.APIEvent, successChannel *chan synchronizer.SuccessEvent) error { - apiHash := make(map[string]string) apiReconciler := &APIReconciler{ client: mgr.GetClient(), ods: operatorDataStore, @@ -123,7 +121,6 @@ func NewAPIController(mgr manager.Manager, operatorDataStore *synchronizer.Opera successChannel: successChannel, statusUpdater: statusUpdater, mgr: mgr, - apiHashes: apiHash, } ctx := context.Background() c, err := controller.New(constants.APIController, mgr, controller.Options{Reconciler: apiReconciler}) @@ -258,8 +255,6 @@ func (apiReconciler *APIReconciler) Reconcile(ctx context.Context, req ctrl.Requ var apiCR dpv1alpha2.API if err := apiReconciler.client.Get(ctx, req.NamespacedName, &apiCR); err != nil { apiState, found := apiReconciler.ods.GetCachedAPI(req.NamespacedName) - // remove the hash from the api hashes map if presents - delete(apiReconciler.apiHashes, req.NamespacedName.String()) if found && k8error.IsNotFound(err) { if apiReconciler.apiPropagationEnabled { // Convert api state to api cp data @@ -446,7 +441,6 @@ func (apiReconciler *APIReconciler) resolveAPIRefs(ctx context.Context, api dpv1 } loggers.LoggerAPKOperator.Debugf("Child references are retrieved successfully for API CR %s", apiRef.String()) - apiNamespacedName := utils.NamespacedName(apiState.APIDefinition).String() storedHash, hashFound := apiState.APIDefinition.ObjectMeta.Labels["apiHash"] if !api.Status.DeploymentStatus.Accepted { if apiReconciler.apiPropagationEnabled && !apiState.APIDefinition.Spec.SystemAPI { @@ -454,7 +448,6 @@ func (apiReconciler *APIReconciler) resolveAPIRefs(ctx context.Context, api dpv1 if !hashFound || storedHash != apiHash { apiReconciler.patchAPIHash(ctx, apiHash, apiState.APIDefinition.ObjectMeta.Name, apiState.APIDefinition.ObjectMeta.Namespace) loggers.LoggerAPKOperator.Infof("API hash changed sending the API to agent") - apiReconciler.apiHashes[apiNamespacedName] = apiHash // Publish the api data to CP apiCpData := apiReconciler.convertAPIStateToAPICp(ctx, *apiState) apiCpData.Event = controlplane.EventTypeCreate @@ -471,7 +464,6 @@ func (apiReconciler *APIReconciler) resolveAPIRefs(ctx context.Context, api dpv1 if !hashFound || storedHash != apiHash { apiReconciler.patchAPIHash(ctx, apiHash, apiState.APIDefinition.ObjectMeta.Name, apiState.APIDefinition.ObjectMeta.Namespace) loggers.LoggerAPKOperator.Infof("API hash changed sending the API to agent") - apiReconciler.apiHashes[apiNamespacedName] = apiHash // Publish the api data to CP apiCpData := apiReconciler.convertAPIStateToAPICp(ctx, *apiState) apiCpData.Event = controlplane.EventTypeUpdate