mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Add DisableCompression option to KubeConfig
This commit is contained in:
parent
1ad457bff5
commit
641fd5b482
@ -448,10 +448,12 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,
|
|||||||
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,StrVal
|
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,StrVal
|
||||||
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,Type
|
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,Type
|
||||||
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1,Cluster,CertificateAuthorityData
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1,Cluster,CertificateAuthorityData
|
||||||
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1,Cluster,DisableCompression
|
||||||
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1,Cluster,InsecureSkipTLSVerify
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1,Cluster,InsecureSkipTLSVerify
|
||||||
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1,Cluster,ProxyURL
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1,Cluster,ProxyURL
|
||||||
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1,Cluster,TLSServerName
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1,Cluster,TLSServerName
|
||||||
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1beta1,Cluster,CertificateAuthorityData
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1beta1,Cluster,CertificateAuthorityData
|
||||||
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1beta1,Cluster,DisableCompression
|
||||||
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1beta1,Cluster,InsecureSkipTLSVerify
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1beta1,Cluster,InsecureSkipTLSVerify
|
||||||
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1beta1,Cluster,ProxyURL
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1beta1,Cluster,ProxyURL
|
||||||
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1beta1,Cluster,TLSServerName
|
API rule violation: names_match,k8s.io/client-go/pkg/apis/clientauthentication/v1beta1,Cluster,TLSServerName
|
||||||
|
@ -98,6 +98,11 @@ type Cluster struct {
|
|||||||
// cluster.
|
// cluster.
|
||||||
// +optional
|
// +optional
|
||||||
ProxyURL string
|
ProxyURL string
|
||||||
|
// DisableCompression allows client to opt-out of response compression for all requests to the server. This is useful
|
||||||
|
// to speed up requests (specifically lists) when client-server network bandwidth is ample, by saving time on
|
||||||
|
// compression (server-side) and decompression (client-side): https://github.com/kubernetes/kubernetes/issues/112296.
|
||||||
|
// +optional
|
||||||
|
DisableCompression bool
|
||||||
// Config holds additional config data that is specific to the exec
|
// Config holds additional config data that is specific to the exec
|
||||||
// plugin with regards to the cluster being authenticated to.
|
// plugin with regards to the cluster being authenticated to.
|
||||||
//
|
//
|
||||||
|
@ -96,6 +96,11 @@ type Cluster struct {
|
|||||||
// cluster.
|
// cluster.
|
||||||
// +optional
|
// +optional
|
||||||
ProxyURL string `json:"proxy-url,omitempty"`
|
ProxyURL string `json:"proxy-url,omitempty"`
|
||||||
|
// DisableCompression allows client to opt-out of response compression for all requests to the server. This is useful
|
||||||
|
// to speed up requests (specifically lists) when client-server network bandwidth is ample, by saving time on
|
||||||
|
// compression (server-side) and decompression (client-side): https://github.com/kubernetes/kubernetes/issues/112296.
|
||||||
|
// +optional
|
||||||
|
DisableCompression bool `json:"disable-compression,omitempty"`
|
||||||
// Config holds additional config data that is specific to the exec
|
// Config holds additional config data that is specific to the exec
|
||||||
// plugin with regards to the cluster being authenticated to.
|
// plugin with regards to the cluster being authenticated to.
|
||||||
//
|
//
|
||||||
|
@ -96,6 +96,11 @@ type Cluster struct {
|
|||||||
// cluster.
|
// cluster.
|
||||||
// +optional
|
// +optional
|
||||||
ProxyURL string `json:"proxy-url,omitempty"`
|
ProxyURL string `json:"proxy-url,omitempty"`
|
||||||
|
// DisableCompression allows client to opt-out of response compression for all requests to the server. This is useful
|
||||||
|
// to speed up requests (specifically lists) when client-server network bandwidth is ample, by saving time on
|
||||||
|
// compression (server-side) and decompression (client-side): https://github.com/kubernetes/kubernetes/issues/112296.
|
||||||
|
// +optional
|
||||||
|
DisableCompression bool `json:"disable-compression,omitempty"`
|
||||||
// Config holds additional config data that is specific to the exec
|
// Config holds additional config data that is specific to the exec
|
||||||
// plugin with regards to the cluster being authenticated to.
|
// plugin with regards to the cluster being authenticated to.
|
||||||
//
|
//
|
||||||
|
@ -55,6 +55,7 @@ func ConfigToExecCluster(config *Config) (*clientauthenticationapi.Cluster, erro
|
|||||||
InsecureSkipTLSVerify: config.Insecure,
|
InsecureSkipTLSVerify: config.Insecure,
|
||||||
CertificateAuthorityData: caData,
|
CertificateAuthorityData: caData,
|
||||||
ProxyURL: proxyURL,
|
ProxyURL: proxyURL,
|
||||||
|
DisableCompression: config.DisableCompression,
|
||||||
Config: config.ExecProvider.Config,
|
Config: config.ExecProvider.Config,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@ -79,6 +80,7 @@ func ExecClusterToConfig(cluster *clientauthenticationapi.Cluster) (*Config, err
|
|||||||
ServerName: cluster.TLSServerName,
|
ServerName: cluster.TLSServerName,
|
||||||
CAData: cluster.CertificateAuthorityData,
|
CAData: cluster.CertificateAuthorityData,
|
||||||
},
|
},
|
||||||
Proxy: proxy,
|
Proxy: proxy,
|
||||||
|
DisableCompression: cluster.DisableCompression,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,11 @@ type Cluster struct {
|
|||||||
// attach, port forward).
|
// attach, port forward).
|
||||||
// +optional
|
// +optional
|
||||||
ProxyURL string `json:"proxy-url,omitempty"`
|
ProxyURL string `json:"proxy-url,omitempty"`
|
||||||
|
// DisableCompression allows client to opt-out of response compression for all requests to the server. This is useful
|
||||||
|
// to speed up requests (specifically lists) when client-server network bandwidth is ample, by saving time on
|
||||||
|
// compression (server-side) and decompression (client-side): https://github.com/kubernetes/kubernetes/issues/112296.
|
||||||
|
// +optional
|
||||||
|
DisableCompression bool `json:"disable-compression,omitempty"`
|
||||||
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
|
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
|
||||||
// +optional
|
// +optional
|
||||||
Extensions map[string]runtime.Object `json:"extensions,omitempty"`
|
Extensions map[string]runtime.Object `json:"extensions,omitempty"`
|
||||||
|
@ -46,10 +46,12 @@ func Example_ofOptionsConfig() {
|
|||||||
Server: "https://alfa.org:8080",
|
Server: "https://alfa.org:8080",
|
||||||
InsecureSkipTLSVerify: true,
|
InsecureSkipTLSVerify: true,
|
||||||
CertificateAuthority: "path/to/my/cert-ca-filename",
|
CertificateAuthority: "path/to/my/cert-ca-filename",
|
||||||
|
DisableCompression: true,
|
||||||
}
|
}
|
||||||
defaultConfig.Clusters["bravo"] = &Cluster{
|
defaultConfig.Clusters["bravo"] = &Cluster{
|
||||||
Server: "https://bravo.org:8080",
|
Server: "https://bravo.org:8080",
|
||||||
InsecureSkipTLSVerify: false,
|
InsecureSkipTLSVerify: false,
|
||||||
|
DisableCompression: false,
|
||||||
}
|
}
|
||||||
defaultConfig.AuthInfos["white-mage-via-cert"] = &AuthInfo{
|
defaultConfig.AuthInfos["white-mage-via-cert"] = &AuthInfo{
|
||||||
ClientCertificate: "path/to/my/client-cert-filename",
|
ClientCertificate: "path/to/my/client-cert-filename",
|
||||||
@ -94,6 +96,7 @@ func Example_ofOptionsConfig() {
|
|||||||
// alfa:
|
// alfa:
|
||||||
// LocationOfOrigin: ""
|
// LocationOfOrigin: ""
|
||||||
// certificate-authority: path/to/my/cert-ca-filename
|
// certificate-authority: path/to/my/cert-ca-filename
|
||||||
|
// disable-compression: true
|
||||||
// insecure-skip-tls-verify: true
|
// insecure-skip-tls-verify: true
|
||||||
// server: https://alfa.org:8080
|
// server: https://alfa.org:8080
|
||||||
// bravo:
|
// bravo:
|
||||||
|
@ -86,6 +86,11 @@ type Cluster struct {
|
|||||||
// attach, port forward).
|
// attach, port forward).
|
||||||
// +optional
|
// +optional
|
||||||
ProxyURL string `json:"proxy-url,omitempty"`
|
ProxyURL string `json:"proxy-url,omitempty"`
|
||||||
|
// DisableCompression allows client to opt-out of response compression for all requests to the server. This is useful
|
||||||
|
// to speed up requests (specifically lists) when client-server network bandwidth is ample, by saving time on
|
||||||
|
// compression (server-side) and decompression (client-side): https://github.com/kubernetes/kubernetes/issues/112296.
|
||||||
|
// +optional
|
||||||
|
DisableCompression bool `json:"disable-compression,omitempty"`
|
||||||
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
|
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
|
||||||
// +optional
|
// +optional
|
||||||
Extensions []NamedExtension `json:"extensions,omitempty"`
|
Extensions []NamedExtension `json:"extensions,omitempty"`
|
||||||
|
@ -164,6 +164,8 @@ func (config *DirectClientConfig) ClientConfig() (*restclient.Config, error) {
|
|||||||
clientConfig.Proxy = http.ProxyURL(u)
|
clientConfig.Proxy = http.ProxyURL(u)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientConfig.DisableCompression = configClusterInfo.DisableCompression
|
||||||
|
|
||||||
if config.overrides != nil && len(config.overrides.Timeout) > 0 {
|
if config.overrides != nil && len(config.overrides.Timeout) > 0 {
|
||||||
timeout, err := ParseTimeout(config.overrides.Timeout)
|
timeout, err := ParseTimeout(config.overrides.Timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -138,6 +138,22 @@ func createCAValidTestConfig() *clientcmdapi.Config {
|
|||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDisableCompression(t *testing.T) {
|
||||||
|
config := createValidTestConfig()
|
||||||
|
clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{
|
||||||
|
ClusterInfo: clientcmdapi.Cluster{
|
||||||
|
DisableCompression: true,
|
||||||
|
},
|
||||||
|
}, nil)
|
||||||
|
|
||||||
|
actualCfg, err := clientBuilder.ClientConfig()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
matchBoolArg(true, actualCfg.DisableCompression, t)
|
||||||
|
}
|
||||||
|
|
||||||
func TestInsecureOverridesCA(t *testing.T) {
|
func TestInsecureOverridesCA(t *testing.T) {
|
||||||
config := createCAValidTestConfig()
|
config := createCAValidTestConfig()
|
||||||
clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{
|
clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{
|
||||||
|
@ -73,8 +73,8 @@ var (
|
|||||||
"red-user": {Token: "a-different-red-token"},
|
"red-user": {Token: "a-different-red-token"},
|
||||||
"yellow-user": {Token: "yellow-token"}},
|
"yellow-user": {Token: "yellow-token"}},
|
||||||
Clusters: map[string]*clientcmdapi.Cluster{
|
Clusters: map[string]*clientcmdapi.Cluster{
|
||||||
"cow-cluster": {Server: "http://a-different-cow.org:8080", InsecureSkipTLSVerify: true},
|
"cow-cluster": {Server: "http://a-different-cow.org:8080", InsecureSkipTLSVerify: true, DisableCompression: true},
|
||||||
"donkey-cluster": {Server: "http://donkey.org:8080", InsecureSkipTLSVerify: true}},
|
"donkey-cluster": {Server: "http://donkey.org:8080", InsecureSkipTLSVerify: true, DisableCompression: true}},
|
||||||
CurrentContext: "federal-context",
|
CurrentContext: "federal-context",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -736,6 +736,7 @@ func Example_mergingSomeWithConflict() {
|
|||||||
// server: http://cow.org:8080
|
// server: http://cow.org:8080
|
||||||
// name: cow-cluster
|
// name: cow-cluster
|
||||||
// - cluster:
|
// - cluster:
|
||||||
|
// disable-compression: true
|
||||||
// insecure-skip-tls-verify: true
|
// insecure-skip-tls-verify: true
|
||||||
// server: http://donkey.org:8080
|
// server: http://donkey.org:8080
|
||||||
// name: donkey-cluster
|
// name: donkey-cluster
|
||||||
|
@ -74,6 +74,7 @@ type ClusterOverrideFlags struct {
|
|||||||
InsecureSkipTLSVerify FlagInfo
|
InsecureSkipTLSVerify FlagInfo
|
||||||
TLSServerName FlagInfo
|
TLSServerName FlagInfo
|
||||||
ProxyURL FlagInfo
|
ProxyURL FlagInfo
|
||||||
|
DisableCompression 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
|
||||||
@ -143,25 +144,26 @@ func (f FlagInfo) BindBoolFlag(flags *pflag.FlagSet, target *bool) FlagInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
FlagClusterName = "cluster"
|
FlagClusterName = "cluster"
|
||||||
FlagAuthInfoName = "user"
|
FlagAuthInfoName = "user"
|
||||||
FlagContext = "context"
|
FlagContext = "context"
|
||||||
FlagNamespace = "namespace"
|
FlagNamespace = "namespace"
|
||||||
FlagAPIServer = "server"
|
FlagAPIServer = "server"
|
||||||
FlagTLSServerName = "tls-server-name"
|
FlagTLSServerName = "tls-server-name"
|
||||||
FlagInsecure = "insecure-skip-tls-verify"
|
FlagInsecure = "insecure-skip-tls-verify"
|
||||||
FlagCertFile = "client-certificate"
|
FlagCertFile = "client-certificate"
|
||||||
FlagKeyFile = "client-key"
|
FlagKeyFile = "client-key"
|
||||||
FlagCAFile = "certificate-authority"
|
FlagCAFile = "certificate-authority"
|
||||||
FlagEmbedCerts = "embed-certs"
|
FlagEmbedCerts = "embed-certs"
|
||||||
FlagBearerToken = "token"
|
FlagBearerToken = "token"
|
||||||
FlagImpersonate = "as"
|
FlagImpersonate = "as"
|
||||||
FlagImpersonateUID = "as-uid"
|
FlagImpersonateUID = "as-uid"
|
||||||
FlagImpersonateGroup = "as-group"
|
FlagImpersonateGroup = "as-group"
|
||||||
FlagUsername = "username"
|
FlagUsername = "username"
|
||||||
FlagPassword = "password"
|
FlagPassword = "password"
|
||||||
FlagTimeout = "request-timeout"
|
FlagTimeout = "request-timeout"
|
||||||
FlagProxyURL = "proxy-url"
|
FlagProxyURL = "proxy-url"
|
||||||
|
FlagDisableCompression = "disable-compression"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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
|
||||||
@ -198,6 +200,7 @@ func RecommendedClusterOverrideFlags(prefix string) ClusterOverrideFlags {
|
|||||||
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"},
|
ProxyURL: FlagInfo{prefix + FlagProxyURL, "", "", "If provided, this URL will be used to connect via proxy"},
|
||||||
|
DisableCompression: FlagInfo{prefix + FlagDisableCompression, "", "", "If true, opt-out of response compression for all requests to the server"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,6 +241,7 @@ func BindClusterFlags(clusterInfo *clientcmdapi.Cluster, flags *pflag.FlagSet, f
|
|||||||
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)
|
flagNames.ProxyURL.BindStringFlag(flags, &clusterInfo.ProxyURL)
|
||||||
|
flagNames.DisableCompression.BindBoolFlag(flags, &clusterInfo.DisableCompression)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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