mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-08 18:15:48 +00:00
NK-31: Implemented the application of policies in order of their creation timestamps.
This commit is contained in:
parent
85c84046af
commit
647985ed80
1 changed files with 5 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue