Update dependencies to K8s 1.8
This commit is contained in:
parent
ba6c89672d
commit
6a59f4c9a2
1114 changed files with 160955 additions and 262845 deletions
23
vendor/k8s.io/client-go/tools/clientcmd/BUILD
generated
vendored
23
vendor/k8s.io/client-go/tools/clientcmd/BUILD
generated
vendored
|
|
@ -1,7 +1,5 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
|
|
@ -14,13 +12,14 @@ go_test(
|
|||
"client_config_test.go",
|
||||
"loader_test.go",
|
||||
"merged_client_builder_test.go",
|
||||
"overrides_test.go",
|
||||
"validation_test.go",
|
||||
],
|
||||
library = ":go_default_library",
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/github.com/ghodss/yaml:go_default_library",
|
||||
"//vendor/github.com/imdario/mergo:go_default_library",
|
||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
|
|
@ -36,13 +35,13 @@ go_library(
|
|||
"client_config.go",
|
||||
"config.go",
|
||||
"doc.go",
|
||||
"flag.go",
|
||||
"helpers.go",
|
||||
"loader.go",
|
||||
"merged_client_builder.go",
|
||||
"overrides.go",
|
||||
"validation.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/howeyc/gopass:go_default_library",
|
||||
|
|
@ -60,3 +59,19 @@ go_library(
|
|||
"//vendor/k8s.io/client-go/util/homedir:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//staging/src/k8s.io/client-go/tools/clientcmd/api:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
|
|
|||
21
vendor/k8s.io/client-go/tools/clientcmd/api/BUILD
generated
vendored
21
vendor/k8s.io/client-go/tools/clientcmd/api/BUILD
generated
vendored
|
|
@ -1,7 +1,5 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
|
|
@ -15,7 +13,6 @@ go_test(
|
|||
"types_test.go",
|
||||
],
|
||||
library = ":go_default_library",
|
||||
tags = ["automanaged"],
|
||||
deps = ["//vendor/github.com/ghodss/yaml:go_default_library"],
|
||||
)
|
||||
|
||||
|
|
@ -28,10 +25,26 @@ go_library(
|
|||
"types.go",
|
||||
"zz_generated.deepcopy.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//staging/src/k8s.io/client-go/tools/clientcmd/api/latest:all-srcs",
|
||||
"//staging/src/k8s.io/client-go/tools/clientcmd/api/v1:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
|
|
|||
16
vendor/k8s.io/client-go/tools/clientcmd/api/latest/BUILD
generated
vendored
16
vendor/k8s.io/client-go/tools/clientcmd/api/latest/BUILD
generated
vendored
|
|
@ -1,7 +1,5 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
|
|
@ -10,7 +8,6 @@ load(
|
|||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["latest.go"],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
|
|
@ -20,3 +17,16 @@ go_library(
|
|||
"//vendor/k8s.io/client-go/tools/clientcmd/api/v1:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
|
|
|||
16
vendor/k8s.io/client-go/tools/clientcmd/api/v1/BUILD
generated
vendored
16
vendor/k8s.io/client-go/tools/clientcmd/api/v1/BUILD
generated
vendored
|
|
@ -1,7 +1,5 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
|
|
@ -16,7 +14,6 @@ go_library(
|
|||
"types.go",
|
||||
"zz_generated.deepcopy.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
|
|
@ -24,3 +21,16 @@ go_library(
|
|||
"//vendor/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
|
|
|||
89
vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.deepcopy.go
generated
vendored
89
vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.deepcopy.go
generated
vendored
|
|
@ -26,13 +26,14 @@ import (
|
|||
reflect "reflect"
|
||||
)
|
||||
|
||||
// Deprecated: register deep-copy functions.
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterDeepCopies)
|
||||
}
|
||||
|
||||
// Deprecated: RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// to allow building arbitrary schemes.
|
||||
//
|
||||
// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
|
|
@ -127,13 +128,13 @@ func (in *AuthInfo) DeepCopyInto(out *AuthInfo) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AuthInfo.
|
||||
func (x *AuthInfo) DeepCopy() *AuthInfo {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthInfo.
|
||||
func (in *AuthInfo) DeepCopy() *AuthInfo {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AuthInfo)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -150,13 +151,13 @@ func (in *AuthProviderConfig) DeepCopyInto(out *AuthProviderConfig) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AuthProviderConfig.
|
||||
func (x *AuthProviderConfig) DeepCopy() *AuthProviderConfig {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthProviderConfig.
|
||||
func (in *AuthProviderConfig) DeepCopy() *AuthProviderConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AuthProviderConfig)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -178,13 +179,13 @@ func (in *Cluster) DeepCopyInto(out *Cluster) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.
|
||||
func (x *Cluster) DeepCopy() *Cluster {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.
|
||||
func (in *Cluster) DeepCopy() *Cluster {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Cluster)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -223,19 +224,19 @@ func (in *Config) DeepCopyInto(out *Config) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new Config.
|
||||
func (x *Config) DeepCopy() *Config {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.
|
||||
func (in *Config) DeepCopy() *Config {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Config)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (x *Config) DeepCopyObject() runtime.Object {
|
||||
if c := x.DeepCopy(); c != nil {
|
||||
func (in *Config) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
|
|
@ -255,13 +256,13 @@ func (in *Context) DeepCopyInto(out *Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new Context.
|
||||
func (x *Context) DeepCopy() *Context {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Context.
|
||||
func (in *Context) DeepCopy() *Context {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Context)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -272,13 +273,13 @@ func (in *NamedAuthInfo) DeepCopyInto(out *NamedAuthInfo) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new NamedAuthInfo.
|
||||
func (x *NamedAuthInfo) DeepCopy() *NamedAuthInfo {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedAuthInfo.
|
||||
func (in *NamedAuthInfo) DeepCopy() *NamedAuthInfo {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NamedAuthInfo)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -289,13 +290,13 @@ func (in *NamedCluster) DeepCopyInto(out *NamedCluster) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new NamedCluster.
|
||||
func (x *NamedCluster) DeepCopy() *NamedCluster {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedCluster.
|
||||
func (in *NamedCluster) DeepCopy() *NamedCluster {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NamedCluster)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -306,13 +307,13 @@ func (in *NamedContext) DeepCopyInto(out *NamedContext) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new NamedContext.
|
||||
func (x *NamedContext) DeepCopy() *NamedContext {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedContext.
|
||||
func (in *NamedContext) DeepCopy() *NamedContext {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NamedContext)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -323,13 +324,13 @@ func (in *NamedExtension) DeepCopyInto(out *NamedExtension) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new NamedExtension.
|
||||
func (x *NamedExtension) DeepCopy() *NamedExtension {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedExtension.
|
||||
func (in *NamedExtension) DeepCopy() *NamedExtension {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NamedExtension)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -346,12 +347,12 @@ func (in *Preferences) DeepCopyInto(out *Preferences) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new Preferences.
|
||||
func (x *Preferences) DeepCopy() *Preferences {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Preferences.
|
||||
func (in *Preferences) DeepCopy() *Preferences {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Preferences)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
|
|||
57
vendor/k8s.io/client-go/tools/clientcmd/api/zz_generated.deepcopy.go
generated
vendored
57
vendor/k8s.io/client-go/tools/clientcmd/api/zz_generated.deepcopy.go
generated
vendored
|
|
@ -26,13 +26,14 @@ import (
|
|||
reflect "reflect"
|
||||
)
|
||||
|
||||
// Deprecated: register deep-copy functions.
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterDeepCopies)
|
||||
}
|
||||
|
||||
// Deprecated: RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// to allow building arbitrary schemes.
|
||||
//
|
||||
// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
|
|
@ -115,13 +116,13 @@ func (in *AuthInfo) DeepCopyInto(out *AuthInfo) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AuthInfo.
|
||||
func (x *AuthInfo) DeepCopy() *AuthInfo {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthInfo.
|
||||
func (in *AuthInfo) DeepCopy() *AuthInfo {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AuthInfo)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -138,13 +139,13 @@ func (in *AuthProviderConfig) DeepCopyInto(out *AuthProviderConfig) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new AuthProviderConfig.
|
||||
func (x *AuthProviderConfig) DeepCopy() *AuthProviderConfig {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthProviderConfig.
|
||||
func (in *AuthProviderConfig) DeepCopy() *AuthProviderConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AuthProviderConfig)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -170,13 +171,13 @@ func (in *Cluster) DeepCopyInto(out *Cluster) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.
|
||||
func (x *Cluster) DeepCopy() *Cluster {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.
|
||||
func (in *Cluster) DeepCopy() *Cluster {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Cluster)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -234,19 +235,19 @@ func (in *Config) DeepCopyInto(out *Config) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new Config.
|
||||
func (x *Config) DeepCopy() *Config {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.
|
||||
func (in *Config) DeepCopy() *Config {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Config)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (x *Config) DeepCopyObject() runtime.Object {
|
||||
if c := x.DeepCopy(); c != nil {
|
||||
func (in *Config) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
|
|
@ -270,13 +271,13 @@ func (in *Context) DeepCopyInto(out *Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new Context.
|
||||
func (x *Context) DeepCopy() *Context {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Context.
|
||||
func (in *Context) DeepCopy() *Context {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Context)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
@ -297,12 +298,12 @@ func (in *Preferences) DeepCopyInto(out *Preferences) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new Preferences.
|
||||
func (x *Preferences) DeepCopy() *Preferences {
|
||||
if x == nil {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Preferences.
|
||||
func (in *Preferences) DeepCopy() *Preferences {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Preferences)
|
||||
x.DeepCopyInto(out)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
|
|||
49
vendor/k8s.io/client-go/tools/clientcmd/flag.go
generated
vendored
Normal file
49
vendor/k8s.io/client-go/tools/clientcmd/flag.go
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
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 clientcmd
|
||||
|
||||
// transformingStringValue implements pflag.Value to store string values,
|
||||
// allowing transforming them while being set
|
||||
type transformingStringValue struct {
|
||||
target *string
|
||||
transformer func(string) (string, error)
|
||||
}
|
||||
|
||||
func newTransformingStringValue(val string, target *string, transformer func(string) (string, error)) *transformingStringValue {
|
||||
*target = val
|
||||
return &transformingStringValue{
|
||||
target: target,
|
||||
transformer: transformer,
|
||||
}
|
||||
}
|
||||
|
||||
func (t *transformingStringValue) Set(val string) error {
|
||||
val, err := t.transformer(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*t.target = val
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *transformingStringValue) Type() string {
|
||||
return "string"
|
||||
}
|
||||
|
||||
func (t *transformingStringValue) String() string {
|
||||
return string(*t.target)
|
||||
}
|
||||
25
vendor/k8s.io/client-go/tools/clientcmd/overrides.go
generated
vendored
25
vendor/k8s.io/client-go/tools/clientcmd/overrides.go
generated
vendored
|
|
@ -18,6 +18,7 @@ package clientcmd
|
|||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
|
|
@ -36,7 +37,7 @@ type ConfigOverrides struct {
|
|||
Timeout string
|
||||
}
|
||||
|
||||
// ConfigOverrideFlags holds the flag names to be used for binding command line flags. Notice that this structure tightly
|
||||
// ConfigOverrideFlags holds the flag names to be used for binding command line flags. Notice that this structure tightly
|
||||
// corresponds to ConfigOverrides
|
||||
type ConfigOverrideFlags struct {
|
||||
AuthOverrideFlags AuthOverrideFlags
|
||||
|
|
@ -101,6 +102,15 @@ func (f FlagInfo) BindStringFlag(flags *pflag.FlagSet, target *string) FlagInfo
|
|||
return f
|
||||
}
|
||||
|
||||
// BindTransformingStringFlag binds the flag based on the provided info. If LongName == "", nothing is registered
|
||||
func (f FlagInfo) BindTransformingStringFlag(flags *pflag.FlagSet, target *string, transformer func(string) (string, error)) FlagInfo {
|
||||
// you can't register a flag without a long name
|
||||
if len(f.LongName) > 0 {
|
||||
flags.VarP(newTransformingStringValue(f.Default, target, transformer), f.LongName, f.ShortName, f.Description)
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
// BindStringSliceFlag binds the flag based on the provided info. If LongName == "", nothing is registered
|
||||
func (f FlagInfo) BindStringArrayFlag(flags *pflag.FlagSet, target *[]string) FlagInfo {
|
||||
// you can't register a flag without a long name
|
||||
|
|
@ -222,5 +232,16 @@ func BindClusterFlags(clusterInfo *clientcmdapi.Cluster, flags *pflag.FlagSet, f
|
|||
func BindContextFlags(contextInfo *clientcmdapi.Context, flags *pflag.FlagSet, flagNames ContextOverrideFlags) {
|
||||
flagNames.ClusterName.BindStringFlag(flags, &contextInfo.Cluster)
|
||||
flagNames.AuthInfoName.BindStringFlag(flags, &contextInfo.AuthInfo)
|
||||
flagNames.Namespace.BindStringFlag(flags, &contextInfo.Namespace)
|
||||
flagNames.Namespace.BindTransformingStringFlag(flags, &contextInfo.Namespace, RemoveNamespacesPrefix)
|
||||
}
|
||||
|
||||
// RemoveNamespacesPrefix is a transformer that strips "ns/", "namespace/" and "namespaces/" prefixes case-insensitively
|
||||
func RemoveNamespacesPrefix(value string) (string, error) {
|
||||
for _, prefix := range []string{"namespaces/", "namespace/", "ns/"} {
|
||||
if len(value) > len(prefix) && strings.EqualFold(value[0:len(prefix)], prefix) {
|
||||
value = value[len(prefix):]
|
||||
break
|
||||
}
|
||||
}
|
||||
return value, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue