Merge pull request #69386 from cblecker/go-1.11

Update to go1.11.1
pull/58/head
k8s-ci-robot 2018-10-05 17:35:51 -07:00 committed by GitHub
commit 0f17e9ade6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
220 changed files with 1076 additions and 1076 deletions

View File

@ -15,7 +15,7 @@
# This file creates a standard build environment for building cross # This file creates a standard build environment for building cross
# platform go binary for the architecture kubernetes cares about. # platform go binary for the architecture kubernetes cares about.
FROM golang:1.10.4 FROM golang:1.11.1
ENV GOARM 7 ENV GOARM 7
ENV KUBE_DYNAMIC_CROSSPLATFORMS \ ENV KUBE_DYNAMIC_CROSSPLATFORMS \

View File

@ -1 +1 @@
v1.10.4-1 v1.11.1-1

View File

@ -3,15 +3,15 @@ load("//build:workspace.bzl", "CRI_TOOLS_VERSION")
http_archive( http_archive(
name = "io_bazel_rules_go", name = "io_bazel_rules_go",
sha256 = "97cf62bdef33519412167fd1e4b0810a318a7c234f5f8dc4f53e2da86241c492", sha256 = "7519e9e1c716ae3c05bd2d984a42c3b02e690c5df728dc0a84b23f90c355c5a1",
urls = mirror("https://github.com/bazelbuild/rules_go/releases/download/0.15.3/rules_go-0.15.3.tar.gz"), urls = mirror("https://github.com/bazelbuild/rules_go/releases/download/0.15.4/rules_go-0.15.4.tar.gz"),
) )
http_archive( http_archive(
name = "io_kubernetes_build", name = "io_kubernetes_build",
sha256 = "1188feb932cefad328b0a3dd75b3ebd1d79dd26dbdd723f019ceb760e27ba6d8", sha256 = "66a44fd5f6357268340d66fbd8a502065445a7c022732fe5f6fd84d9a20f75a3",
strip_prefix = "repo-infra-84d52408a061e87d45aebf5a0867246bdf66d180", strip_prefix = "repo-infra-e8f2f7c3decf03e1fde9f30d249e39b8328aa8b0",
urls = mirror("https://github.com/kubernetes/repo-infra/archive/84d52408a061e87d45aebf5a0867246bdf66d180.tar.gz"), urls = mirror("https://github.com/kubernetes/repo-infra/archive/e8f2f7c3decf03e1fde9f30d249e39b8328aa8b0.tar.gz"),
) )
http_archive( http_archive(
@ -48,7 +48,7 @@ load("@io_bazel_rules_docker//docker:docker.bzl", "docker_pull", "docker_reposit
go_rules_dependencies() go_rules_dependencies()
go_register_toolchains( go_register_toolchains(
go_version = "1.10.4", go_version = "1.11.1",
) )
docker_repositories() docker_repositories()

View File

@ -105,12 +105,12 @@ func TestEncryptionProviderFlag(t *testing.T) {
wantFlag bool wantFlag bool
}{ }{
{ {
desc: "ENCRYPTION_PROVIDER_CONFIG is set", desc: "ENCRYPTION_PROVIDER_CONFIG is set",
encryptionProviderConfig: base64.StdEncoding.EncodeToString([]byte("foo")), encryptionProviderConfig: base64.StdEncoding.EncodeToString([]byte("foo")),
wantFlag: true, wantFlag: true,
}, },
{ {
desc: "ENCRYPTION_PROVIDER_CONFIG is not set", desc: "ENCRYPTION_PROVIDER_CONFIG is not set",
encryptionProviderConfig: "", encryptionProviderConfig: "",
wantFlag: false, wantFlag: false,
}, },

View File

@ -323,7 +323,7 @@ func generateSelfSignedCertKey(host string, alternateIPs []net.IP, alternateDNS
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth},
BasicConstraintsValid: true, BasicConstraintsValid: true,
IsCA: true, IsCA: true,
} }
if ip := net.ParseIP(host); ip != nil { if ip := net.ParseIP(host); ip != nil {

View File

@ -104,8 +104,8 @@ func TestDefaultFlags(t *testing.T) {
RemoteKubeConfigFileOptional: true, RemoteKubeConfigFileOptional: true,
AlwaysAllowPaths: []string{"/healthz"}, // note: this does not match /healthz/ or AlwaysAllowPaths: []string{"/healthz"}, // note: this does not match /healthz/ or
}, },
Kubeconfig: "", Kubeconfig: "",
Master: "", Master: "",
NodeStatusUpdateFrequency: metav1.Duration{Duration: 5 * time.Minute}, NodeStatusUpdateFrequency: metav1.Duration{Duration: 5 * time.Minute},
} }
if !reflect.DeepEqual(expected, s) { if !reflect.DeepEqual(expected, s) {
@ -222,8 +222,8 @@ func TestAddFlags(t *testing.T) {
RemoteKubeConfigFileOptional: true, RemoteKubeConfigFileOptional: true,
AlwaysAllowPaths: []string{"/healthz"}, // note: this does not match /healthz/ or AlwaysAllowPaths: []string{"/healthz"}, // note: this does not match /healthz/ or
}, },
Kubeconfig: "/kubeconfig", Kubeconfig: "/kubeconfig",
Master: "192.168.4.20", Master: "192.168.4.20",
NodeStatusUpdateFrequency: metav1.Duration{Duration: 10 * time.Minute}, NodeStatusUpdateFrequency: metav1.Duration{Duration: 10 * time.Minute},
} }
if !reflect.DeepEqual(expected, s) { if !reflect.DeepEqual(expected, s) {

View File

@ -77,17 +77,17 @@ type ServerRunOptions struct {
func NewServerRunOptions() *ServerRunOptions { func NewServerRunOptions() *ServerRunOptions {
s := ServerRunOptions{ s := ServerRunOptions{
GenericServerRunOptions: genericoptions.NewServerRunOptions(), GenericServerRunOptions: genericoptions.NewServerRunOptions(),
Etcd: genericoptions.NewEtcdOptions(storagebackend.NewDefaultConfig(kubeoptions.DefaultEtcdPathPrefix, nil)), Etcd: genericoptions.NewEtcdOptions(storagebackend.NewDefaultConfig(kubeoptions.DefaultEtcdPathPrefix, nil)),
SecureServing: kubeoptions.NewSecureServingOptions(), SecureServing: kubeoptions.NewSecureServingOptions(),
InsecureServing: kubeoptions.NewInsecureServingOptions(), InsecureServing: kubeoptions.NewInsecureServingOptions(),
Audit: genericoptions.NewAuditOptions(), Audit: genericoptions.NewAuditOptions(),
Features: genericoptions.NewFeatureOptions(), Features: genericoptions.NewFeatureOptions(),
Admission: kubeoptions.NewAdmissionOptions(), Admission: kubeoptions.NewAdmissionOptions(),
Authentication: kubeoptions.NewBuiltInAuthenticationOptions().WithAll(), Authentication: kubeoptions.NewBuiltInAuthenticationOptions().WithAll(),
Authorization: kubeoptions.NewBuiltInAuthorizationOptions(), Authorization: kubeoptions.NewBuiltInAuthorizationOptions(),
CloudProvider: kubeoptions.NewCloudProviderOptions(), CloudProvider: kubeoptions.NewCloudProviderOptions(),
StorageSerialization: kubeoptions.NewStorageSerializationOptions(), StorageSerialization: kubeoptions.NewStorageSerializationOptions(),
APIEnablement: genericoptions.NewAPIEnablementOptions(), APIEnablement: genericoptions.NewAPIEnablementOptions(),
EnableLogsHandler: true, EnableLogsHandler: true,
EventTTL: 1 * time.Hour, EventTTL: 1 * time.Hour,

View File

@ -142,16 +142,16 @@ func TestAddFlags(t *testing.T) {
}, },
Etcd: &apiserveroptions.EtcdOptions{ Etcd: &apiserveroptions.EtcdOptions{
StorageConfig: storagebackend.Config{ StorageConfig: storagebackend.Config{
Type: "etcd2", Type: "etcd2",
ServerList: nil, ServerList: nil,
Prefix: "/registry", Prefix: "/registry",
DeserializationCacheSize: 0, DeserializationCacheSize: 0,
Quorum: false, Quorum: false,
KeyFile: "/var/run/kubernetes/etcd.key", KeyFile: "/var/run/kubernetes/etcd.key",
CAFile: "/var/run/kubernetes/etcdca.crt", CAFile: "/var/run/kubernetes/etcdca.crt",
CertFile: "/var/run/kubernetes/etcdce.crt", CertFile: "/var/run/kubernetes/etcdce.crt",
CompactionInterval: storagebackend.DefaultCompactInterval, CompactionInterval: storagebackend.DefaultCompactInterval,
CountMetricPollPeriod: time.Minute, CountMetricPollPeriod: time.Minute,
}, },
DefaultStorageMediaType: "application/vnd.kubernetes.protobuf", DefaultStorageMediaType: "application/vnd.kubernetes.protobuf",
DeleteCollectionWorkers: 1, DeleteCollectionWorkers: 1,

View File

@ -448,9 +448,9 @@ func TestValidateInitConfiguration(t *testing.T) {
MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second}, MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
}, },
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: utilpointer.Int32Ptr(2), Max: utilpointer.Int32Ptr(2),
MaxPerCore: utilpointer.Int32Ptr(1), MaxPerCore: utilpointer.Int32Ptr(1),
Min: utilpointer.Int32Ptr(1), Min: utilpointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },
@ -495,9 +495,9 @@ func TestValidateInitConfiguration(t *testing.T) {
MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second}, MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
}, },
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: utilpointer.Int32Ptr(2), Max: utilpointer.Int32Ptr(2),
MaxPerCore: utilpointer.Int32Ptr(1), MaxPerCore: utilpointer.Int32Ptr(1),
Min: utilpointer.Int32Ptr(1), Min: utilpointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },

View File

@ -195,7 +195,7 @@ func getDefaultInitConfigBytes(kind string) ([]byte, error) {
func getDefaultNodeConfigBytes() ([]byte, error) { func getDefaultNodeConfigBytes() ([]byte, error) {
internalcfg, err := configutil.NodeConfigFileAndDefaultsToInternalConfig("", &kubeadmapiv1beta1.JoinConfiguration{ internalcfg, err := configutil.NodeConfigFileAndDefaultsToInternalConfig("", &kubeadmapiv1beta1.JoinConfiguration{
Token: sillyToken.Token.String(), Token: sillyToken.Token.String(),
DiscoveryTokenAPIServers: []string{"kube-apiserver:6443"}, DiscoveryTokenAPIServers: []string{"kube-apiserver:6443"},
DiscoveryTokenUnsafeSkipCAVerification: true, // TODO: DiscoveryTokenUnsafeSkipCAVerification: true needs to be set for validation to pass, but shouldn't be recommended as the default DiscoveryTokenUnsafeSkipCAVerification: true, // TODO: DiscoveryTokenUnsafeSkipCAVerification: true needs to be set for validation to pass, but shouldn't be recommended as the default
}) })

View File

@ -97,9 +97,9 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
bto := options.NewBootstrapTokenOptions() bto := options.NewBootstrapTokenOptions()
createCmd := &cobra.Command{ createCmd := &cobra.Command{
Use: "create [token]", Use: "create [token]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: "Create bootstrap tokens on the server.", Short: "Create bootstrap tokens on the server.",
Long: dedent.Dedent(` Long: dedent.Dedent(`
This command will create a bootstrap token for you. This command will create a bootstrap token for you.
You can specify the usages for this token, the "time to live" and an optional human friendly description. You can specify the usages for this token, the "time to live" and an optional human friendly description.
@ -158,9 +158,9 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
tokenCmd.AddCommand(listCmd) tokenCmd.AddCommand(listCmd)
deleteCmd := &cobra.Command{ deleteCmd := &cobra.Command{
Use: "delete [token-value]", Use: "delete [token-value]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: "Delete bootstrap tokens on the server.", Short: "Delete bootstrap tokens on the server.",
Long: dedent.Dedent(` Long: dedent.Dedent(`
This command will delete a given bootstrap token for you. This command will delete a given bootstrap token for you.

View File

@ -74,9 +74,9 @@ func NewCmdApply(apf *applyPlanFlags) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "apply [version]", Use: "apply [version]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: "Upgrade your Kubernetes cluster to the specified version.", Short: "Upgrade your Kubernetes cluster to the specified version.",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
var err error var err error
flags.ignorePreflightErrorsSet, err = validation.ValidateIgnorePreflightErrors(flags.ignorePreflightErrors) flags.ignorePreflightErrorsSet, err = validation.ValidateIgnorePreflightErrors(flags.ignorePreflightErrors)

View File

@ -53,7 +53,7 @@ func NewCmdUpgrade(out io.Writer) *cobra.Command {
allowRCUpgrades: false, allowRCUpgrades: false,
printConfig: false, printConfig: false,
ignorePreflightErrorsSet: sets.NewString(), ignorePreflightErrorsSet: sets.NewString(),
out: out, out: out,
} }
cmd := &cobra.Command{ cmd := &cobra.Command{

View File

@ -55,9 +55,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) {
MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second}, MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
}, },
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: utilpointer.Int32Ptr(2), Max: utilpointer.Int32Ptr(2),
MaxPerCore: utilpointer.Int32Ptr(1), MaxPerCore: utilpointer.Int32Ptr(1),
Min: utilpointer.Int32Ptr(1), Min: utilpointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },
@ -87,9 +87,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) {
MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second}, MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
}, },
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: utilpointer.Int32Ptr(2), Max: utilpointer.Int32Ptr(2),
MaxPerCore: utilpointer.Int32Ptr(1), MaxPerCore: utilpointer.Int32Ptr(1),
Min: utilpointer.Int32Ptr(1), Min: utilpointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },
@ -120,9 +120,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) {
MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second}, MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
}, },
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: utilpointer.Int32Ptr(2), Max: utilpointer.Int32Ptr(2),
MaxPerCore: utilpointer.Int32Ptr(1), MaxPerCore: utilpointer.Int32Ptr(1),
Min: utilpointer.Int32Ptr(1), Min: utilpointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },
@ -153,9 +153,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) {
MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second}, MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
}, },
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: utilpointer.Int32Ptr(2), Max: utilpointer.Int32Ptr(2),
MaxPerCore: utilpointer.Int32Ptr(1), MaxPerCore: utilpointer.Int32Ptr(1),
Min: utilpointer.Int32Ptr(1), Min: utilpointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },
@ -186,9 +186,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) {
MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second}, MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
}, },
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: utilpointer.Int32Ptr(2), Max: utilpointer.Int32Ptr(2),
MaxPerCore: utilpointer.Int32Ptr(1), MaxPerCore: utilpointer.Int32Ptr(1),
Min: utilpointer.Int32Ptr(1), Min: utilpointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },
@ -219,9 +219,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) {
MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second}, MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
}, },
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: utilpointer.Int32Ptr(2), Max: utilpointer.Int32Ptr(2),
MaxPerCore: utilpointer.Int32Ptr(1), MaxPerCore: utilpointer.Int32Ptr(1),
Min: utilpointer.Int32Ptr(1), Min: utilpointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },
@ -252,9 +252,9 @@ func TestValidateKubeProxyConfiguration(t *testing.T) {
MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second}, MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
}, },
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: utilpointer.Int32Ptr(2), Max: utilpointer.Int32Ptr(2),
MaxPerCore: utilpointer.Int32Ptr(1), MaxPerCore: utilpointer.Int32Ptr(1),
Min: utilpointer.Int32Ptr(1), Min: utilpointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },

View File

@ -210,9 +210,9 @@ func TestEnsureProxyAddon(t *testing.T) {
HealthzBindAddress: "0.0.0.0:10256", HealthzBindAddress: "0.0.0.0:10256",
MetricsBindAddress: "127.0.0.1:10249", MetricsBindAddress: "127.0.0.1:10249",
Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{ Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
Max: pointer.Int32Ptr(2), Max: pointer.Int32Ptr(2),
MaxPerCore: pointer.Int32Ptr(1), MaxPerCore: pointer.Int32Ptr(1),
Min: pointer.Int32Ptr(1), Min: pointer.Int32Ptr(1),
TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second}, TCPCloseWaitTimeout: &metav1.Duration{Duration: 5 * time.Second},
}, },

View File

@ -55,9 +55,9 @@ func WriteKubeletDynamicEnvFile(nodeRegOpts *kubeadmapi.NodeRegistrationOptions,
nodeRegOpts: nodeRegOpts, nodeRegOpts: nodeRegOpts,
featureGates: featureGates, featureGates: featureGates,
registerTaintsUsingFlags: registerTaintsUsingFlags, registerTaintsUsingFlags: registerTaintsUsingFlags,
execer: utilsexec.New(), execer: utilsexec.New(),
pidOfFunc: procfs.PidOf, pidOfFunc: procfs.PidOf,
defaultHostname: hostName, defaultHostname: hostName,
} }
stringMap := buildKubeletArgMap(flagOpts) stringMap := buildKubeletArgMap(flagOpts)
argList := kubeadmutil.BuildArgumentListFromMap(stringMap, nodeRegOpts.KubeletExtraArgs) argList := kubeadmutil.BuildArgumentListFromMap(stringMap, nodeRegOpts.KubeletExtraArgs)

View File

@ -206,9 +206,9 @@ func TestBuildKubeletArgMap(t *testing.T) {
}, },
}, },
registerTaintsUsingFlags: true, registerTaintsUsingFlags: true,
execer: cgroupfsCgroupExecer, execer: cgroupfsCgroupExecer,
pidOfFunc: binaryNotRunningPidOfFunc, pidOfFunc: binaryNotRunningPidOfFunc,
defaultHostname: "foo", defaultHostname: "foo",
}, },
expected: map[string]string{ expected: map[string]string{
"container-runtime": "remote", "container-runtime": "remote",

View File

@ -130,7 +130,7 @@ func TestAddNodeSelectorToPodSpec(t *testing.T) {
}, },
expected: v1.PodSpec{ expected: v1.PodSpec{
NodeSelector: map[string]string{ NodeSelector: map[string]string{
"foo": "bar", "foo": "bar",
kubeadmconstants.LabelNodeRoleMaster: "", kubeadmconstants.LabelNodeRoleMaster: "",
}, },
}, },

View File

@ -166,7 +166,7 @@ func TestGetClusterStatus(t *testing.T) {
expectedClusterEndpoints int expectedClusterEndpoints int
}{ }{
{ {
name: "return empty ClusterStatus if cluster kubeadm-config doesn't exist (e.g init)", name: "return empty ClusterStatus if cluster kubeadm-config doesn't exist (e.g init)",
expectedClusterEndpoints: 0, expectedClusterEndpoints: 0,
}, },
{ {

View File

@ -32,7 +32,7 @@ func CreateBasic(serverURL, clusterName, userName string, caCert []byte) *client
return &clientcmdapi.Config{ return &clientcmdapi.Config{
Clusters: map[string]*clientcmdapi.Cluster{ Clusters: map[string]*clientcmdapi.Cluster{
clusterName: { clusterName: {
Server: serverURL, Server: serverURL,
CertificateAuthorityData: caCert, CertificateAuthorityData: caCert,
}, },
}, },

View File

@ -166,8 +166,8 @@ func TestValidatePackageVersion(t *testing.T) {
testKernelRelease := "test-kernel-release" testKernelRelease := "test-kernel-release"
manager := testPackageManager{ manager := testPackageManager{
packageVersions: map[string]string{ packageVersions: map[string]string{
"foo": "1.0.0", "foo": "1.0.0",
"bar": "2.1.0", "bar": "2.1.0",
"bar-" + testKernelRelease: "3.0.0", "bar-" + testKernelRelease: "3.0.0",
}, },
} }

View File

@ -360,7 +360,7 @@ EOF
local go_version local go_version
IFS=" " read -ra go_version <<< "$(go version)" IFS=" " read -ra go_version <<< "$(go version)"
local minimum_go_version local minimum_go_version
minimum_go_version=go1.10.2 minimum_go_version=go1.11.1
if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then
kube::log::usage_from_stdin <<EOF kube::log::usage_from_stdin <<EOF
Detected go version: ${go_version[*]}. Detected go version: ${go_version[*]}.

View File

@ -151,25 +151,25 @@ func TestRequestsOnlyLocalTraffic(t *testing.T) {
}) })
checkRequestsOnlyLocalTraffic(false, &api.Service{ checkRequestsOnlyLocalTraffic(false, &api.Service{
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Type: api.ServiceTypeNodePort, Type: api.ServiceTypeNodePort,
ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeCluster, ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeCluster,
}, },
}) })
checkRequestsOnlyLocalTraffic(true, &api.Service{ checkRequestsOnlyLocalTraffic(true, &api.Service{
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Type: api.ServiceTypeNodePort, Type: api.ServiceTypeNodePort,
ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeLocal, ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeLocal,
}, },
}) })
checkRequestsOnlyLocalTraffic(false, &api.Service{ checkRequestsOnlyLocalTraffic(false, &api.Service{
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Type: api.ServiceTypeLoadBalancer, Type: api.ServiceTypeLoadBalancer,
ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeCluster, ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeCluster,
}, },
}) })
checkRequestsOnlyLocalTraffic(true, &api.Service{ checkRequestsOnlyLocalTraffic(true, &api.Service{
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Type: api.ServiceTypeLoadBalancer, Type: api.ServiceTypeLoadBalancer,
ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeLocal, ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeLocal,
}, },
}) })
@ -191,25 +191,25 @@ func TestNeedsHealthCheck(t *testing.T) {
}) })
checkNeedsHealthCheck(false, &api.Service{ checkNeedsHealthCheck(false, &api.Service{
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Type: api.ServiceTypeNodePort, Type: api.ServiceTypeNodePort,
ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeCluster, ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeCluster,
}, },
}) })
checkNeedsHealthCheck(false, &api.Service{ checkNeedsHealthCheck(false, &api.Service{
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Type: api.ServiceTypeNodePort, Type: api.ServiceTypeNodePort,
ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeLocal, ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeLocal,
}, },
}) })
checkNeedsHealthCheck(false, &api.Service{ checkNeedsHealthCheck(false, &api.Service{
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Type: api.ServiceTypeLoadBalancer, Type: api.ServiceTypeLoadBalancer,
ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeCluster, ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeCluster,
}, },
}) })
checkNeedsHealthCheck(true, &api.Service{ checkNeedsHealthCheck(true, &api.Service{
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Type: api.ServiceTypeLoadBalancer, Type: api.ServiceTypeLoadBalancer,
ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeLocal, ExternalTrafficPolicy: api.ServiceExternalTrafficPolicyTypeLocal,
}, },
}) })

View File

