Skip to content

Commit

Permalink
Merge pull request kubernetes-retired#898 from aledbf/sort-locations
Browse files Browse the repository at this point in the history
NGINX Ingress controller Sort locations
  • Loading branch information
bprashanth committed May 4, 2016
2 parents dabfa9f + 3e3de84 commit 2db2324
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/nginx/nginx/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ type Location struct {
}

// LocationByPath sorts location by path
// Location / is the last one
type LocationByPath []*Location

func (c LocationByPath) Len() int { return len(c) }
func (c LocationByPath) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
func (c LocationByPath) Less(i, j int) bool {
return c[i].Path < c[j].Path
return c[i].Path > c[j].Path
}

// NewDefaultServer return an UpstreamServer to be use as default server that returns 503.
Expand Down

0 comments on commit 2db2324

Please sign in to comment.