Skip to content

Commit

Permalink
Merge pull request #179 from mengqiy/sort_webhooks
Browse files Browse the repository at this point in the history
sort webhooks
  • Loading branch information
k8s-ci-robot committed Oct 24, 2018
2 parents 97df191 + a468398 commit 4376e6e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/webhook/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"net/http"
"net/url"
"path"
"sort"
"strconv"

"k8s.io/api/admissionregistration/v1beta1"
Expand Down Expand Up @@ -237,6 +238,10 @@ func (s *Server) mutatingWHConfigs() (runtime.Object, error) {
mutatingWebhooks = append(mutatingWebhooks, *wh)
}

sort.Slice(mutatingWebhooks, func(i, j int) bool {
return mutatingWebhooks[i].Name < mutatingWebhooks[j].Name
})

if len(mutatingWebhooks) > 0 {
return &admissionregistration.MutatingWebhookConfiguration{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -268,6 +273,10 @@ func (s *Server) validatingWHConfigs() (runtime.Object, error) {
validatingWebhooks = append(validatingWebhooks, *wh)
}

sort.Slice(validatingWebhooks, func(i, j int) bool {
return validatingWebhooks[i].Name < validatingWebhooks[j].Name
})

if len(validatingWebhooks) > 0 {
return &admissionregistration.ValidatingWebhookConfiguration{
TypeMeta: metav1.TypeMeta{
Expand Down

0 comments on commit 4376e6e

Please sign in to comment.