@ -151,25 +151,25 @@ func TestRequestsOnlyLocalTraffic(t *testing.T) {
}) })
checkRequestsOnlyLocalTraffic(false, &v1.Service{ checkRequestsOnlyLocalTraffic(false, &v1.Service{
Spec: v1.ServiceSpec{ Spec: v1.ServiceSpec{
Type: v1.ServiceTypeNodePort, Type: v1.ServiceTypeNodePort,
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeCluster, ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeCluster,
}, },
}) })
checkRequestsOnlyLocalTraffic(true, &v1.Service{ checkRequestsOnlyLocalTraffic(true, &v1.Service{
Spec: v1.ServiceSpec{ Spec: v1.ServiceSpec{
Type: v1.ServiceTypeNodePort, Type: v1.ServiceTypeNodePort,
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal, ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal,
}, },
}) })
checkRequestsOnlyLocalTraffic(false, &v1.Service{ checkRequestsOnlyLocalTraffic(false, &v1.Service{
Spec: v1.ServiceSpec{ Spec: v1.ServiceSpec{
Type: v1.ServiceTypeLoadBalancer, Type: v1.ServiceTypeLoadBalancer,
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeCluster, ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeCluster,
}, },
}) })
checkRequestsOnlyLocalTraffic(true, &v1.Service{ checkRequestsOnlyLocalTraffic(true, &v1.Service{
Spec: v1.ServiceSpec{ Spec: v1.ServiceSpec{
Type: v1.ServiceTypeLoadBalancer, Type: v1.ServiceTypeLoadBalancer,
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal, ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal,
}, },
}) })
@ -191,25 +191,25 @@ func TestNeedsHealthCheck(t *testing.T) {
}) })
checkNeedsHealthCheck(false, &v1.Service{ checkNeedsHealthCheck(false, &v1.Service{
Spec: v1.ServiceSpec{ Spec: v1.ServiceSpec{
Type: v1.ServiceTypeNodePort, Type: v1.ServiceTypeNodePort,
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeCluster, ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeCluster,
}, },
}) })
checkNeedsHealthCheck(false, &v1.Service{ checkNeedsHealthCheck(false, &v1.Service{
Spec: v1.ServiceSpec{ Spec: v1.ServiceSpec{
Type: v1.ServiceTypeNodePort, Type: v1.ServiceTypeNodePort,
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal, ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal,
}, },
}) })
checkNeedsHealthCheck(false, &v1.Service{ checkNeedsHealthCheck(false, &v1.Service{
Spec: v1.ServiceSpec{ Spec: v1.ServiceSpec{
Type: v1.ServiceTypeLoadBalancer, Type: v1.ServiceTypeLoadBalancer,
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeCluster, ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeCluster,
}, },
}) })
checkNeedsHealthCheck(true, &v1.Service{ checkNeedsHealthCheck(true, &v1.Service{
Spec: v1.ServiceSpec{ Spec: v1.ServiceSpec{
Type: v1.ServiceTypeLoadBalancer, Type: v1.ServiceTypeLoadBalancer,
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal, ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal,
}, },
}) })

View File

@ -51,7 +51,7 @@ func TestValidateSARSpec(t *testing.T) {
obj: authorizationapi.SubjectAccessReviewSpec{ obj: authorizationapi.SubjectAccessReviewSpec{
ResourceAttributes: &authorizationapi.ResourceAttributes{}, ResourceAttributes: &authorizationapi.ResourceAttributes{},
NonResourceAttributes: &authorizationapi.NonResourceAttributes{}, NonResourceAttributes: &authorizationapi.NonResourceAttributes{},
User: "me", User: "me",
}, },
msg: "cannot be specified in combination with resourceAttributes", msg: "cannot be specified in combination with resourceAttributes",
}, },
@ -183,7 +183,7 @@ func TestValidateLocalSAR(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Namespace: "a"}, ObjectMeta: metav1.ObjectMeta{Namespace: "a"},
Spec: authorizationapi.SubjectAccessReviewSpec{ Spec: authorizationapi.SubjectAccessReviewSpec{
NonResourceAttributes: &authorizationapi.NonResourceAttributes{}, NonResourceAttributes: &authorizationapi.NonResourceAttributes{},
User: "user", User: "user",
}, },
}, },
msg: "disallowed on this kind of request", msg: "disallowed on this kind of request",

View File

@ -39,7 +39,7 @@ func SetDefaults_HorizontalPodAutoscaler(obj *autoscalingv2beta1.HorizontalPodAu
{ {
Type: autoscalingv2beta1.ResourceMetricSourceType, Type: autoscalingv2beta1.ResourceMetricSourceType,
Resource: &autoscalingv2beta1.ResourceMetricSource{ Resource: &autoscalingv2beta1.ResourceMetricSource{
Name: v1.ResourceCPU, Name: v1.ResourceCPU,
TargetAverageUtilization: &utilizationDefaultVal, TargetAverageUtilization: &utilizationDefaultVal,
}, },
}, },

View File

@ -39,7 +39,7 @@ func TestSetDefaultHPA(t *testing.T) {
{ {
Type: autoscalingv2beta1.ResourceMetricSourceType, Type: autoscalingv2beta1.ResourceMetricSourceType,
Resource: &autoscalingv2beta1.ResourceMetricSource{ Resource: &autoscalingv2beta1.ResourceMetricSource{
Name: v1.ResourceCPU, Name: v1.ResourceCPU,
TargetAverageUtilization: &utilizationDefaultVal, TargetAverageUtilization: &utilizationDefaultVal,
}, },
}, },

View File

@ -10285,14 +10285,14 @@ func TestValidateNode(t *testing.T) {
for i := range errs { for i := range errs {
field := errs[i].Field field := errs[i].Field
expectedFields := map[string]bool{ expectedFields := map[string]bool{
"metadata.name": true, "metadata.name": true,
"metadata.labels": true, "metadata.labels": true,
"metadata.annotations": true, "metadata.annotations": true,
"metadata.namespace": true, "metadata.namespace": true,
"spec.externalID": true, "spec.externalID": true,
"spec.taints[0].key": true, "spec.taints[0].key": true,
"spec.taints[0].value": true, "spec.taints[0].value": true,
"spec.taints[0].effect": true, "spec.taints[0].effect": true,
"metadata.annotations.scheduler.alpha.kubernetes.io/preferAvoidPods[0].PodSignature": true, "metadata.annotations.scheduler.alpha.kubernetes.io/preferAvoidPods[0].PodSignature": true,
"metadata.annotations.scheduler.alpha.kubernetes.io/preferAvoidPods[0].PodSignature.PodController.Controller": true, "metadata.annotations.scheduler.alpha.kubernetes.io/preferAvoidPods[0].PodSignature.PodController.Controller": true,
} }
@ -12235,7 +12235,7 @@ func TestValidateBasicAuthSecret(t *testing.T) {
secret core.Secret secret core.Secret
valid bool valid bool
}{ }{
"valid": {validBasicAuthSecret(), true}, "valid": {validBasicAuthSecret(), true},
"missing username and password": {missingBasicAuthUsernamePasswordKeys, false}, "missing username and password": {missingBasicAuthUsernamePasswordKeys, false},
} }

View File

@ -1123,7 +1123,7 @@ func TestGetLoadBalancerAdditionalTags(t *testing.T) {
{ {
Annotations: map[string]string{ Annotations: map[string]string{
ServiceAnnotationLoadBalancerAdditionalTags: "Key1=, Key2=Val2", ServiceAnnotationLoadBalancerAdditionalTags: "Key1=, Key2=Val2",
"anotherKey": "anotherValue", "anotherKey": "anotherValue",
}, },
Tags: map[string]string{ Tags: map[string]string{
"Key1": "", "Key1": "",

View File

@ -702,7 +702,7 @@ func (az *Cloud) reconcileLoadBalancer(clusterName string, service *v1.Service,
newConfigs = append(newConfigs, newConfigs = append(newConfigs,
network.FrontendIPConfiguration{ network.FrontendIPConfiguration{
Name: to.StringPtr(lbFrontendIPConfigName), Name: to.StringPtr(lbFrontendIPConfigName),
FrontendIPConfigurationPropertiesFormat: fipConfigurationProperties, FrontendIPConfigurationPropertiesFormat: fipConfigurationProperties,
}) })
glog.V(10).Infof("reconcileLoadBalancer for service (%s)(%t): lb frontendconfig(%s) - adding", serviceName, wantLb, lbFrontendIPConfigName) glog.V(10).Infof("reconcileLoadBalancer for service (%s)(%t): lb frontendconfig(%s) - adding", serviceName, wantLb, lbFrontendIPConfigName)
@ -1025,8 +1025,8 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service,
DestinationPortRange: to.StringPtr(strconv.Itoa(int(port.Port))), DestinationPortRange: to.StringPtr(strconv.Itoa(int(port.Port))),
SourceAddressPrefix: to.StringPtr(sourceAddressPrefixes[j]), SourceAddressPrefix: to.StringPtr(sourceAddressPrefixes[j]),
DestinationAddressPrefix: to.StringPtr(destinationIPAddress), DestinationAddressPrefix: to.StringPtr(destinationIPAddress),
Access: network.SecurityRuleAccessAllow, Access: network.SecurityRuleAccessAllow,
Direction: network.SecurityRuleDirectionInbound, Direction: network.SecurityRuleDirectionInbound,
}, },
} }
} }
@ -1226,8 +1226,8 @@ func makeConsolidatable(rule network.SecurityRule) network.SecurityRule {
SourceAddressPrefix: rule.SourceAddressPrefix, SourceAddressPrefix: rule.SourceAddressPrefix,
SourceAddressPrefixes: rule.SourceAddressPrefixes, SourceAddressPrefixes: rule.SourceAddressPrefixes,
DestinationAddressPrefixes: collectionOrSingle(rule.DestinationAddressPrefixes, rule.DestinationAddressPrefix), DestinationAddressPrefixes: collectionOrSingle(rule.DestinationAddressPrefixes, rule.DestinationAddressPrefix),
Access: rule.Access, Access: rule.Access,
Direction: rule.Direction, Direction: rule.Direction,
}, },
} }
} }
@ -1248,8 +1248,8 @@ func consolidate(existingRule network.SecurityRule, newRule network.SecurityRule
SourceAddressPrefix: existingRule.SourceAddressPrefix, SourceAddressPrefix: existingRule.SourceAddressPrefix,
SourceAddressPrefixes: existingRule.SourceAddressPrefixes, SourceAddressPrefixes: existingRule.SourceAddressPrefixes,
DestinationAddressPrefixes: destinations, DestinationAddressPrefixes: destinations,
Access: existingRule.Access, Access: existingRule.Access,
Direction: existingRule.Direction, Direction: existingRule.Direction,
}, },
} }
} }

View File

@ -114,10 +114,10 @@ func (az *Cloud) ensureStorageAccount(accountName, accountType, resourceGroup, l
cp := storage.AccountCreateParameters{ cp := storage.AccountCreateParameters{
Sku: &storage.Sku{Name: storage.SkuName(accountType)}, Sku: &storage.Sku{Name: storage.SkuName(accountType)},
// switch to use StorageV2 as it's recommended according to https://docs.microsoft.com/en-us/azure/storage/common/storage-account-options // switch to use StorageV2 as it's recommended according to https://docs.microsoft.com/en-us/azure/storage/common/storage-account-options
Kind: storage.StorageV2, Kind: storage.StorageV2,
AccountPropertiesCreateParameters: &storage.AccountPropertiesCreateParameters{EnableHTTPSTrafficOnly: to.BoolPtr(true)}, AccountPropertiesCreateParameters: &storage.AccountPropertiesCreateParameters{EnableHTTPSTrafficOnly: to.BoolPtr(true)},
Tags: map[string]*string{"created-by": to.StringPtr("azure")}, Tags: map[string]*string{"created-by": to.StringPtr("azure")},
Location: &location} Location: &location}
ctx, cancel := getContextWithCancel() ctx, cancel := getContextWithCancel()
defer cancel() defer cancel()

View File

@ -952,7 +952,7 @@ func getTestCloud() (az *Cloud) {
RouteTableName: "rt", RouteTableName: "rt",
PrimaryAvailabilitySetName: "as", PrimaryAvailabilitySetName: "as",
MaximumLoadBalancerRuleCount: 250, MaximumLoadBalancerRuleCount: 250,
VMType: vmTypeStandard, VMType: vmTypeStandard,
}, },
nodeZones: map[string]sets.String{}, nodeZones: map[string]sets.String{},
nodeInformerSynced: func() bool { return true }, nodeInformerSynced: func() bool { return true },
@ -1968,8 +1968,8 @@ func TestIfServiceSpecifiesSharedRuleAndRuleExistsThenTheServicesPortAndAddressA
SourceAddressPrefix: to.StringPtr("Internet"), SourceAddressPrefix: to.StringPtr("Internet"),
DestinationPortRange: to.StringPtr("80"), DestinationPortRange: to.StringPtr("80"),
DestinationAddressPrefix: to.StringPtr("192.168.33.44"), DestinationAddressPrefix: to.StringPtr("192.168.33.44"),
Access: network.SecurityRuleAccessAllow, Access: network.SecurityRuleAccessAllow,
Direction: network.SecurityRuleDirectionInbound, Direction: network.SecurityRuleDirectionInbound,
}, },
}, },
} }

View File

