Skip to content

Commit

Permalink
debug operator
Browse files Browse the repository at this point in the history
  • Loading branch information
rkthtrifork committed Aug 28, 2024
1 parent 7e5b010 commit c3d1743
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions opensearch-operator/pkg/reconcilers/indextemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"time"

opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1"
"github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests"
"github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses"
"github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services"
"github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers"
"github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s"
Expand Down Expand Up @@ -237,9 +239,7 @@ func (r *IndexTemplateReconciler) Reconcile() (retResult ctrl.Result, retErr err
}

// Return if there are no changes
r.logger.Info(spew.Sdump(existingTemplate))
r.logger.Info(spew.Sdump(newTemplate))
if r.instance.Spec.Name == existingTemplate.Name && cmp.Equal(*newTemplate, existingTemplate.IndexTemplate, cmpopts.EquateEmpty()) {
if r.equal(newTemplate, existingTemplate) {
r.logger.Info("Index template is in sync, no changes needed", "templateName", templateName)
r.recorder.Event(r.instance, "Normal", opensearchAPIUnchanged, "index template is in sync")
return ctrl.Result{
Expand Down Expand Up @@ -268,6 +268,12 @@ func (r *IndexTemplateReconciler) Reconcile() (retResult ctrl.Result, retErr err
}, nil
}

func (r *IndexTemplateReconciler) equal(request *requests.IndexTemplate, response *responses.IndexTemplate) bool {
r.logger.Info(spew.Sdump(request))
r.logger.Info(spew.Sdump(response.IndexTemplate))
return r.instance.Spec.Name == response.Name && cmp.Equal(request, response.IndexTemplate, cmpopts.EquateEmpty())
}

func (r *IndexTemplateReconciler) Delete() error {
// If we have never successfully reconciled we can just exit
if r.instance.Status.ExistingIndexTemplate == nil {
Expand Down

0 comments on commit c3d1743

Please sign in to comment.