git subrepo clone (merge) https://github.com/kubernetes-incubator/metrics-server.git metrics-server
subrepo:
subdir: "metrics-server"
merged: "92d8412"
upstream:
origin: "https://github.com/kubernetes-incubator/metrics-server.git"
branch: "master"
commit: "92d8412"
git-subrepo:
version: "0.4.0"
origin: "???"
commit: "???"
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/ciphersuites_flag.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/ciphersuites_flag.go
new file mode 100644
index 0000000..764747c
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/ciphersuites_flag.go
@@ -0,0 +1,105 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ "crypto/tls"
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/util/sets"
+)
+
+// ciphers maps strings into tls package cipher constants in
+// https://golang.org/pkg/crypto/tls/#pkg-constants
+var ciphers = map[string]uint16{
+ "TLS_RSA_WITH_RC4_128_SHA": tls.TLS_RSA_WITH_RC4_128_SHA,
+ "TLS_RSA_WITH_3DES_EDE_CBC_SHA": tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
+ "TLS_RSA_WITH_AES_128_CBC_SHA": tls.TLS_RSA_WITH_AES_128_CBC_SHA,
+ "TLS_RSA_WITH_AES_256_CBC_SHA": tls.TLS_RSA_WITH_AES_256_CBC_SHA,
+ "TLS_RSA_WITH_AES_128_CBC_SHA256": tls.TLS_RSA_WITH_AES_128_CBC_SHA256,
+ "TLS_RSA_WITH_AES_128_GCM_SHA256": tls.TLS_RSA_WITH_AES_128_GCM_SHA256,
+ "TLS_RSA_WITH_AES_256_GCM_SHA384": tls.TLS_RSA_WITH_AES_256_GCM_SHA384,
+ "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA": tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
+ "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
+ "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
+ "TLS_ECDHE_RSA_WITH_RC4_128_SHA": tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA,
+ "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA": tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
+ "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
+ "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
+ "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
+ "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256": tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
+ "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
+ "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
+ "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
+ "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384": tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
+ "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305": tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
+ "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305": tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
+}
+
+func TLSCipherPossibleValues() []string {
+ cipherKeys := sets.NewString()
+ for key := range ciphers {
+ cipherKeys.Insert(key)
+ }
+ return cipherKeys.List()
+}
+
+func TLSCipherSuites(cipherNames []string) ([]uint16, error) {
+ if len(cipherNames) == 0 {
+ return nil, nil
+ }
+ ciphersIntSlice := make([]uint16, 0)
+ for _, cipher := range cipherNames {
+ intValue, ok := ciphers[cipher]
+ if !ok {
+ return nil, fmt.Errorf("Cipher suite %s not supported or doesn't exist", cipher)
+ }
+ ciphersIntSlice = append(ciphersIntSlice, intValue)
+ }
+ return ciphersIntSlice, nil
+}
+
+var versions = map[string]uint16{
+ "VersionTLS10": tls.VersionTLS10,
+ "VersionTLS11": tls.VersionTLS11,
+ "VersionTLS12": tls.VersionTLS12,
+}
+
+func TLSPossibleVersions() []string {
+ versionsKeys := sets.NewString()
+ for key := range versions {
+ versionsKeys.Insert(key)
+ }
+ return versionsKeys.List()
+}
+
+func TLSVersion(versionName string) (uint16, error) {
+ if len(versionName) == 0 {
+ return DefaultTLSVersion(), nil
+ }
+ if version, ok := versions[versionName]; ok {
+ return version, nil
+ }
+ return 0, fmt.Errorf("unknown tls version %q", versionName)
+}
+
+func DefaultTLSVersion() uint16 {
+ // Can't use SSLv3 because of POODLE and BEAST
+ // Can't use TLSv1.0 because of POODLE and BEAST using CBC cipher
+ // Can't use TLSv1.1 because of RC4 cipher usage
+ return tls.VersionTLS12
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/colon_separated_multimap_string_string.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/colon_separated_multimap_string_string.go
new file mode 100644
index 0000000..bd2cf5f
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/colon_separated_multimap_string_string.go
@@ -0,0 +1,102 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ "fmt"
+ "sort"
+ "strings"
+)
+
+// ColonSeparatedMultimapStringString supports setting a map[string][]string from an encoding
+// that separates keys from values with ':' and separates key-value pairs with ','.
+// A key can be repeated multiple times, in which case the values are appended to a
+// slice of strings associated with that key. Items in the list associated with a given
+// key will appear in the order provided.
+// For example: `a:hello,b:again,c:world,b:beautiful` results in `{"a": ["hello"], "b": ["again", "beautiful"], "c": ["world"]}`
+// The first call to Set will clear the map before adding entries; subsequent calls will simply append to the map.
+// This makes it possible to override default values with a command-line option rather than appending to defaults,
+// while still allowing the distribution of key-value pairs across multiple flag invocations.
+// For example: `--flag "a:hello" --flag "b:again" --flag "b:beautiful" --flag "c:world"` results in `{"a": ["hello"], "b": ["again", "beautiful"], "c": ["world"]}`
+type ColonSeparatedMultimapStringString struct {
+ Multimap *map[string][]string
+ initialized bool // set to true after the first Set call
+}
+
+// NewColonSeparatedMultimapStringString takes a pointer to a map[string][]string and returns the
+// ColonSeparatedMultimapStringString flag parsing shim for that map.
+func NewColonSeparatedMultimapStringString(m *map[string][]string) *ColonSeparatedMultimapStringString {
+ return &ColonSeparatedMultimapStringString{Multimap: m}
+}
+
+// Set implements github.com/spf13/pflag.Value
+func (m *ColonSeparatedMultimapStringString) Set(value string) error {
+ if m.Multimap == nil {
+ return fmt.Errorf("no target (nil pointer to map[string][]string)")
+ }
+ if !m.initialized || *m.Multimap == nil {
+ // clear default values, or allocate if no existing map
+ *m.Multimap = make(map[string][]string)
+ m.initialized = true
+ }
+ for _, pair := range strings.Split(value, ",") {
+ if len(pair) == 0 {
+ continue
+ }
+ kv := strings.SplitN(pair, ":", 2)
+ if len(kv) != 2 {
+ return fmt.Errorf("malformed pair, expect string:string")
+ }
+ k := strings.TrimSpace(kv[0])
+ v := strings.TrimSpace(kv[1])
+ (*m.Multimap)[k] = append((*m.Multimap)[k], v)
+ }
+ return nil
+}
+
+// String implements github.com/spf13/pflag.Value
+func (m *ColonSeparatedMultimapStringString) String() string {
+ type kv struct {
+ k string
+ v string
+ }
+ kvs := make([]kv, 0, len(*m.Multimap))
+ for k, vs := range *m.Multimap {
+ for i := range vs {
+ kvs = append(kvs, kv{k: k, v: vs[i]})
+ }
+ }
+ // stable sort by keys, order of values should be preserved
+ sort.SliceStable(kvs, func(i, j int) bool {
+ return kvs[i].k < kvs[j].k
+ })
+ pairs := make([]string, 0, len(kvs))
+ for i := range kvs {
+ pairs = append(pairs, fmt.Sprintf("%s:%s", kvs[i].k, kvs[i].v))
+ }
+ return strings.Join(pairs, ",")
+}
+
+// Type implements github.com/spf13/pflag.Value
+func (m *ColonSeparatedMultimapStringString) Type() string {
+ return "colonSeparatedMultimapStringString"
+}
+
+// Empty implements OmitEmpty
+func (m *ColonSeparatedMultimapStringString) Empty() bool {
+ return len(*m.Multimap) == 0
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/configuration_map.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/configuration_map.go
new file mode 100644
index 0000000..911b05e
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/configuration_map.go
@@ -0,0 +1,53 @@
+/*
+Copyright 2014 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ "fmt"
+ "sort"
+ "strings"
+)
+
+type ConfigurationMap map[string]string
+
+func (m *ConfigurationMap) String() string {
+ pairs := []string{}
+ for k, v := range *m {
+ pairs = append(pairs, fmt.Sprintf("%s=%s", k, v))
+ }
+ sort.Strings(pairs)
+ return strings.Join(pairs, ",")
+}
+
+func (m *ConfigurationMap) Set(value string) error {
+ for _, s := range strings.Split(value, ",") {
+ if len(s) == 0 {
+ continue
+ }
+ arr := strings.SplitN(s, "=", 2)
+ if len(arr) == 2 {
+ (*m)[strings.TrimSpace(arr[0])] = strings.TrimSpace(arr[1])
+ } else {
+ (*m)[strings.TrimSpace(arr[0])] = ""
+ }
+ }
+ return nil
+}
+
+func (*ConfigurationMap) Type() string {
+ return "mapStringString"
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/flags.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/flags.go
new file mode 100644
index 0000000..55a3ed3
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/flags.go
@@ -0,0 +1,54 @@
+/*
+Copyright 2014 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ goflag "flag"
+ "strings"
+
+ "github.com/golang/glog"
+ "github.com/spf13/pflag"
+)
+
+// WordSepNormalizeFunc changes all flags that contain "_" separators
+func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
+ if strings.Contains(name, "_") {
+ return pflag.NormalizedName(strings.Replace(name, "_", "-", -1))
+ }
+ return pflag.NormalizedName(name)
+}
+
+// WarnWordSepNormalizeFunc changes and warns for flags that contain "_" separators
+func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
+ if strings.Contains(name, "_") {
+ nname := strings.Replace(name, "_", "-", -1)
+ glog.Warningf("%s is DEPRECATED and will be removed in a future version. Use %s instead.", name, nname)
+
+ return pflag.NormalizedName(nname)
+ }
+ return pflag.NormalizedName(name)
+}
+
+// InitFlags normalizes, parses, then logs the command line flags
+func InitFlags() {
+ pflag.CommandLine.SetNormalizeFunc(WordSepNormalizeFunc)
+ pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
+ pflag.Parse()
+ pflag.VisitAll(func(flag *pflag.Flag) {
+ glog.V(2).Infof("FLAG: --%s=%q", flag.Name, flag.Value)
+ })
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/langle_separated_map_string_string.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/langle_separated_map_string_string.go
new file mode 100644
index 0000000..bf8dbfb
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/langle_separated_map_string_string.go
@@ -0,0 +1,82 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ "fmt"
+ "sort"
+ "strings"
+)
+
+// LangleSeparatedMapStringString can be set from the command line with the format `--flag "string<string"`.
+// Multiple comma-separated key-value pairs in a single invocation are supported. For example: `--flag "a<foo,b<bar"`.
+// Multiple flag invocations are supported. For example: `--flag "a<foo" --flag "b<foo"`.
+type LangleSeparatedMapStringString struct {
+ Map *map[string]string
+ initialized bool // set to true after first Set call
+}
+
+// NewLangleSeparatedMapStringString takes a pointer to a map[string]string and returns the
+// LangleSeparatedMapStringString flag parsing shim for that map
+func NewLangleSeparatedMapStringString(m *map[string]string) *LangleSeparatedMapStringString {
+ return &LangleSeparatedMapStringString{Map: m}
+}
+
+// String implements github.com/spf13/pflag.Value
+func (m *LangleSeparatedMapStringString) String() string {
+ pairs := []string{}
+ for k, v := range *m.Map {
+ pairs = append(pairs, fmt.Sprintf("%s<%s", k, v))
+ }
+ sort.Strings(pairs)
+ return strings.Join(pairs, ",")
+}
+
+// Set implements github.com/spf13/pflag.Value
+func (m *LangleSeparatedMapStringString) Set(value string) error {
+ if m.Map == nil {
+ return fmt.Errorf("no target (nil pointer to map[string]string)")
+ }
+ if !m.initialized || *m.Map == nil {
+ // clear default values, or allocate if no existing map
+ *m.Map = make(map[string]string)
+ m.initialized = true
+ }
+ for _, s := range strings.Split(value, ",") {
+ if len(s) == 0 {
+ continue
+ }
+ arr := strings.SplitN(s, "<", 2)
+ if len(arr) != 2 {
+ return fmt.Errorf("malformed pair, expect string<string")
+ }
+ k := strings.TrimSpace(arr[0])
+ v := strings.TrimSpace(arr[1])
+ (*m.Map)[k] = v
+ }
+ return nil
+}
+
+// Type implements github.com/spf13/pflag.Value
+func (*LangleSeparatedMapStringString) Type() string {
+ return "mapStringString"
+}
+
+// Empty implements OmitEmpty
+func (m *LangleSeparatedMapStringString) Empty() bool {
+ return len(*m.Map) == 0
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/map_string_bool.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/map_string_bool.go
new file mode 100644
index 0000000..e5a0180
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/map_string_bool.go
@@ -0,0 +1,90 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ "fmt"
+ "sort"
+ "strconv"
+ "strings"
+)
+
+// MapStringBool can be set from the command line with the format `--flag "string=bool"`.
+// Multiple comma-separated key-value pairs in a single invocation are supported. For example: `--flag "a=true,b=false"`.
+// Multiple flag invocations are supported. For example: `--flag "a=true" --flag "b=false"`.
+type MapStringBool struct {
+ Map *map[string]bool
+ initialized bool
+}
+
+// NewMapStringBool takes a pointer to a map[string]string and returns the
+// MapStringBool flag parsing shim for that map
+func NewMapStringBool(m *map[string]bool) *MapStringBool {
+ return &MapStringBool{Map: m}
+}
+
+// String implements github.com/spf13/pflag.Value
+func (m *MapStringBool) String() string {
+ if m == nil || m.Map == nil {
+ return ""
+ }
+ pairs := []string{}
+ for k, v := range *m.Map {
+ pairs = append(pairs, fmt.Sprintf("%s=%t", k, v))
+ }
+ sort.Strings(pairs)
+ return strings.Join(pairs, ",")
+}
+
+// Set implements github.com/spf13/pflag.Value
+func (m *MapStringBool) Set(value string) error {
+ if m.Map == nil {
+ return fmt.Errorf("no target (nil pointer to map[string]bool)")
+ }
+ if !m.initialized || *m.Map == nil {
+ // clear default values, or allocate if no existing map
+ *m.Map = make(map[string]bool)
+ m.initialized = true
+ }
+ for _, s := range strings.Split(value, ",") {
+ if len(s) == 0 {
+ continue
+ }
+ arr := strings.SplitN(s, "=", 2)
+ if len(arr) != 2 {
+ return fmt.Errorf("malformed pair, expect string=bool")
+ }
+ k := strings.TrimSpace(arr[0])
+ v := strings.TrimSpace(arr[1])
+ boolValue, err := strconv.ParseBool(v)
+ if err != nil {
+ return fmt.Errorf("invalid value of %s: %s, err: %v", k, v, err)
+ }
+ (*m.Map)[k] = boolValue
+ }
+ return nil
+}
+
+// Type implements github.com/spf13/pflag.Value
+func (*MapStringBool) Type() string {
+ return "mapStringBool"
+}
+
+// Empty implements OmitEmpty
+func (m *MapStringBool) Empty() bool {
+ return len(*m.Map) == 0
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/map_string_string.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/map_string_string.go
new file mode 100644
index 0000000..129470b
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/map_string_string.go
@@ -0,0 +1,112 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ "fmt"
+ "sort"
+ "strings"
+)
+
+// MapStringString can be set from the command line with the format `--flag "string=string"`.
+// Multiple flag invocations are supported. For example: `--flag "a=foo" --flag "b=bar"`. If this is desired
+// to be the only type invocation `NoSplit` should be set to true.
+// Multiple comma-separated key-value pairs in a single invocation are supported if `NoSplit`
+// is set to false. For example: `--flag "a=foo,b=bar"`.
+type MapStringString struct {
+ Map *map[string]string
+ initialized bool
+ NoSplit bool
+}
+
+// NewMapStringString takes a pointer to a map[string]string and returns the
+// MapStringString flag parsing shim for that map
+func NewMapStringString(m *map[string]string) *MapStringString {
+ return &MapStringString{Map: m}
+}
+
+// NewMapStringString takes a pointer to a map[string]string and sets `NoSplit`
+// value to `true` and returns the MapStringString flag parsing shim for that map
+func NewMapStringStringNoSplit(m *map[string]string) *MapStringString {
+ return &MapStringString{
+ Map: m,
+ NoSplit: true,
+ }
+}
+
+// String implements github.com/spf13/pflag.Value
+func (m *MapStringString) String() string {
+ if m == nil || m.Map == nil {
+ return ""
+ }
+ pairs := []string{}
+ for k, v := range *m.Map {
+ pairs = append(pairs, fmt.Sprintf("%s=%s", k, v))
+ }
+ sort.Strings(pairs)
+ return strings.Join(pairs, ",")
+}
+
+// Set implements github.com/spf13/pflag.Value
+func (m *MapStringString) Set(value string) error {
+ if m.Map == nil {
+ return fmt.Errorf("no target (nil pointer to map[string]string)")
+ }
+ if !m.initialized || *m.Map == nil {
+ // clear default values, or allocate if no existing map
+ *m.Map = make(map[string]string)
+ m.initialized = true
+ }
+
+ // account for comma-separated key-value pairs in a single invocation
+ if !m.NoSplit {
+ for _, s := range strings.Split(value, ",") {
+ if len(s) == 0 {
+ continue
+ }
+ arr := strings.SplitN(s, "=", 2)
+ if len(arr) != 2 {
+ return fmt.Errorf("malformed pair, expect string=string")
+ }
+ k := strings.TrimSpace(arr[0])
+ v := strings.TrimSpace(arr[1])
+ (*m.Map)[k] = v
+ }
+ return nil
+ }
+
+ // account for only one key-value pair in a single invocation
+ arr := strings.SplitN(value, "=", 2)
+ if len(arr) != 2 {
+ return fmt.Errorf("malformed pair, expect string=string")
+ }
+ k := strings.TrimSpace(arr[0])
+ v := strings.TrimSpace(arr[1])
+ (*m.Map)[k] = v
+ return nil
+
+}
+
+// Type implements github.com/spf13/pflag.Value
+func (*MapStringString) Type() string {
+ return "mapStringString"
+}
+
+// Empty implements OmitEmpty
+func (m *MapStringString) Empty() bool {
+ return len(*m.Map) == 0
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/namedcertkey_flag.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/namedcertkey_flag.go
new file mode 100644
index 0000000..bc68677
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/namedcertkey_flag.go
@@ -0,0 +1,113 @@
+/*
+Copyright 2016 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ "errors"
+ "flag"
+ "strings"
+)
+
+// NamedCertKey is a flag value parsing "certfile,keyfile" and "certfile,keyfile:name,name,name".
+type NamedCertKey struct {
+ Names []string
+ CertFile, KeyFile string
+}
+
+var _ flag.Value = &NamedCertKey{}
+
+func (nkc *NamedCertKey) String() string {
+ s := nkc.CertFile + "," + nkc.KeyFile
+ if len(nkc.Names) > 0 {
+ s = s + ":" + strings.Join(nkc.Names, ",")
+ }
+ return s
+}
+
+func (nkc *NamedCertKey) Set(value string) error {
+ cs := strings.SplitN(value, ":", 2)
+ var keycert string
+ if len(cs) == 2 {
+ var names string
+ keycert, names = strings.TrimSpace(cs[0]), strings.TrimSpace(cs[1])
+ if names == "" {
+ return errors.New("empty names list is not allowed")
+ }
+ nkc.Names = nil
+ for _, name := range strings.Split(names, ",") {
+ nkc.Names = append(nkc.Names, strings.TrimSpace(name))
+ }
+ } else {
+ nkc.Names = nil
+ keycert = strings.TrimSpace(cs[0])
+ }
+ cs = strings.Split(keycert, ",")
+ if len(cs) != 2 {
+ return errors.New("expected comma separated certificate and key file paths")
+ }
+ nkc.CertFile = strings.TrimSpace(cs[0])
+ nkc.KeyFile = strings.TrimSpace(cs[1])
+ return nil
+}
+
+func (*NamedCertKey) Type() string {
+ return "namedCertKey"
+}
+
+// NamedCertKeyArray is a flag value parsing NamedCertKeys, each passed with its own
+// flag instance (in contrast to comma separated slices).
+type NamedCertKeyArray struct {
+ value *[]NamedCertKey
+ changed bool
+}
+
+var _ flag.Value = &NamedCertKey{}
+
+// NewNamedKeyCertArray creates a new NamedCertKeyArray with the internal value
+// pointing to p.
+func NewNamedCertKeyArray(p *[]NamedCertKey) *NamedCertKeyArray {
+ return &NamedCertKeyArray{
+ value: p,
+ }
+}
+
+func (a *NamedCertKeyArray) Set(val string) error {
+ nkc := NamedCertKey{}
+ err := nkc.Set(val)
+ if err != nil {
+ return err
+ }
+ if !a.changed {
+ *a.value = []NamedCertKey{nkc}
+ a.changed = true
+ } else {
+ *a.value = append(*a.value, nkc)
+ }
+ return nil
+}
+
+func (a *NamedCertKeyArray) Type() string {
+ return "namedCertKey"
+}
+
+func (a *NamedCertKeyArray) String() string {
+ nkcs := make([]string, 0, len(*a.value))
+ for i := range *a.value {
+ nkcs = append(nkcs, (*a.value)[i].String())
+ }
+ return "[" + strings.Join(nkcs, ";") + "]"
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/noop.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/noop.go
new file mode 100644
index 0000000..03f7f14
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/noop.go
@@ -0,0 +1,41 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ goflag "flag"
+ "github.com/spf13/pflag"
+)
+
+// NoOp implements goflag.Value and plfag.Value,
+// but has a noop Set implementation
+type NoOp struct{}
+
+var _ goflag.Value = NoOp{}
+var _ pflag.Value = NoOp{}
+
+func (NoOp) String() string {
+ return ""
+}
+
+func (NoOp) Set(val string) error {
+ return nil
+}
+
+func (NoOp) Type() string {
+ return "NoOp"
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/omitempty.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/omitempty.go
new file mode 100644
index 0000000..c354754
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/omitempty.go
@@ -0,0 +1,24 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+// OmitEmpty is an interface for flags to report whether their underlying value
+// is "empty." If a flag implements OmitEmpty and returns true for a call to Empty(),
+// it is assumed that flag may be omitted from the command line.
+type OmitEmpty interface {
+ Empty() bool
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/string_flag.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/string_flag.go
new file mode 100644
index 0000000..331bdb6
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/string_flag.go
@@ -0,0 +1,56 @@
+/*
+Copyright 2014 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+// StringFlag is a string flag compatible with flags and pflags that keeps track of whether it had a value supplied or not.
+type StringFlag struct {
+ // If Set has been invoked this value is true
+ provided bool
+ // The exact value provided on the flag
+ value string
+}
+
+func NewStringFlag(defaultVal string) StringFlag {
+ return StringFlag{value: defaultVal}
+}
+
+func (f *StringFlag) Default(value string) {
+ f.value = value
+}
+
+func (f StringFlag) String() string {
+ return f.value
+}
+
+func (f StringFlag) Value() string {
+ return f.value
+}
+
+func (f *StringFlag) Set(value string) error {
+ f.value = value
+ f.provided = true
+
+ return nil
+}
+
+func (f StringFlag) Provided() bool {
+ return f.provided
+}
+
+func (f *StringFlag) Type() string {
+ return "string"
+}
diff --git a/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/tristate.go b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/tristate.go
new file mode 100644
index 0000000..cf16376
--- /dev/null
+++ b/metrics-server/vendor/k8s.io/apiserver/pkg/util/flag/tristate.go
@@ -0,0 +1,83 @@
+/*
+Copyright 2014 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package flag
+
+import (
+ "fmt"
+ "strconv"
+)
+
+// Tristate is a flag compatible with flags and pflags that
+// keeps track of whether it had a value supplied or not.
+type Tristate int
+
+const (
+ Unset Tristate = iota // 0
+ True
+ False
+)
+
+func (f *Tristate) Default(value bool) {
+ *f = triFromBool(value)
+}
+
+func (f Tristate) String() string {
+ b := boolFromTri(f)
+ return fmt.Sprintf("%t", b)
+}
+
+func (f Tristate) Value() bool {
+ b := boolFromTri(f)
+ return b
+}
+
+func (f *Tristate) Set(value string) error {
+ boolVal, err := strconv.ParseBool(value)
+ if err != nil {
+ return err
+ }
+
+ *f = triFromBool(boolVal)
+ return nil
+}
+
+func (f Tristate) Provided() bool {
+ if f != Unset {
+ return true
+ }
+ return false
+}
+
+func (f *Tristate) Type() string {
+ return "tristate"
+}
+
+func boolFromTri(t Tristate) bool {
+ if t == True {
+ return true
+ } else {
+ return false
+ }
+}
+
+func triFromBool(b bool) Tristate {
+ if b {
+ return True
+ } else {
+ return False
+ }
+}