@ -529,9 +529,9 @@ func TestGetRegionInURL(t *testing.T) {
"https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/a": "us-central1", "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/a": "us-central1",
"https://www.googleapis.com/compute/v1/projects/my-project/regions/us-west2/subnetworks/b": "us-west2", "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-west2/subnetworks/b": "us-west2",
"projects/my-project/regions/asia-central1/subnetworks/c": "asia-central1", "projects/my-project/regions/asia-central1/subnetworks/c": "asia-central1",
"regions/europe-north2": "europe-north2", "regions/europe-north2": "europe-north2",
"my-url": "", "my-url": "",
"": "", "": "",
} }
for input, output := range cases { for input, output := range cases {
result := getRegionInURL(input) result := getRegionInURL(input)

View File

@ -38,7 +38,7 @@ type VolumeOptions struct {
var ( var (
// DiskFormatValidType specifies the valid disk formats // DiskFormatValidType specifies the valid disk formats
DiskFormatValidType = map[string]string{ DiskFormatValidType = map[string]string{
ThinDiskType: ThinDiskType, ThinDiskType: ThinDiskType,
strings.ToLower(EagerZeroedThickDiskType): EagerZeroedThickDiskType, strings.ToLower(EagerZeroedThickDiskType): EagerZeroedThickDiskType,
strings.ToLower(ZeroedThickDiskType): PreallocatedDiskType, strings.ToLower(ZeroedThickDiskType): PreallocatedDiskType,
} }

View File

@ -82,7 +82,7 @@ func newReplicationController(replicas int) *v1.ReplicationController {
Spec: v1.PodSpec{ Spec: v1.PodSpec{
Containers: []v1.Container{ Containers: []v1.Container{
{ {
Image: "foo/bar", Image: "foo/bar",
TerminationMessagePath: v1.TerminationMessagePathDefault, TerminationMessagePath: v1.TerminationMessagePathDefault,
ImagePullPolicy: v1.PullIfNotPresent, ImagePullPolicy: v1.PullIfNotPresent,
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(), SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),
@ -144,7 +144,7 @@ func newReplicaSet(name string, replicas int) *apps.ReplicaSet {
Spec: v1.PodSpec{ Spec: v1.PodSpec{
Containers: []v1.Container{ Containers: []v1.Container{
{ {
Image: "foo/bar", Image: "foo/bar",
TerminationMessagePath: v1.TerminationMessagePathDefault, TerminationMessagePath: v1.TerminationMessagePathDefault,
ImagePullPolicy: v1.PullIfNotPresent, ImagePullPolicy: v1.PullIfNotPresent,
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(), SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),

View File

@ -111,7 +111,7 @@ func newDaemonSet(name string) *apps.DaemonSet {
Spec: v1.PodSpec{ Spec: v1.PodSpec{
Containers: []v1.Container{ Containers: []v1.Container{
{ {
Image: "foo/bar", Image: "foo/bar",
TerminationMessagePath: v1.TerminationMessagePathDefault, TerminationMessagePath: v1.TerminationMessagePathDefault,
ImagePullPolicy: v1.PullIfNotPresent, ImagePullPolicy: v1.PullIfNotPresent,
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(), SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),
@ -180,7 +180,7 @@ func newPod(podName string, nodeName string, label map[string]string, ds *apps.D
podSpec = v1.PodSpec{ podSpec = v1.PodSpec{
Containers: []v1.Container{ Containers: []v1.Container{
{ {
Image: "foo/bar", Image: "foo/bar",
TerminationMessagePath: v1.TerminationMessagePathDefault, TerminationMessagePath: v1.TerminationMessagePathDefault,
ImagePullPolicy: v1.PullIfNotPresent, ImagePullPolicy: v1.PullIfNotPresent,
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(), SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),

View File

@ -71,7 +71,7 @@ func NewNamespaceController(
// create the controller so we can inject the enqueue function // create the controller so we can inject the enqueue function
namespaceController := &NamespaceController{ namespaceController := &NamespaceController{
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "namespace"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "namespace"),
namespacedResourcesDeleter: deletion.NewNamespacedResourcesDeleter(kubeClient.CoreV1().Namespaces(), dynamicClient, kubeClient.CoreV1(), discoverResourcesFn, finalizerToken, true), namespacedResourcesDeleter: deletion.NewNamespacedResourcesDeleter(kubeClient.CoreV1().Namespaces(), dynamicClient, kubeClient.CoreV1(), discoverResourcesFn, finalizerToken, true),
} }

View File

@ -117,9 +117,9 @@ func NewHorizontalController(
scaleNamespacer: scaleNamespacer, scaleNamespacer: scaleNamespacer,
hpaNamespacer: hpaNamespacer, hpaNamespacer: hpaNamespacer,
downscaleStabilisationWindow: downscaleStabilisationWindow, downscaleStabilisationWindow: downscaleStabilisationWindow,
queue: workqueue.NewNamedRateLimitingQueue(NewDefaultHPARateLimiter(resyncPeriod), "horizontalpodautoscaler"), queue: workqueue.NewNamedRateLimitingQueue(NewDefaultHPARateLimiter(resyncPeriod), "horizontalpodautoscaler"),
mapper: mapper, mapper: mapper,
recommendations: map[string][]timestampedRecommendation{}, recommendations: map[string][]timestampedRecommendation{},
} }
hpaInformer.Informer().AddEventHandlerWithResyncPeriod( hpaInformer.Informer().AddEventHandlerWithResyncPeriod(

View File

@ -179,7 +179,7 @@ func (tc *legacyTestCase) prepareTestClient(t *testing.T) (*fake.Clientset, *sca
{ {
Type: autoscalingv2.ResourceMetricSourceType, Type: autoscalingv2.ResourceMetricSourceType,
Resource: &autoscalingv2.ResourceMetricSource{ Resource: &autoscalingv2.ResourceMetricSource{
Name: v1.ResourceCPU, Name: v1.ResourceCPU,
TargetAverageUtilization: &tc.CPUTarget, TargetAverageUtilization: &tc.CPUTarget,
}, },
}, },

View File

@ -101,7 +101,7 @@ func newReplicaSet(replicas int, selectorMap map[string]string) *apps.ReplicaSet
Spec: v1.PodSpec{ Spec: v1.PodSpec{
Containers: []v1.Container{ Containers: []v1.Container{
{ {
Image: "foo/bar", Image: "foo/bar",
TerminationMessagePath: v1.TerminationMessagePathDefault, TerminationMessagePath: v1.TerminationMessagePathDefault,
ImagePullPolicy: v1.PullIfNotPresent, ImagePullPolicy: v1.PullIfNotPresent,
SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(), SecurityContext: securitycontext.ValidSecurityContextWithContainerDefaults(),

View File

@ -98,12 +98,12 @@ func TestReconcile(t *testing.T) {
&node2, &node2,
}, },
initialRoutes: []*cloudprovider.Route{ initialRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
}, },
expectedRoutes: []*cloudprovider.Route{ expectedRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
}, },
expectedNetworkUnavailable: []bool{true, true}, expectedNetworkUnavailable: []bool{true, true},
clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}), clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}),
@ -115,11 +115,11 @@ func TestReconcile(t *testing.T) {
&node2, &node2,
}, },
initialRoutes: []*cloudprovider.Route{ initialRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
}, },
expectedRoutes: []*cloudprovider.Route{ expectedRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
}, },
expectedNetworkUnavailable: []bool{true, true}, expectedNetworkUnavailable: []bool{true, true},
clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}), clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}),
@ -132,8 +132,8 @@ func TestReconcile(t *testing.T) {
}, },
initialRoutes: []*cloudprovider.Route{}, initialRoutes: []*cloudprovider.Route{},
expectedRoutes: []*cloudprovider.Route{ expectedRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
}, },
expectedNetworkUnavailable: []bool{true, true}, expectedNetworkUnavailable: []bool{true, true},
clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}), clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}),
@ -145,14 +145,14 @@ func TestReconcile(t *testing.T) {
&node2, &node2,
}, },
initialRoutes: []*cloudprovider.Route{ initialRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
{cluster + "-03", "node-3", "10.120.2.0/24", false}, {Name: cluster + "-03", TargetNode: "node-3", DestinationCIDR: "10.120.2.0/24", Blackhole: false},
{cluster + "-04", "node-4", "10.120.3.0/24", false}, {Name: cluster + "-04", TargetNode: "node-4", DestinationCIDR: "10.120.3.0/24", Blackhole: false},
}, },
expectedRoutes: []*cloudprovider.Route{ expectedRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
}, },
expectedNetworkUnavailable: []bool{true, true}, expectedNetworkUnavailable: []bool{true, true},
clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}), clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}),
@ -164,12 +164,12 @@ func TestReconcile(t *testing.T) {
&node2, &node2,
}, },
initialRoutes: []*cloudprovider.Route{ initialRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-03", "node-3", "10.120.2.0/24", false}, {Name: cluster + "-03", TargetNode: "node-3", DestinationCIDR: "10.120.2.0/24", Blackhole: false},
}, },
expectedRoutes: []*cloudprovider.Route{ expectedRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
}, },
expectedNetworkUnavailable: []bool{true, true}, expectedNetworkUnavailable: []bool{true, true},
clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}), clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}),
@ -182,7 +182,7 @@ func TestReconcile(t *testing.T) {
}, },
initialRoutes: []*cloudprovider.Route{}, initialRoutes: []*cloudprovider.Route{},
expectedRoutes: []*cloudprovider.Route{ expectedRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
}, },
expectedNetworkUnavailable: []bool{true, false}, expectedNetworkUnavailable: []bool{true, false},
clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, nodeNoCidr}}), clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, nodeNoCidr}}),
@ -194,13 +194,13 @@ func TestReconcile(t *testing.T) {
&node2, &node2,
}, },
initialRoutes: []*cloudprovider.Route{ initialRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
{cluster + "-03", "", "10.120.2.0/24", true}, {Name: cluster + "-03", TargetNode: "", DestinationCIDR: "10.120.2.0/24", Blackhole: true},
}, },
expectedRoutes: []*cloudprovider.Route{ expectedRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
}, },
expectedNetworkUnavailable: []bool{true, true}, expectedNetworkUnavailable: []bool{true, true},
clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}), clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}),
@ -212,14 +212,14 @@ func TestReconcile(t *testing.T) {
&node2, &node2,
}, },
initialRoutes: []*cloudprovider.Route{ initialRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
{cluster + "-03", "", "10.1.2.0/24", true}, {Name: cluster + "-03", TargetNode: "", DestinationCIDR: "10.1.2.0/24", Blackhole: true},
}, },
expectedRoutes: []*cloudprovider.Route{ expectedRoutes: []*cloudprovider.Route{
{cluster + "-01", "node-1", "10.120.0.0/24", false}, {Name: cluster + "-01", TargetNode: "node-1", DestinationCIDR: "10.120.0.0/24", Blackhole: false},
{cluster + "-02", "node-2", "10.120.1.0/24", false}, {Name: cluster + "-02", TargetNode: "node-2", DestinationCIDR: "10.120.1.0/24", Blackhole: false},
{cluster + "-03", "", "10.1.2.0/24", true}, {Name: cluster + "-03", TargetNode: "", DestinationCIDR: "10.1.2.0/24", Blackhole: true},
}, },
expectedNetworkUnavailable: []bool{true, true}, expectedNetworkUnavailable: []bool{true, true},
clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}), clientset: fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{node1, node2}}),

View File

