Implemented the application of policies in order of their creation timestamps.
@@ -4,6 +4,7 @@ import (
"errors"
"log"
"os"
+ "sort"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -82,6 +83,10 @@ func (c *PolicyController) GetPolicies() []types.Policy {
policies = append(policies, *elem.DeepCopy())
}
+ sort.Slice(policies, func(i, j int) bool {
+ return policies[i].CreationTimestamp.Time.Before(policies[j].CreationTimestamp.Time)
+ })
+
return policies
}
