Skip to content

Commit

Permalink
Merge pull request #54 from cybozu-go/fix-namespaces-order
Browse files Browse the repository at this point in the history
Sort namespace in generated configmaps
  • Loading branch information
zoetrope authored Jun 28, 2024
2 parents 66ae9c9 + dd6e5d9 commit 9e85ecf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions controllers/tenant_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"fmt"
"slices"
"strings"
"text/template"

Expand Down Expand Up @@ -611,6 +612,7 @@ func (r *TenantReconciler) updateConfigMap(ctx context.Context, controllerName s
namespaces = append(namespaces, ns.Name)
}
}
slices.Sort(namespaces)

op, err := ctrl.CreateOrUpdate(ctx, r.client, cm, func() error {
cm.Labels = map[string]string{
Expand All @@ -635,7 +637,7 @@ func (r *TenantReconciler) updateConfigMap(ctx context.Context, controllerName s
return err
}
if op != controllerutil.OperationResultNone {
logger.Info("ConfigMap successfully reconciled")
logger.Info("ConfigMap successfully reconciled", "namespaces", namespaces)
}

return nil
Expand Down Expand Up @@ -665,6 +667,7 @@ func (r *TenantReconciler) updateAllTenantNamespacesConfigMap(ctx context.Contex
allNamespaces = append(allNamespaces, ns.Name)
}
}
slices.Sort(allNamespaces)

op, err := ctrl.CreateOrUpdate(ctx, r.client, cm, func() error {
cm.Labels = map[string]string{
Expand All @@ -688,7 +691,7 @@ func (r *TenantReconciler) updateAllTenantNamespacesConfigMap(ctx context.Contex
return err
}
if op != controllerutil.OperationResultNone {
logger.Info("ConfigMap successfully reconciled")
logger.Info("ConfigMap successfully reconciled", "allNamespaces", allNamespaces)
}

return nil
Expand Down

0 comments on commit 9e85ecf

Please sign in to comment.