mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
use utilsets.NewString
This commit is contained in:
parent
51b75460aa
commit
077dd28df4
@ -21,6 +21,7 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
|
||||||
"//vendor/github.com/emicklei/go-restful:go_default_library",
|
"//vendor/github.com/emicklei/go-restful:go_default_library",
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
|
@ -21,7 +21,6 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -30,6 +29,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/apis/meta/v1/validation"
|
"k8s.io/apimachinery/pkg/apis/meta/v1/validation"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||||
|
utilsets "k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apiserver/pkg/endpoints/request"
|
"k8s.io/apiserver/pkg/endpoints/request"
|
||||||
|
|
||||||
"github.com/emicklei/go-restful"
|
"github.com/emicklei/go-restful"
|
||||||
@ -333,20 +333,9 @@ func cleanDryRun(dryRun []string) string {
|
|||||||
if errs := validation.ValidateDryRun(nil, dryRun); len(errs) > 0 {
|
if errs := validation.ValidateDryRun(nil, dryRun); len(errs) > 0 {
|
||||||
return "invalid"
|
return "invalid"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since dryRun could be valid with any arbitrarily long length
|
// Since dryRun could be valid with any arbitrarily long length
|
||||||
// we have to dedup and sort the elements before joining them together
|
// we have to dedup and sort the elements before joining them together
|
||||||
dryRunSet := map[string]bool{}
|
return strings.Join(utilsets.NewString(dryRun...).List(), ",")
|
||||||
for _, element := range dryRun {
|
|
||||||
dryRunSet[element] = true
|
|
||||||
}
|
|
||||||
dryRunUnique := []string{}
|
|
||||||
for element := range dryRunSet {
|
|
||||||
dryRunUnique = append(dryRunUnique, element)
|
|
||||||
}
|
|
||||||
sort.Strings(dryRunUnique)
|
|
||||||
|
|
||||||
return strings.Join(dryRunUnique, ",")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanUserAgent(ua string) string {
|
func cleanUserAgent(ua string) string {
|
||||||
|
Loading…
Reference in New Issue
Block a user