@ -65,7 +65,7 @@ func NewServiceAccountsController(saInformer coreinformers.ServiceAccountInforme
e := &ServiceAccountsController{ e := &ServiceAccountsController{
client: cl, client: cl,
serviceAccountsToEnsure: options.ServiceAccounts, serviceAccountsToEnsure: options.ServiceAccounts,
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "serviceaccount"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "serviceaccount"),
} }
if cl != nil && cl.CoreV1().RESTClient().GetRateLimiter() != nil { if cl != nil && cl.CoreV1().RESTClient().GetRateLimiter() != nil {
if err := metrics.RegisterMetricAndTrackRateLimiterUsage("serviceaccount_controller", cl.CoreV1().RESTClient().GetRateLimiter()); err != nil { if err := metrics.RegisterMetricAndTrackRateLimiterUsage("serviceaccount_controller", cl.CoreV1().RESTClient().GetRateLimiter()); err != nil {

View File

@ -1245,27 +1245,27 @@ func TestAlphaStorageObjectInUseProtectionFiltering(t *testing.T) {
enableStorageObjectInUseProtection bool enableStorageObjectInUseProtection bool
}{ }{
"feature enabled - pv deletionTimeStamp not set": { "feature enabled - pv deletionTimeStamp not set": {
isExpectedMatch: true, isExpectedMatch: true,
vol: pv, vol: pv,
pvc: pvc, pvc: pvc,
enableStorageObjectInUseProtection: true, enableStorageObjectInUseProtection: true,
}, },
"feature enabled - pv deletionTimeStamp set": { "feature enabled - pv deletionTimeStamp set": {
isExpectedMatch: false, isExpectedMatch: false,
vol: pvToDelete, vol: pvToDelete,
pvc: pvc, pvc: pvc,
enableStorageObjectInUseProtection: true, enableStorageObjectInUseProtection: true,
}, },
"feature disabled - pv deletionTimeStamp not set": { "feature disabled - pv deletionTimeStamp not set": {
isExpectedMatch: true, isExpectedMatch: true,
vol: pv, vol: pv,
pvc: pvc, pvc: pvc,
enableStorageObjectInUseProtection: false, enableStorageObjectInUseProtection: false,
}, },
"feature disabled - pv deletionTimeStamp set": { "feature disabled - pv deletionTimeStamp set": {
isExpectedMatch: true, isExpectedMatch: true,
vol: pvToDelete, vol: pvToDelete,
pvc: pvc, pvc: pvc,
enableStorageObjectInUseProtection: false, enableStorageObjectInUseProtection: false,
}, },
} }
@ -1291,27 +1291,27 @@ func TestAlphaStorageObjectInUseProtectionFiltering(t *testing.T) {
enableStorageObjectInUseProtection bool enableStorageObjectInUseProtection bool
}{ }{
"feature enabled - pv deletionTimeStamp not set": { "feature enabled - pv deletionTimeStamp not set": {
isExpectedMatch: true, isExpectedMatch: true,
vol: createTestVolOrderedIndex(pv), vol: createTestVolOrderedIndex(pv),
pvc: pvc, pvc: pvc,
enableStorageObjectInUseProtection: true, enableStorageObjectInUseProtection: true,
}, },
"feature enabled - pv deletionTimeStamp set": { "feature enabled - pv deletionTimeStamp set": {
isExpectedMatch: false, isExpectedMatch: false,
vol: createTestVolOrderedIndex(pvToDelete), vol: createTestVolOrderedIndex(pvToDelete),
pvc: pvc, pvc: pvc,
enableStorageObjectInUseProtection: true, enableStorageObjectInUseProtection: true,
}, },
"feature disabled - pv deletionTimeStamp not set": { "feature disabled - pv deletionTimeStamp not set": {
isExpectedMatch: true, isExpectedMatch: true,
vol: createTestVolOrderedIndex(pv), vol: createTestVolOrderedIndex(pv),
pvc: pvc, pvc: pvc,
enableStorageObjectInUseProtection: false, enableStorageObjectInUseProtection: false,
}, },
"feature disabled - pv deletionTimeStamp set": { "feature disabled - pv deletionTimeStamp set": {
isExpectedMatch: true, isExpectedMatch: true,
vol: createTestVolOrderedIndex(pvToDelete), vol: createTestVolOrderedIndex(pvToDelete),
pvc: pvc, pvc: pvc,
enableStorageObjectInUseProtection: false, enableStorageObjectInUseProtection: false,
}, },
} }

View File

@ -79,12 +79,12 @@ func NewController(p ControllerParameters) (*PersistentVolumeController, error)
} }
controller := &PersistentVolumeController{ controller := &PersistentVolumeController{
volumes: newPersistentVolumeOrderedIndex(), volumes: newPersistentVolumeOrderedIndex(),
claims: cache.NewStore(cache.DeletionHandlingMetaNamespaceKeyFunc), claims: cache.NewStore(cache.DeletionHandlingMetaNamespaceKeyFunc),
kubeClient: p.KubeClient, kubeClient: p.KubeClient,
eventRecorder: eventRecorder, eventRecorder: eventRecorder,
runningOperations: goroutinemap.NewGoRoutineMap(true /* exponentialBackOffOnError */), runningOperations: goroutinemap.NewGoRoutineMap(true /* exponentialBackOffOnError */),
cloud: p.Cloud, cloud: p.Cloud,
enableDynamicProvisioning: p.EnableDynamicProvisioning, enableDynamicProvisioning: p.EnableDynamicProvisioning,
clusterName: p.ClusterName, clusterName: p.ClusterName,
createProvisionedPVRetryCount: createProvisionedPVRetryCount, createProvisionedPVRetryCount: createProvisionedPVRetryCount,

View File

@ -57,8 +57,8 @@ type Controller struct {
// NewPVCProtectionController returns a new instance of PVCProtectionController. // NewPVCProtectionController returns a new instance of PVCProtectionController.
func NewPVCProtectionController(pvcInformer coreinformers.PersistentVolumeClaimInformer, podInformer coreinformers.PodInformer, cl clientset.Interface, storageObjectInUseProtectionFeatureEnabled bool) *Controller { func NewPVCProtectionController(pvcInformer coreinformers.PersistentVolumeClaimInformer, podInformer coreinformers.PodInformer, cl clientset.Interface, storageObjectInUseProtectionFeatureEnabled bool) *Controller {
e := &Controller{ e := &Controller{
client: cl, client: cl,
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "pvcprotection"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "pvcprotection"),
storageObjectInUseProtectionEnabled: storageObjectInUseProtectionFeatureEnabled, storageObjectInUseProtectionEnabled: storageObjectInUseProtectionFeatureEnabled,
} }
if cl != nil && cl.CoreV1().RESTClient().GetRateLimiter() != nil { if cl != nil && cl.CoreV1().RESTClient().GetRateLimiter() != nil {

View File

@ -53,8 +53,8 @@ type Controller struct {
// NewPVProtectionController returns a new *Controller. // NewPVProtectionController returns a new *Controller.
func NewPVProtectionController(pvInformer coreinformers.PersistentVolumeInformer, cl clientset.Interface, storageObjectInUseProtectionFeatureEnabled bool) *Controller { func NewPVProtectionController(pvInformer coreinformers.PersistentVolumeInformer, cl clientset.Interface, storageObjectInUseProtectionFeatureEnabled bool) *Controller {
e := &Controller{ e := &Controller{
client: cl, client: cl,
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "pvprotection"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "pvprotection"),
storageObjectInUseProtectionEnabled: storageObjectInUseProtectionFeatureEnabled, storageObjectInUseProtectionEnabled: storageObjectInUseProtectionFeatureEnabled,
} }
if cl != nil && cl.CoreV1().RESTClient().GetRateLimiter() != nil { if cl != nil && cl.CoreV1().RESTClient().GetRateLimiter() != nil {

View File

@ -387,8 +387,8 @@ func init() {
// To add a new feature, define a key for it above and add it here. The features will be // To add a new feature, define a key for it above and add it here. The features will be
// available throughout Kubernetes binaries. // available throughout Kubernetes binaries.
var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureSpec{ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureSpec{
AppArmor: {Default: true, PreRelease: utilfeature.Beta}, AppArmor: {Default: true, PreRelease: utilfeature.Beta},
DynamicKubeletConfig: {Default: true, PreRelease: utilfeature.Beta}, DynamicKubeletConfig: {Default: true, PreRelease: utilfeature.Beta},
ExperimentalHostUserNamespaceDefaultingGate: {Default: false, PreRelease: utilfeature.Beta}, ExperimentalHostUserNamespaceDefaultingGate: {Default: false, PreRelease: utilfeature.Beta},
ExperimentalCriticalPodAnnotation: {Default: false, PreRelease: utilfeature.Alpha}, ExperimentalCriticalPodAnnotation: {Default: false, PreRelease: utilfeature.Alpha},
DevicePlugins: {Default: true, PreRelease: utilfeature.Beta}, DevicePlugins: {Default: true, PreRelease: utilfeature.Beta},

View File

@ -160,9 +160,9 @@ func TestExtractFieldPathAsString(t *testing.T) {
expectedMessageFragment: "invalid key subscript in metadata.labels", expectedMessageFragment: "invalid key subscript in metadata.labels",
}, },
{ {
name: "invalid subscript", name: "invalid subscript",
fieldPath: "metadata.notexisting['something']", fieldPath: "metadata.notexisting['something']",
obj: &v1.Pod{}, obj: &v1.Pod{},
expectedMessageFragment: "fieldPath \"metadata.notexisting['something']\" does not support subscript", expectedMessageFragment: "fieldPath \"metadata.notexisting['something']\" does not support subscript",
}, },
} }

View File

@ -39,7 +39,7 @@ type BuiltInAuthorizationOptions struct {
func NewBuiltInAuthorizationOptions() *BuiltInAuthorizationOptions { func NewBuiltInAuthorizationOptions() *BuiltInAuthorizationOptions {
return &BuiltInAuthorizationOptions{ return &BuiltInAuthorizationOptions{
Modes: []string{authzmodes.ModeAlwaysAllow}, Modes: []string{authzmodes.ModeAlwaysAllow},
WebhookCacheAuthorizedTTL: 5 * time.Minute, WebhookCacheAuthorizedTTL: 5 * time.Minute,
WebhookCacheUnauthorizedTTL: 30 * time.Second, WebhookCacheUnauthorizedTTL: 30 * time.Second,
} }

View File

@ -123,11 +123,11 @@ func NewCmdAnnotate(parent string, f cmdutil.Factory, ioStreams genericclioption
o := NewAnnotateOptions(ioStreams) o := NewAnnotateOptions(ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]", Use: "annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Update the annotations on a resource"), Short: i18n.T("Update the annotations on a resource"),
Long: annotateLong + "\n\n" + cmdutil.SuggestApiResources(parent), Long: annotateLong + "\n\n" + cmdutil.SuggestApiResources(parent),
Example: annotateExample, Example: annotateExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd, args)) cmdutil.CheckErr(o.Complete(f, cmd, args))
cmdutil.CheckErr(o.Validate()) cmdutil.CheckErr(o.Validate())

View File

@ -146,11 +146,11 @@ func NewCmdApply(baseName string, f cmdutil.Factory, ioStreams genericclioptions
o.cmdBaseName = baseName o.cmdBaseName = baseName
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "apply -f FILENAME", Use: "apply -f FILENAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Apply a configuration to a resource by filename or stdin"), Short: i18n.T("Apply a configuration to a resource by filename or stdin"),
Long: applyLong, Long: applyLong,
Example: applyExample, Example: applyExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd)) cmdutil.CheckErr(o.Complete(f, cmd))
cmdutil.CheckErr(validateArgs(cmd, args)) cmdutil.CheckErr(validateArgs(cmd, args))

View File

@ -59,11 +59,11 @@ func NewCmdApplyEditLastApplied(f cmdutil.Factory, ioStreams genericclioptions.I
o := editor.NewEditOptions(editor.ApplyEditMode, ioStreams) o := editor.NewEditOptions(editor.ApplyEditMode, ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "edit-last-applied (RESOURCE/NAME | -f FILENAME)", Use: "edit-last-applied (RESOURCE/NAME | -f FILENAME)",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: "Edit latest last-applied-configuration annotations of a resource/object", Short: "Edit latest last-applied-configuration annotations of a resource/object",
Long: applyEditLastAppliedLong, Long: applyEditLastAppliedLong,
Example: applyEditLastAppliedExample, Example: applyEditLastAppliedExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
if err := o.Complete(f, args, cmd); err != nil { if err := o.Complete(f, args, cmd); err != nil {
cmdutil.CheckErr(err) cmdutil.CheckErr(err)

View File

@ -91,11 +91,11 @@ func NewSetLastAppliedOptions(ioStreams genericclioptions.IOStreams) *SetLastApp
func NewCmdApplySetLastApplied(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command { func NewCmdApplySetLastApplied(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command {
o := NewSetLastAppliedOptions(ioStreams) o := NewSetLastAppliedOptions(ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "set-last-applied -f FILENAME", Use: "set-last-applied -f FILENAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Set the last-applied-configuration annotation on a live object to match the contents of a file."), Short: i18n.T("Set the last-applied-configuration annotation on a live object to match the contents of a file."),
Long: applySetLastAppliedLong, Long: applySetLastAppliedLong,
Example: applySetLastAppliedExample, Example: applySetLastAppliedExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd)) cmdutil.CheckErr(o.Complete(f, cmd))
cmdutil.CheckErr(o.Validate()) cmdutil.CheckErr(o.Validate())

View File

@ -69,11 +69,11 @@ func NewCmdApplyViewLastApplied(f cmdutil.Factory, ioStreams genericclioptions.I
options := NewViewLastAppliedOptions(ioStreams) options := NewViewLastAppliedOptions(ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)", Use: "view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("View latest last-applied-configuration annotations of a resource/object"), Short: i18n.T("View latest last-applied-configuration annotations of a resource/object"),
Long: applyViewLastAppliedLong, Long: applyViewLastAppliedLong,
Example: applyViewLastAppliedExample, Example: applyViewLastAppliedExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(cmd, f, args)) cmdutil.CheckErr(options.Complete(cmd, f, args))
cmdutil.CheckErr(options.Validate(cmd)) cmdutil.CheckErr(options.Validate(cmd))

View File

@ -96,11 +96,11 @@ func NewAttachOptions(streams genericclioptions.IOStreams) *AttachOptions {
func NewCmdAttach(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { func NewCmdAttach(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
o := NewAttachOptions(streams) o := NewAttachOptions(streams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "attach (POD | TYPE/NAME) -c CONTAINER", Use: "attach (POD | TYPE/NAME) -c CONTAINER",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Attach to a running container"), Short: i18n.T("Attach to a running container"),
Long: "Attach to a process that is already running inside an existing container.", Long: "Attach to a process that is already running inside an existing container.",
Example: attachExample, Example: attachExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd, args)) cmdutil.CheckErr(o.Complete(f, cmd, args))
cmdutil.CheckErr(o.Validate()) cmdutil.CheckErr(o.Validate())

View File

@ -83,7 +83,7 @@ func TestPodAndContainerAttach(t *testing.T) {
args: []string{"foo"}, args: []string{"foo"},
expectedPodName: "foo", expectedPodName: "foo",
expectedContainerName: "bar", expectedContainerName: "bar",
obj: attachPod(), obj: attachPod(),
}, },
{ {
name: "container in flag", name: "container in flag",
@ -91,7 +91,7 @@ func TestPodAndContainerAttach(t *testing.T) {
args: []string{"foo"}, args: []string{"foo"},
expectedPodName: "foo", expectedPodName: "foo",
expectedContainerName: "bar", expectedContainerName: "bar",
obj: attachPod(), obj: attachPod(),
}, },
{ {
name: "init container in flag", name: "init container in flag",
@ -99,7 +99,7 @@ func TestPodAndContainerAttach(t *testing.T) {
args: []string{"foo"}, args: []string{"foo"},
expectedPodName: "foo", expectedPodName: "foo",
expectedContainerName: "initfoo", expectedContainerName: "initfoo",
obj: attachPod(), obj: attachPod(),
}, },
{ {
name: "non-existing container", name: "non-existing container",
@ -115,7 +115,7 @@ func TestPodAndContainerAttach(t *testing.T) {
args: []string{"pods", "foo"}, args: []string{"pods", "foo"},
expectedPodName: "foo", expectedPodName: "foo",
expectedContainerName: "bar", expectedContainerName: "bar",
obj: attachPod(), obj: attachPod(),
}, },
{ {
name: "invalid get pod timeout value", name: "invalid get pod timeout value",
@ -123,8 +123,8 @@ func TestPodAndContainerAttach(t *testing.T) {
args: []string{"pod/foo"}, args: []string{"pod/foo"},
expectedPodName: "foo", expectedPodName: "foo",
expectedContainerName: "bar", expectedContainerName: "bar",
obj: attachPod(), obj: attachPod(),
expectError: "must be higher than zero", expectError: "must be higher than zero",
}, },
} }

View File

@ -86,11 +86,11 @@ func NewCmdCanI(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]", Use: "can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: "Check whether an action is allowed", Short: "Check whether an action is allowed",
Long: canILong, Long: canILong,
Example: canIExample, Example: canIExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, args)) cmdutil.CheckErr(o.Complete(f, args))
cmdutil.CheckErr(o.Validate()) cmdutil.CheckErr(o.Validate())

View File

@ -78,11 +78,11 @@ func NewCmdReconcile(f cmdutil.Factory, streams genericclioptions.IOStreams) *co
o := NewReconcileOptions(streams) o := NewReconcileOptions(streams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "reconcile -f FILENAME", Use: "reconcile -f FILENAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: "Reconciles rules for RBAC Role, RoleBinding, ClusterRole, and ClusterRole binding objects", Short: "Reconciles rules for RBAC Role, RoleBinding, ClusterRole, and ClusterRole binding objects",
Long: reconcileLong, Long: reconcileLong,
Example: reconcileExample, Example: reconcileExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(cmd, f, args)) cmdutil.CheckErr(o.Complete(cmd, f, args))
cmdutil.CheckErr(o.Validate()) cmdutil.CheckErr(o.Validate())
@ -182,7 +182,7 @@ func (o *ReconcileOptions) RunReconcile() error {
reconcileOptions := reconciliation.ReconcileRoleOptions{ reconcileOptions := reconciliation.ReconcileRoleOptions{
Confirm: !o.DryRun, Confirm: !o.DryRun,
RemoveExtraPermissions: o.RemoveExtraPermissions, RemoveExtraPermissions: o.RemoveExtraPermissions,
Role: reconciliation.RoleRuleOwner{Role: t}, Role: reconciliation.RoleRuleOwner{Role: t},
Client: reconciliation.RoleModifier{ Client: reconciliation.RoleModifier{
NamespaceClient: o.NamespaceClient.Namespaces(), NamespaceClient: o.NamespaceClient.Namespaces(),
Client: o.RBACClient, Client: o.RBACClient,
@ -198,7 +198,7 @@ func (o *ReconcileOptions) RunReconcile() error {
reconcileOptions := reconciliation.ReconcileRoleOptions{ reconcileOptions := reconciliation.ReconcileRoleOptions{
Confirm: !o.DryRun, Confirm: !o.DryRun,
RemoveExtraPermissions: o.RemoveExtraPermissions, RemoveExtraPermissions: o.RemoveExtraPermissions,
Role: reconciliation.ClusterRoleRuleOwner{ClusterRole: t}, Role: reconciliation.ClusterRoleRuleOwner{ClusterRole: t},
Client: reconciliation.ClusterRoleModifier{ Client: reconciliation.ClusterRoleModifier{
Client: o.RBACClient.ClusterRoles(), Client: o.RBACClient.ClusterRoles(),
}, },

View File

@ -97,11 +97,11 @@ func NewCmdAutoscale(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *
validArgs := []string{"deployment", "replicaset", "replicationcontroller"} validArgs := []string{"deployment", "replicaset", "replicationcontroller"}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]", Use: "autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Auto-scale a Deployment, ReplicaSet, or ReplicationController"), Short: i18n.T("Auto-scale a Deployment, ReplicaSet, or ReplicationController"),
Long: autoscaleLong, Long: autoscaleLong,
Example: autoscaleExample, Example: autoscaleExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd, args)) cmdutil.CheckErr(o.Complete(f, cmd, args))
cmdutil.CheckErr(o.Validate()) cmdutil.CheckErr(o.Validate())

View File

@ -38,10 +38,10 @@ import (
func NewCmdCertificate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command { func NewCmdCertificate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "certificate SUBCOMMAND", Use: "certificate SUBCOMMAND",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Modify certificate resources."), Short: i18n.T("Modify certificate resources."),
Long: "Modify certificate resources.", Long: "Modify certificate resources.",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmd.Help() cmd.Help()
}, },
@ -108,9 +108,9 @@ func NewCmdCertificateApprove(f cmdutil.Factory, ioStreams genericclioptions.IOS
IOStreams: ioStreams, IOStreams: ioStreams,
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "approve (-f FILENAME | NAME)", Use: "approve (-f FILENAME | NAME)",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Approve a certificate signing request"), Short: i18n.T("Approve a certificate signing request"),
Long: templates.LongDesc(` Long: templates.LongDesc(`
Approve a certificate signing request. Approve a certificate signing request.
@ -165,9 +165,9 @@ func NewCmdCertificateDeny(f cmdutil.Factory, ioStreams genericclioptions.IOStre
IOStreams: ioStreams, IOStreams: ioStreams,
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "deny (-f FILENAME | NAME)", Use: "deny (-f FILENAME | NAME)",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Deny a certificate signing request"), Short: i18n.T("Deny a certificate signing request"),
Long: templates.LongDesc(` Long: templates.LongDesc(`
Deny a certificate signing request. Deny a certificate signing request.

View File

@ -99,11 +99,11 @@ func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "completion SHELL", Use: "completion SHELL",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Output shell completion code for the specified shell (bash or zsh)"), Short: i18n.T("Output shell completion code for the specified shell (bash or zsh)"),
Long: completion_long, Long: completion_long,
Example: completion_example, Example: completion_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := RunCompletion(out, boilerPlate, cmd, args) err := RunCompletion(out, boilerPlate, cmd, args)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)

View File

@ -37,9 +37,9 @@ func NewCmdConfig(f cmdutil.Factory, pathOptions *clientcmd.PathOptions, streams
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "config SUBCOMMAND", Use: "config SUBCOMMAND",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Modify kubeconfig files"), Short: i18n.T("Modify kubeconfig files"),
Long: templates.LongDesc(` Long: templates.LongDesc(`
Modify kubeconfig files using subcommands like "kubectl config set current-context my-context" Modify kubeconfig files using subcommands like "kubectl config set current-context my-context"

View File

@ -100,11 +100,11 @@ func NewCmdConfigSetAuthInfo(out io.Writer, configAccess clientcmd.ConfigAccess)
func newCmdConfigSetAuthInfo(out io.Writer, options *createAuthInfoOptions) *cobra.Command { func newCmdConfigSetAuthInfo(out io.Writer, options *createAuthInfoOptions) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: fmt.Sprintf("set-credentials NAME [--%v=path/to/certfile] [--%v=path/to/keyfile] [--%v=bearer_token] [--%v=basic_user] [--%v=basic_password] [--%v=provider_name] [--%v=key=value]", clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword, flagAuthProvider, flagAuthProviderArg), Use: fmt.Sprintf("set-credentials NAME [--%v=path/to/certfile] [--%v=path/to/keyfile] [--%v=bearer_token] [--%v=basic_user] [--%v=basic_password] [--%v=provider_name] [--%v=key=value]", clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword, flagAuthProvider, flagAuthProviderArg),
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Sets a user entry in kubeconfig"), Short: i18n.T("Sets a user entry in kubeconfig"),
Long: create_authinfo_long, Long: create_authinfo_long,
Example: create_authinfo_example, Example: create_authinfo_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := options.complete(cmd, out) err := options.complete(cmd, out)
if err != nil { if err != nil {

View File

@ -63,11 +63,11 @@ func NewCmdConfigSetCluster(out io.Writer, configAccess clientcmd.ConfigAccess)
options := &createClusterOptions{configAccess: configAccess} options := &createClusterOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: fmt.Sprintf("set-cluster NAME [--%v=server] [--%v=path/to/certificate/authority] [--%v=true]", clientcmd.FlagAPIServer, clientcmd.FlagCAFile, clientcmd.FlagInsecure), Use: fmt.Sprintf("set-cluster NAME [--%v=server] [--%v=path/to/certificate/authority] [--%v=true]", clientcmd.FlagAPIServer, clientcmd.FlagCAFile, clientcmd.FlagInsecure),
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Sets a cluster entry in kubeconfig"), Short: i18n.T("Sets a cluster entry in kubeconfig"),
Long: create_cluster_long, Long: create_cluster_long,
Example: create_cluster_example, Example: create_cluster_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.complete(cmd)) cmdutil.CheckErr(options.complete(cmd))
cmdutil.CheckErr(options.run()) cmdutil.CheckErr(options.run())

View File

@ -55,11 +55,11 @@ func NewCmdConfigSetContext(out io.Writer, configAccess clientcmd.ConfigAccess)
options := &createContextOptions{configAccess: configAccess} options := &createContextOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: fmt.Sprintf("set-context [NAME | --current] [--%v=cluster_nickname] [--%v=user_nickname] [--%v=namespace]", clientcmd.FlagClusterName, clientcmd.FlagAuthInfoName, clientcmd.FlagNamespace), Use: fmt.Sprintf("set-context [NAME | --current] [--%v=cluster_nickname] [--%v=user_nickname] [--%v=namespace]", clientcmd.FlagClusterName, clientcmd.FlagAuthInfoName, clientcmd.FlagNamespace),
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Sets a context entry in kubeconfig"), Short: i18n.T("Sets a context entry in kubeconfig"),
Long: create_context_long, Long: create_context_long,
Example: create_context_example, Example: create_context_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.complete(cmd)) cmdutil.CheckErr(options.complete(cmd))
name, exists, err := options.run() name, exists, err := options.run()

View File

@ -35,11 +35,11 @@ var (
func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command { func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "delete-cluster NAME", Use: "delete-cluster NAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Delete the specified cluster from the kubeconfig"), Short: i18n.T("Delete the specified cluster from the kubeconfig"),
Long: "Delete the specified cluster from the kubeconfig", Long: "Delete the specified cluster from the kubeconfig",
Example: delete_cluster_example, Example: delete_cluster_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := runDeleteCluster(out, configAccess, cmd) err := runDeleteCluster(out, configAccess, cmd)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)

View File

@ -35,11 +35,11 @@ var (
func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command { func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "delete-context NAME", Use: "delete-context NAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Delete the specified context from the kubeconfig"), Short: i18n.T("Delete the specified context from the kubeconfig"),
Long: "Delete the specified context from the kubeconfig", Long: "Delete the specified context from the kubeconfig",
Example: delete_context_example, Example: delete_context_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := runDeleteContext(out, errOut, configAccess, cmd) err := runDeleteContext(out, errOut, configAccess, cmd)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)

View File

@ -67,11 +67,11 @@ func NewCmdConfigGetContexts(streams genericclioptions.IOStreams, configAccess c
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "get-contexts [(-o|--output=)name)]", Use: "get-contexts [(-o|--output=)name)]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Describe one or many contexts"), Short: i18n.T("Describe one or many contexts"),
Long: getContextsLong, Long: getContextsLong,
Example: getContextsExample, Example: getContextsExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
validOutputTypes := sets.NewString("", "json", "yaml", "wide", "name", "custom-columns", "custom-columns-file", "go-template", "go-template-file", "jsonpath", "jsonpath-file") validOutputTypes := sets.NewString("", "json", "yaml", "wide", "name", "custom-columns", "custom-columns-file", "go-template", "go-template-file", "jsonpath", "jsonpath-file")
supportedOutputTypes := sets.NewString("", "name") supportedOutputTypes := sets.NewString("", "name")

View File

@ -61,11 +61,11 @@ func NewCmdConfigRenameContext(out io.Writer, configAccess clientcmd.ConfigAcces
options := &RenameContextOptions{configAccess: configAccess} options := &RenameContextOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: renameContextUse, Use: renameContextUse,
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: renameContextShort, Short: renameContextShort,
Long: renameContextLong, Long: renameContextLong,
Example: renameContextExample, Example: renameContextExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
if err := options.Complete(cmd, args, out); err != nil { if err := options.Complete(cmd, args, out); err != nil {
cmdutil.CheckErr(err) cmdutil.CheckErr(err)

View File

@ -51,10 +51,10 @@ func NewCmdConfigSet(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.
options := &setOptions{configAccess: configAccess} options := &setOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "set PROPERTY_NAME PROPERTY_VALUE", Use: "set PROPERTY_NAME PROPERTY_VALUE",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Sets an individual value in a kubeconfig file"), Short: i18n.T("Sets an individual value in a kubeconfig file"),
Long: set_long, Long: set_long,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.complete(cmd)) cmdutil.CheckErr(options.complete(cmd))
cmdutil.CheckErr(options.run()) cmdutil.CheckErr(options.run())

View File

@ -53,11 +53,11 @@ func NewCmdConfigUnset(out io.Writer, configAccess clientcmd.ConfigAccess) *cobr
options := &unsetOptions{configAccess: configAccess} options := &unsetOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "unset PROPERTY_NAME", Use: "unset PROPERTY_NAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Unsets an individual value in a kubeconfig file"), Short: i18n.T("Unsets an individual value in a kubeconfig file"),
Long: unsetLong, Long: unsetLong,
Example: unsetExample, Example: unsetExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.complete(cmd, args)) cmdutil.CheckErr(options.complete(cmd, args))
cmdutil.CheckErr(options.run(out)) cmdutil.CheckErr(options.run(out))

View File

@ -45,12 +45,12 @@ func NewCmdConfigUseContext(out io.Writer, configAccess clientcmd.ConfigAccess)
options := &useContextOptions{configAccess: configAccess} options := &useContextOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "use-context CONTEXT_NAME", Use: "use-context CONTEXT_NAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Sets the current-context in a kubeconfig file"), Short: i18n.T("Sets the current-context in a kubeconfig file"),
Aliases: []string{"use"}, Aliases: []string{"use"},
Long: `Sets the current-context in a kubeconfig file`, Long: `Sets the current-context in a kubeconfig file`,
Example: use_context_example, Example: use_context_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.complete(cmd)) cmdutil.CheckErr(options.complete(cmd))
cmdutil.CheckErr(options.run()) cmdutil.CheckErr(options.run())

View File

@ -89,11 +89,11 @@ func NewCmdConvert(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *co
o := NewConvertOptions(ioStreams) o := NewConvertOptions(ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "convert -f FILENAME", Use: "convert -f FILENAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Convert config files between different API versions"), Short: i18n.T("Convert config files between different API versions"),
Long: convert_long, Long: convert_long,
Example: convert_example, Example: convert_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd)) cmdutil.CheckErr(o.Complete(f, cmd))
cmdutil.CheckErr(o.RunConvert()) cmdutil.CheckErr(o.RunConvert())

View File

@ -86,11 +86,11 @@ func NewCmdCp(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.C
o := NewCopyOptions(ioStreams) o := NewCopyOptions(ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "cp <file-spec-src> <file-spec-dest>", Use: "cp <file-spec-src> <file-spec-dest>",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Copy files and directories to and from containers."), Short: i18n.T("Copy files and directories to and from containers."),
Long: "Copy files and directories to and from containers.", Long: "Copy files and directories to and from containers.",
Example: cpExample, Example: cpExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd)) cmdutil.CheckErr(o.Complete(f, cmd))
cmdutil.CheckErr(o.Run(args)) cmdutil.CheckErr(o.Run(args))

View File

@ -93,11 +93,11 @@ func NewCmdCreate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cob
o := NewCreateOptions(ioStreams) o := NewCreateOptions(ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "create -f FILENAME", Use: "create -f FILENAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create a resource from a file or from stdin."), Short: i18n.T("Create a resource from a file or from stdin."),
Long: createLong, Long: createLong,
Example: createExample, Example: createExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
if cmdutil.IsFilenameSliceEmpty(o.FilenameOptions.Filenames) { if cmdutil.IsFilenameSliceEmpty(o.FilenameOptions.Filenames) {
defaultRunFunc := cmdutil.DefaultSubCommandRun(ioStreams.ErrOut) defaultRunFunc := cmdutil.DefaultSubCommandRun(ioStreams.ErrOut)

View File

@ -71,11 +71,11 @@ func NewCmdCreateClusterRole(f cmdutil.Factory, ioStreams genericclioptions.IOSt
AggregationRule: map[string]string{}, AggregationRule: map[string]string{},
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run]", Use: "clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: clusterRoleLong, Short: clusterRoleLong,
Long: clusterRoleLong, Long: clusterRoleLong,
Example: clusterRoleExample, Example: clusterRoleExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(c.Complete(f, cmd, args)) cmdutil.CheckErr(c.Complete(f, cmd, args))
cmdutil.CheckErr(c.Validate()) cmdutil.CheckErr(c.Validate())

View File

@ -46,11 +46,11 @@ func NewCmdCreateClusterRoleBinding(f cmdutil.Factory, ioStreams genericclioptio
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]", Use: "clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create a ClusterRoleBinding for a particular ClusterRole"), Short: i18n.T("Create a ClusterRoleBinding for a particular ClusterRole"),
Long: clusterRoleBindingLong, Long: clusterRoleBindingLong,
Example: clusterRoleBindingExample, Example: clusterRoleBindingExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.Run()) cmdutil.CheckErr(options.Run())

View File

@ -67,7 +67,7 @@ func NewCmdCreateConfigMap(f cmdutil.Factory, ioStreams genericclioptions.IOStre
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]", Use: "configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Aliases: []string{"cm"}, Aliases: []string{"cm"},
Short: i18n.T("Create a configmap from a local file, directory or literal value"), Short: i18n.T("Create a configmap from a local file, directory or literal value"),

View File

@ -48,7 +48,7 @@ func NewCmdCreateDeployment(f cmdutil.Factory, ioStreams genericclioptions.IOStr
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "deployment NAME --image=image [--dry-run]", Use: "deployment NAME --image=image [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Aliases: []string{"deploy"}, Aliases: []string{"deploy"},
Short: i18n.T("Create a deployment with the specified name."), Short: i18n.T("Create a deployment with the specified name."),

View File

@ -46,7 +46,7 @@ func NewCmdCreateNamespace(f cmdutil.Factory, ioStreams genericclioptions.IOStre
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "namespace NAME [--dry-run]", Use: "namespace NAME [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Aliases: []string{"ns"}, Aliases: []string{"ns"},
Short: i18n.T("Create a namespace with the specified name"), Short: i18n.T("Create a namespace with the specified name"),

View File

@ -51,7 +51,7 @@ func NewCmdCreatePodDisruptionBudget(f cmdutil.Factory, ioStreams genericcliopti
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run]", Use: "poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Aliases: []string{"pdb"}, Aliases: []string{"pdb"},
Short: i18n.T("Create a pod disruption budget with the specified name."), Short: i18n.T("Create a pod disruption budget with the specified name."),

View File

@ -49,7 +49,7 @@ func NewCmdCreatePriorityClass(f cmdutil.Factory, ioStreams genericclioptions.IO
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run]", Use: "priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Aliases: []string{"pc"}, Aliases: []string{"pc"},
Short: i18n.T("Create a priorityclass with the specified name."), Short: i18n.T("Create a priorityclass with the specified name."),

View File

@ -49,7 +49,7 @@ func NewCmdCreateQuota(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=bool]", Use: "quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=bool]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Aliases: []string{"resourcequota"}, Aliases: []string{"resourcequota"},
Short: i18n.T("Create a quota with the specified name."), Short: i18n.T("Create a quota with the specified name."),

View File

@ -142,11 +142,11 @@ func NewCmdCreateRole(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
o := NewCreateRoleOptions(ioStreams) o := NewCreateRoleOptions(ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run]", Use: "role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: roleLong, Short: roleLong,
Long: roleLong, Long: roleLong,
Example: roleExample, Example: roleExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd, args)) cmdutil.CheckErr(o.Complete(f, cmd, args))
cmdutil.CheckErr(o.Validate()) cmdutil.CheckErr(o.Validate())

View File

@ -46,11 +46,11 @@ func NewCmdCreateRoleBinding(f cmdutil.Factory, ioStreams genericclioptions.IOSt
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]", Use: "rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create a RoleBinding for a particular Role or ClusterRole"), Short: i18n.T("Create a RoleBinding for a particular Role or ClusterRole"),
Long: roleBindingLong, Long: roleBindingLong,
Example: roleBindingExample, Example: roleBindingExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.Run()) cmdutil.CheckErr(options.Run())

View File

@ -83,11 +83,11 @@ func NewCmdCreateSecretGeneric(f cmdutil.Factory, ioStreams genericclioptions.IO
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]", Use: "generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create a secret from a local file, directory or literal value"), Short: i18n.T("Create a secret from a local file, directory or literal value"),
Long: secretLong, Long: secretLong,
Example: secretExample, Example: secretExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.Run()) cmdutil.CheckErr(options.Run())
@ -168,11 +168,11 @@ func NewCmdCreateSecretDockerRegistry(f cmdutil.Factory, ioStreams genericcliopt
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-literal=key1=value1] [--dry-run]", Use: "docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-literal=key1=value1] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create a secret for use with a Docker registry"), Short: i18n.T("Create a secret for use with a Docker registry"),
Long: secretForDockerRegistryLong, Long: secretForDockerRegistryLong,
Example: secretForDockerRegistryExample, Example: secretForDockerRegistryExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.Run()) cmdutil.CheckErr(options.Run())
@ -259,11 +259,11 @@ func NewCmdCreateSecretTLS(f cmdutil.Factory, ioStreams genericclioptions.IOStre
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run]", Use: "tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create a TLS secret"), Short: i18n.T("Create a TLS secret"),
Long: secretForTLSLong, Long: secretForTLSLong,
Example: secretForTLSExample, Example: secretForTLSExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.Run()) cmdutil.CheckErr(options.Run())

View File

@ -71,11 +71,11 @@ func NewCmdCreateServiceClusterIP(f cmdutil.Factory, ioStreams genericclioptions
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run]", Use: "clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create a ClusterIP service."), Short: i18n.T("Create a ClusterIP service."),
Long: serviceClusterIPLong, Long: serviceClusterIPLong,
Example: serviceClusterIPExample, Example: serviceClusterIPExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.Run()) cmdutil.CheckErr(options.Run())
@ -143,11 +143,11 @@ func NewCmdCreateServiceNodePort(f cmdutil.Factory, ioStreams genericclioptions.
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "nodeport NAME [--tcp=port:targetPort] [--dry-run]", Use: "nodeport NAME [--tcp=port:targetPort] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create a NodePort service."), Short: i18n.T("Create a NodePort service."),
Long: serviceNodePortLong, Long: serviceNodePortLong,
Example: serviceNodePortExample, Example: serviceNodePortExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.Run()) cmdutil.CheckErr(options.Run())
@ -212,11 +212,11 @@ func NewCmdCreateServiceLoadBalancer(f cmdutil.Factory, ioStreams genericcliopti
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "loadbalancer NAME [--tcp=port:targetPort] [--dry-run]", Use: "loadbalancer NAME [--tcp=port:targetPort] [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create a LoadBalancer service."), Short: i18n.T("Create a LoadBalancer service."),
Long: serviceLoadBalancerLong, Long: serviceLoadBalancerLong,
Example: serviceLoadBalancerExample, Example: serviceLoadBalancerExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.Run()) cmdutil.CheckErr(options.Run())
@ -283,11 +283,11 @@ func NewCmdCreateServiceExternalName(f cmdutil.Factory, ioStreams genericcliopti
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "externalname NAME --external-name external.name [--dry-run]", Use: "externalname NAME --external-name external.name [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Create an ExternalName service."), Short: i18n.T("Create an ExternalName service."),
Long: serviceExternalNameLong, Long: serviceExternalNameLong,
Example: serviceExternalNameExample, Example: serviceExternalNameExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.Run()) cmdutil.CheckErr(options.Run())

View File

@ -46,7 +46,7 @@ func NewCmdCreateServiceAccount(f cmdutil.Factory, ioStreams genericclioptions.I
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "serviceaccount NAME [--dry-run]", Use: "serviceaccount NAME [--dry-run]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Aliases: []string{"sa"}, Aliases: []string{"sa"},
Short: i18n.T("Create a service account with the specified name"), Short: i18n.T("Create a service account with the specified name"),

View File

@ -118,11 +118,11 @@ func NewCmdDelete(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra
deleteFlags := NewDeleteCommandFlags("containing the resource to delete.") deleteFlags := NewDeleteCommandFlags("containing the resource to delete.")
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])", Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Delete resources by filenames, stdin, resources and names, or by resources and label selector"), Short: i18n.T("Delete resources by filenames, stdin, resources and names, or by resources and label selector"),
Long: delete_long, Long: delete_long,
Example: delete_example, Example: delete_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
o := deleteFlags.ToOptions(nil, streams) o := deleteFlags.ToOptions(nil, streams)
cmdutil.CheckErr(o.Complete(f, args, cmd)) cmdutil.CheckErr(o.Complete(f, args, cmd))

View File

@ -40,9 +40,9 @@ var unstructuredSerializer = resource.UnstructuredPlusDefaultContentConfig().Neg
func fakecmd() *cobra.Command { func fakecmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])", Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Run: func(cmd *cobra.Command, args []string) {}, Run: func(cmd *cobra.Command, args []string) {},
} }
return cmd return cmd
} }

View File

@ -101,11 +101,11 @@ func NewCmdDescribe(parent string, f cmdutil.Factory, streams genericclioptions.
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)", Use: "describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Show details of a specific resource or group of resources"), Short: i18n.T("Show details of a specific resource or group of resources"),
Long: describeLong + "\n\n" + cmdutil.SuggestApiResources(parent), Long: describeLong + "\n\n" + cmdutil.SuggestApiResources(parent),
Example: describeExample, Example: describeExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd, args)) cmdutil.CheckErr(o.Complete(f, cmd, args))
cmdutil.CheckErr(o.Run()) cmdutil.CheckErr(o.Run())

View File

@ -78,11 +78,11 @@ func NewCmdDiff(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
IOStreams: streams, IOStreams: streams,
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "diff -f FILENAME", Use: "diff -f FILENAME",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Diff live version against would-be applied version"), Short: i18n.T("Diff live version against would-be applied version"),
Long: diffLong, Long: diffLong,
Example: diffExample, Example: diffExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(checkDiffArgs(cmd, args)) cmdutil.CheckErr(checkDiffArgs(cmd, args))
cmdutil.CheckErr(RunDiff(f, &diff, &options)) cmdutil.CheckErr(RunDiff(f, &diff, &options))

View File

@ -109,11 +109,11 @@ func NewCmdCordon(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cob
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "cordon NODE", Use: "cordon NODE",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Mark node as unschedulable"), Short: i18n.T("Mark node as unschedulable"),
Long: cordon_long, Long: cordon_long,
Example: cordon_example, Example: cordon_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.RunCordonOrUncordon(true)) cmdutil.CheckErr(options.RunCordonOrUncordon(true))
@ -140,11 +140,11 @@ func NewCmdUncordon(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *c
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "uncordon NODE", Use: "uncordon NODE",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Mark node as schedulable"), Short: i18n.T("Mark node as schedulable"),
Long: uncordon_long, Long: uncordon_long,
Example: uncordon_example, Example: uncordon_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.RunCordonOrUncordon(false)) cmdutil.CheckErr(options.RunCordonOrUncordon(false))
@ -202,11 +202,11 @@ func NewCmdDrain(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobr
options := NewDrainOptions(f, ioStreams) options := NewDrainOptions(f, ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "drain NODE", Use: "drain NODE",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Drain node in preparation for maintenance"), Short: i18n.T("Drain node in preparation for maintenance"),
Long: drain_long, Long: drain_long,
Example: drain_example, Example: drain_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(options.Complete(f, cmd, args)) cmdutil.CheckErr(options.Complete(f, cmd, args))
cmdutil.CheckErr(options.RunDrain()) cmdutil.CheckErr(options.RunDrain())

View File

@ -72,11 +72,11 @@ func NewCmdEdit(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra
o.ValidateOptions = cmdutil.ValidateOptions{EnableValidation: true} o.ValidateOptions = cmdutil.ValidateOptions{EnableValidation: true}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "edit (RESOURCE/NAME | -f FILENAME)", Use: "edit (RESOURCE/NAME | -f FILENAME)",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Edit a resource on the server"), Short: i18n.T("Edit a resource on the server"),
Long: editLong, Long: editLong,
Example: fmt.Sprintf(editExample), Example: fmt.Sprintf(editExample),
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
if err := o.Complete(f, args, cmd); err != nil { if err := o.Complete(f, args, cmd); err != nil {
cmdutil.CheckErr(err) cmdutil.CheckErr(err)

View File

@ -72,11 +72,11 @@ func NewCmdExec(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
Executor: &DefaultRemoteExecutor{}, Executor: &DefaultRemoteExecutor{},
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "exec POD [-c CONTAINER] -- COMMAND [args...]", Use: "exec POD [-c CONTAINER] -- COMMAND [args...]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Execute a command in a container"), Short: i18n.T("Execute a command in a container"),
Long: "Execute a command in a container.", Long: "Execute a command in a container.",
Example: exec_example, Example: exec_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
argsLenAtDash := cmd.ArgsLenAtDash() argsLenAtDash := cmd.ArgsLenAtDash()
cmdutil.CheckErr(options.Complete(f, cmd, args, argsLenAtDash)) cmdutil.CheckErr(options.Complete(f, cmd, args, argsLenAtDash))

View File

@ -74,11 +74,11 @@ func NewCmdExplain(parent string, f cmdutil.Factory, streams genericclioptions.I
o := NewExplainOptions(parent, streams) o := NewExplainOptions(parent, streams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "explain RESOURCE", Use: "explain RESOURCE",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Documentation of resources"), Short: i18n.T("Documentation of resources"),
Long: explainLong + "\n\n" + cmdutil.SuggestApiResources(parent), Long: explainLong + "\n\n" + cmdutil.SuggestApiResources(parent),
Example: explainExamples, Example: explainExamples,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd)) cmdutil.CheckErr(o.Complete(f, cmd))
cmdutil.CheckErr(o.Validate(args)) cmdutil.CheckErr(o.Validate(args))

View File

@ -126,11 +126,11 @@ func NewCmdExposeService(f cmdutil.Factory, streams genericclioptions.IOStreams)
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]", Use: "expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service"), Short: i18n.T("Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service"),
Long: exposeLong, Long: exposeLong,
Example: exposeExample, Example: exposeExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd)) cmdutil.CheckErr(o.Complete(f, cmd))
cmdutil.CheckErr(o.RunExpose(cmd, args)) cmdutil.CheckErr(o.RunExpose(cmd, args))

View File

@ -150,11 +150,11 @@ func NewCmdGet(parent string, f cmdutil.Factory, streams genericclioptions.IOStr
o := NewGetOptions(parent, streams) o := NewGetOptions(parent, streams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "get [(-o|--output=)json|yaml|wide|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]", Use: "get [(-o|--output=)json|yaml|wide|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Display one or many resources"), Short: i18n.T("Display one or many resources"),
Long: getLong + "\n\n" + cmdutil.SuggestApiResources(parent), Long: getLong + "\n\n" + cmdutil.SuggestApiResources(parent),
Example: getExample, Example: getExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd, args)) cmdutil.CheckErr(o.Complete(f, cmd, args))
cmdutil.CheckErr(o.Validate(cmd)) cmdutil.CheckErr(o.Validate(cmd))

View File

@ -31,10 +31,10 @@ var helpLong = templates.LongDesc(i18n.T(`
func NewCmdHelp() *cobra.Command { func NewCmdHelp() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "help [command] | STRING_TO_SEARCH", Use: "help [command] | STRING_TO_SEARCH",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Help about any command"), Short: i18n.T("Help about any command"),
Long: helpLong, Long: helpLong,
Run: RunHelp, Run: RunHelp,
} }

View File

@ -125,11 +125,11 @@ func NewCmdLabel(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobr
o := NewLabelOptions(ioStreams) o := NewLabelOptions(ioStreams)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]", Use: "label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]",
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Update the labels on a resource"), Short: i18n.T("Update the labels on a resource"),
Long: fmt.Sprintf(labelLong, validation.LabelValueMaxLength), Long: fmt.Sprintf(labelLong, validation.LabelValueMaxLength),
Example: labelExample, Example: labelExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd, args)) cmdutil.CheckErr(o.Complete(f, cmd, args))
cmdutil.CheckErr(o.Validate()) cmdutil.CheckErr(o.Validate())

Some files were not shown because too many files have changed in this diff Show More