Skip to content

Commit

Permalink
[#815] Fix unexpected broker pod restarts caused by TRIGGERED_ROLL_COUNT
Browse files Browse the repository at this point in the history
The requestedResources need to be sorted because they are extracted from a map
and adler32 depends on the prder of the bytes.
  • Loading branch information
brusdev authored and gaohoward committed Mar 7, 2024
1 parent bab7a3e commit c98ed8c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/activemqartemis_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/artemiscloud/activemq-artemis-operator/version"
"github.com/go-logr/logr"
"github.com/pkg/errors"
"golang.org/x/exp/slices"
"k8s.io/apimachinery/pkg/api/equality"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
Expand Down Expand Up @@ -175,6 +176,11 @@ func (reconciler *ActiveMQArtemisReconcilerImpl) Process(customResource *brokerv
}

func trackSecretCheckSumInEnvVar(requestedResources []rtclient.Object, container []corev1.Container) {
// the requestedResources need to be sorted because they are extracted
// from a map and adler32 depends on the prder of the bytes
slices.SortFunc(requestedResources, func(a rtclient.Object, b rtclient.Object) bool {
return a.GetName() < b.GetName()
})

// find desired secrets and checksum their 'sorted' values
digest := adler32.New()
Expand Down

0 comments on commit c98ed8c

Please sign in to comment.