mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-07 12:08:42 +00:00
Enable setting proxyurl in kubeconfig via kubectl config (#105566)
* Enable setting proxyurl in kubeconfig via kubectl config This PR enables setting `proxy-url` in kubeconfig via kubectl config. * Add godoc for proxy-url unit tests Kubernetes-commit: afdde383210294c3da573decc44b5ce55cffcb94
This commit is contained in:
parent
d7ed9408c8
commit
a6257fdee4
4
go.mod
4
go.mod
@ -30,7 +30,7 @@ require (
|
|||||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b
|
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b
|
||||||
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
|
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
|
||||||
google.golang.org/protobuf v1.27.1
|
google.golang.org/protobuf v1.27.1
|
||||||
k8s.io/api v0.0.0-20211215212153-038a002081e5
|
k8s.io/api v0.0.0-20211217212405-236866c4c265
|
||||||
k8s.io/apimachinery v0.0.0-20211215211714-e7b02e651498
|
k8s.io/apimachinery v0.0.0-20211215211714-e7b02e651498
|
||||||
k8s.io/klog/v2 v2.30.0
|
k8s.io/klog/v2 v2.30.0
|
||||||
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65
|
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65
|
||||||
@ -40,6 +40,6 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
k8s.io/api => k8s.io/api v0.0.0-20211215212153-038a002081e5
|
k8s.io/api => k8s.io/api v0.0.0-20211217212405-236866c4c265
|
||||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20211215211714-e7b02e651498
|
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20211215211714-e7b02e651498
|
||||||
)
|
)
|
||||||
|
4
go.sum
4
go.sum
@ -610,8 +610,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
|||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||||
k8s.io/api v0.0.0-20211215212153-038a002081e5 h1:uZaBzUjpiQ1X1YPtzRA3I5+kqx7zYkD1uUZ7Ea7hc0k=
|
k8s.io/api v0.0.0-20211217212405-236866c4c265 h1:4yrbMQUZVVX2JHcpJuCaxQwhXB1QuUW7BmK/PKKax2o=
|
||||||
k8s.io/api v0.0.0-20211215212153-038a002081e5/go.mod h1:kH5z5h8lnbGVPS6+JweP/T3Hd4aXG2QxsxPT9RmDg3Q=
|
k8s.io/api v0.0.0-20211217212405-236866c4c265/go.mod h1:kH5z5h8lnbGVPS6+JweP/T3Hd4aXG2QxsxPT9RmDg3Q=
|
||||||
k8s.io/apimachinery v0.0.0-20211215211714-e7b02e651498 h1:Gx+CxWyEfYzIYDyNgZuGHeszYhsZdIYF0v7/DGO83Bc=
|
k8s.io/apimachinery v0.0.0-20211215211714-e7b02e651498 h1:Gx+CxWyEfYzIYDyNgZuGHeszYhsZdIYF0v7/DGO83Bc=
|
||||||
k8s.io/apimachinery v0.0.0-20211215211714-e7b02e651498/go.mod h1:YpCy0BWvwSGZKMwmvPxCsfFJfl6vAwQdfVnPOJoUT2E=
|
k8s.io/apimachinery v0.0.0-20211215211714-e7b02e651498/go.mod h1:YpCy0BWvwSGZKMwmvPxCsfFJfl6vAwQdfVnPOJoUT2E=
|
||||||
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||||
|
@ -73,6 +73,7 @@ type ClusterOverrideFlags struct {
|
|||||||
CertificateAuthority FlagInfo
|
CertificateAuthority FlagInfo
|
||||||
InsecureSkipTLSVerify FlagInfo
|
InsecureSkipTLSVerify FlagInfo
|
||||||
TLSServerName FlagInfo
|
TLSServerName FlagInfo
|
||||||
|
ProxyURL FlagInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlagInfo contains information about how to register a flag. This struct is useful if you want to provide a way for an extender to
|
// FlagInfo contains information about how to register a flag. This struct is useful if you want to provide a way for an extender to
|
||||||
@ -160,6 +161,7 @@ const (
|
|||||||
FlagUsername = "username"
|
FlagUsername = "username"
|
||||||
FlagPassword = "password"
|
FlagPassword = "password"
|
||||||
FlagTimeout = "request-timeout"
|
FlagTimeout = "request-timeout"
|
||||||
|
FlagProxyURL = "proxy-url"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RecommendedConfigOverrideFlags is a convenience method to return recommended flag names prefixed with a string of your choosing
|
// RecommendedConfigOverrideFlags is a convenience method to return recommended flag names prefixed with a string of your choosing
|
||||||
@ -195,6 +197,7 @@ func RecommendedClusterOverrideFlags(prefix string) ClusterOverrideFlags {
|
|||||||
CertificateAuthority: FlagInfo{prefix + FlagCAFile, "", "", "Path to a cert file for the certificate authority"},
|
CertificateAuthority: FlagInfo{prefix + FlagCAFile, "", "", "Path to a cert file for the certificate authority"},
|
||||||
InsecureSkipTLSVerify: FlagInfo{prefix + FlagInsecure, "", "false", "If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure"},
|
InsecureSkipTLSVerify: FlagInfo{prefix + FlagInsecure, "", "false", "If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure"},
|
||||||
TLSServerName: FlagInfo{prefix + FlagTLSServerName, "", "", "If provided, this name will be used to validate server certificate. If this is not provided, hostname used to contact the server is used."},
|
TLSServerName: FlagInfo{prefix + FlagTLSServerName, "", "", "If provided, this name will be used to validate server certificate. If this is not provided, hostname used to contact the server is used."},
|
||||||
|
ProxyURL: FlagInfo{prefix + FlagProxyURL, "", "", "If provided, this URL will be used to connect via proxy"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +237,7 @@ func BindClusterFlags(clusterInfo *clientcmdapi.Cluster, flags *pflag.FlagSet, f
|
|||||||
flagNames.CertificateAuthority.BindStringFlag(flags, &clusterInfo.CertificateAuthority)
|
flagNames.CertificateAuthority.BindStringFlag(flags, &clusterInfo.CertificateAuthority)
|
||||||
flagNames.InsecureSkipTLSVerify.BindBoolFlag(flags, &clusterInfo.InsecureSkipTLSVerify)
|
flagNames.InsecureSkipTLSVerify.BindBoolFlag(flags, &clusterInfo.InsecureSkipTLSVerify)
|
||||||
flagNames.TLSServerName.BindStringFlag(flags, &clusterInfo.TLSServerName)
|
flagNames.TLSServerName.BindStringFlag(flags, &clusterInfo.TLSServerName)
|
||||||
|
flagNames.ProxyURL.BindStringFlag(flags, &clusterInfo.ProxyURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindFlags is a convenience method to bind the specified flags to their associated variables
|
// BindFlags is a convenience method to bind the specified flags to their associated variables
|
||||||
|
Loading…
Reference in New Issue
Block a user