diff --git a/docs/book/pages/imperative_porcelain/creating_resources.md b/docs/book/pages/imperative_porcelain/creating_resources.md index 36bf7d59..637286a3 100644 --- a/docs/book/pages/imperative_porcelain/creating_resources.md +++ b/docs/book/pages/imperative_porcelain/creating_resources.md @@ -83,8 +83,8 @@ kubectl create secret generic my-secret --from-file=path/to/bar {% endmethod %} {% panel style="success", title="Bootstrapping Config" %} -Imperative commands can be used to bootstrap config by using `--dry-run -o yaml`. -`kubectl create secret generic my-secret --from-file=path/to/bar --dry-run -o yaml` +Imperative commands can be used to bootstrap config by using `--dry-run=client -o yaml`. +`kubectl create secret generic my-secret --from-file=path/to/bar --dry-run=client -o yaml` {% endpanel %} {% method %} diff --git a/docs/book/pages/imperative_porcelain/introduction.md b/docs/book/pages/imperative_porcelain/introduction.md index a8da7468..a5e63576 100644 --- a/docs/book/pages/imperative_porcelain/introduction.md +++ b/docs/book/pages/imperative_porcelain/introduction.md @@ -9,7 +9,7 @@ use cases, imperative porcelain commands may be helpful for development or debug issues. These commands are particularly helpful for learning about Kubernetes when coming from an imperative system. -**Note:** Some imperative commands can be run with `--dry-run -o yaml` to display the declarative +**Note:** Some imperative commands can be run with `--dry-run=client -o yaml` to display the declarative form. This section describes imperative commands that will generate or patch Resource Config. diff --git a/docs/book/pages/kubectl_book/getting_started.md b/docs/book/pages/kubectl_book/getting_started.md index 2ad3505c..51c5fad5 100644 --- a/docs/book/pages/kubectl_book/getting_started.md +++ b/docs/book/pages/kubectl_book/getting_started.md @@ -29,7 +29,7 @@ List the Kubernetes *Deployment* Resources that are in the kube-system namespace ```bash kubectl get deployments --namespace kube-system ``` - + ```bash NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE event-exporter-v0.2.3 1 1 1 1 14d @@ -51,7 +51,7 @@ Print detailed information about the kube-dns Deployment in the kube-system name ```bash kubectl describe deployment kube-dns --namespace kube-system ``` - + ```bash Name: kube-dns Namespace: kube-system @@ -126,7 +126,7 @@ due to the serialization process of go objects. {% sample lang="yaml" %} ```bash -kubectl create deployment nginx --dry-run -o yaml --image nginx +kubectl create deployment nginx --dry-run=client -o yaml --image nginx ``` ```yaml diff --git a/pkg/cmd/create/create_clusterrole.go b/pkg/cmd/create/create_clusterrole.go index 06111b85..a884b27b 100644 --- a/pkg/cmd/create/create_clusterrole.go +++ b/pkg/cmd/create/create_clusterrole.go @@ -73,7 +73,7 @@ func NewCmdCreateClusterRole(f cmdutil.Factory, ioStreams genericclioptions.IOSt AggregationRule: map[string]string{}, } 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=server|client|none]", DisableFlagsInUseLine: true, Short: clusterRoleLong, Long: clusterRoleLong, diff --git a/pkg/cmd/create/create_clusterrolebinding.go b/pkg/cmd/create/create_clusterrolebinding.go index 452bdde7..544b091d 100644 --- a/pkg/cmd/create/create_clusterrolebinding.go +++ b/pkg/cmd/create/create_clusterrolebinding.go @@ -48,7 +48,7 @@ func NewCmdCreateClusterRoleBinding(f cmdutil.Factory, ioStreams genericclioptio } 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=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Create a ClusterRoleBinding for a particular ClusterRole"), Long: clusterRoleBindingLong, diff --git a/pkg/cmd/create/create_configmap.go b/pkg/cmd/create/create_configmap.go index dde0a89c..ebb669f6 100644 --- a/pkg/cmd/create/create_configmap.go +++ b/pkg/cmd/create/create_configmap.go @@ -69,7 +69,7 @@ func NewCmdCreateConfigMap(f cmdutil.Factory, ioStreams genericclioptions.IOStre } 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=server|client|none]", DisableFlagsInUseLine: true, Aliases: []string{"cm"}, Short: i18n.T("Create a configmap from a local file, directory or literal value"), diff --git a/pkg/cmd/create/create_deployment.go b/pkg/cmd/create/create_deployment.go index 0fb36a6e..1718d75d 100644 --- a/pkg/cmd/create/create_deployment.go +++ b/pkg/cmd/create/create_deployment.go @@ -50,7 +50,7 @@ func NewCmdCreateDeployment(f cmdutil.Factory, ioStreams genericclioptions.IOStr } cmd := &cobra.Command{ - Use: "deployment NAME --image=image [--dry-run]", + Use: "deployment NAME --image=image [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Aliases: []string{"deploy"}, Short: i18n.T("Create a deployment with the specified name."), diff --git a/pkg/cmd/create/create_namespace.go b/pkg/cmd/create/create_namespace.go index f8c63991..7e89c6f9 100644 --- a/pkg/cmd/create/create_namespace.go +++ b/pkg/cmd/create/create_namespace.go @@ -48,7 +48,7 @@ func NewCmdCreateNamespace(f cmdutil.Factory, ioStreams genericclioptions.IOStre } cmd := &cobra.Command{ - Use: "namespace NAME [--dry-run]", + Use: "namespace NAME [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Aliases: []string{"ns"}, Short: i18n.T("Create a namespace with the specified name"), diff --git a/pkg/cmd/create/create_pdb.go b/pkg/cmd/create/create_pdb.go index fd321bff..033a7881 100644 --- a/pkg/cmd/create/create_pdb.go +++ b/pkg/cmd/create/create_pdb.go @@ -53,7 +53,7 @@ func NewCmdCreatePodDisruptionBudget(f cmdutil.Factory, ioStreams genericcliopti } cmd := &cobra.Command{ - Use: "poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run]", + Use: "poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Aliases: []string{"pdb"}, Short: i18n.T("Create a pod disruption budget with the specified name."), diff --git a/pkg/cmd/create/create_priorityclass.go b/pkg/cmd/create/create_priorityclass.go index c50d343d..bbc5f800 100644 --- a/pkg/cmd/create/create_priorityclass.go +++ b/pkg/cmd/create/create_priorityclass.go @@ -38,7 +38,7 @@ var ( # Create a priorityclass named default-priority that considered as the global default priority kubectl create priorityclass default-priority --value=1000 --global-default=true --description="default priority" - + # Create a priorityclass named high-priority that can not preempt pods with lower priority kubectl create priorityclass high-priority --value=1000 --description="high priority" --preemption-policy="Never"`)) ) @@ -55,7 +55,7 @@ func NewCmdCreatePriorityClass(f cmdutil.Factory, ioStreams genericclioptions.IO } cmd := &cobra.Command{ - Use: "priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run]", + Use: "priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Aliases: []string{"pc"}, Short: i18n.T("Create a priorityclass with the specified name."), diff --git a/pkg/cmd/create/create_quota.go b/pkg/cmd/create/create_quota.go index 586d1be8..41741988 100644 --- a/pkg/cmd/create/create_quota.go +++ b/pkg/cmd/create/create_quota.go @@ -51,7 +51,7 @@ func NewCmdCreateQuota(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) } 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=server|client|none]", DisableFlagsInUseLine: true, Aliases: []string{"resourcequota"}, Short: i18n.T("Create a quota with the specified name."), diff --git a/pkg/cmd/create/create_role.go b/pkg/cmd/create/create_role.go index 0771b106..7db2de24 100644 --- a/pkg/cmd/create/create_role.go +++ b/pkg/cmd/create/create_role.go @@ -152,7 +152,7 @@ func NewCmdCreateRole(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) o := NewCreateRoleOptions(ioStreams) 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=server|client|none]", DisableFlagsInUseLine: true, Short: roleLong, Long: roleLong, diff --git a/pkg/cmd/create/create_rolebinding.go b/pkg/cmd/create/create_rolebinding.go index cae2b2c8..f37bcdf1 100644 --- a/pkg/cmd/create/create_rolebinding.go +++ b/pkg/cmd/create/create_rolebinding.go @@ -48,7 +48,7 @@ func NewCmdCreateRoleBinding(f cmdutil.Factory, ioStreams genericclioptions.IOSt } 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=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Create a RoleBinding for a particular Role or ClusterRole"), Long: roleBindingLong, diff --git a/pkg/cmd/create/create_secret.go b/pkg/cmd/create/create_secret.go index 102a6310..932ec211 100644 --- a/pkg/cmd/create/create_secret.go +++ b/pkg/cmd/create/create_secret.go @@ -85,7 +85,7 @@ func NewCmdCreateSecretGeneric(f cmdutil.Factory, ioStreams genericclioptions.IO } 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=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Create a secret from a local file, directory or literal value"), Long: secretLong, @@ -172,7 +172,7 @@ func NewCmdCreateSecretDockerRegistry(f cmdutil.Factory, ioStreams genericcliopt } 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=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Create a secret for use with a Docker registry"), Long: secretForDockerRegistryLong, @@ -265,7 +265,7 @@ func NewCmdCreateSecretTLS(f cmdutil.Factory, ioStreams genericclioptions.IOStre } 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=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Create a TLS secret"), Long: secretForTLSLong, diff --git a/pkg/cmd/create/create_service.go b/pkg/cmd/create/create_service.go index c1267e00..54bd2248 100644 --- a/pkg/cmd/create/create_service.go +++ b/pkg/cmd/create/create_service.go @@ -73,7 +73,7 @@ func NewCmdCreateServiceClusterIP(f cmdutil.Factory, ioStreams genericclioptions } cmd := &cobra.Command{ - Use: "clusterip NAME [--tcp=:] [--dry-run]", + Use: "clusterip NAME [--tcp=:] [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Create a ClusterIP service."), Long: serviceClusterIPLong, @@ -147,7 +147,7 @@ func NewCmdCreateServiceNodePort(f cmdutil.Factory, ioStreams genericclioptions. } cmd := &cobra.Command{ - Use: "nodeport NAME [--tcp=port:targetPort] [--dry-run]", + Use: "nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Create a NodePort service."), Long: serviceNodePortLong, @@ -218,7 +218,7 @@ func NewCmdCreateServiceLoadBalancer(f cmdutil.Factory, ioStreams genericcliopti } cmd := &cobra.Command{ - Use: "loadbalancer NAME [--tcp=port:targetPort] [--dry-run]", + Use: "loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Create a LoadBalancer service."), Long: serviceLoadBalancerLong, @@ -291,7 +291,7 @@ func NewCmdCreateServiceExternalName(f cmdutil.Factory, ioStreams genericcliopti } cmd := &cobra.Command{ - Use: "externalname NAME --external-name external.name [--dry-run]", + Use: "externalname NAME --external-name external.name [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Create an ExternalName service."), Long: serviceExternalNameLong, diff --git a/pkg/cmd/create/create_serviceaccount.go b/pkg/cmd/create/create_serviceaccount.go index 7dd2746a..1963b24e 100644 --- a/pkg/cmd/create/create_serviceaccount.go +++ b/pkg/cmd/create/create_serviceaccount.go @@ -48,7 +48,7 @@ func NewCmdCreateServiceAccount(f cmdutil.Factory, ioStreams genericclioptions.I } cmd := &cobra.Command{ - Use: "serviceaccount NAME [--dry-run]", + Use: "serviceaccount NAME [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Aliases: []string{"sa"}, Short: i18n.T("Create a service account with the specified name"), diff --git a/pkg/cmd/rollout/rollout_undo.go b/pkg/cmd/rollout/rollout_undo.go index 6b42a69a..9eac94a2 100644 --- a/pkg/cmd/rollout/rollout_undo.go +++ b/pkg/cmd/rollout/rollout_undo.go @@ -62,7 +62,7 @@ var ( kubectl rollout undo daemonset/abc --to-revision=3 # Rollback to the previous deployment with dry-run - kubectl rollout undo --dry-run=true deployment/abc`) + kubectl rollout undo --dry-run=server deployment/abc`) ) // NewRolloutUndoOptions returns an initialized UndoOptions instance diff --git a/pkg/cmd/run/run.go b/pkg/cmd/run/run.go index b7a49a4c..6a7309bd 100644 --- a/pkg/cmd/run/run.go +++ b/pkg/cmd/run/run.go @@ -299,7 +299,7 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e } if o.Attach && o.DryRunStrategy != cmdutil.DryRunNone { - return cmdutil.UsageErrorf(cmd, "--dry-run can't be used with attached containers options (--attach, --stdin, or --tty)") + return cmdutil.UsageErrorf(cmd, "--dry-run=[server|client] can't be used with attached containers options (--attach, --stdin, or --tty)") } if err := verifyImagePullPolicy(cmd); err != nil { diff --git a/pkg/cmd/set/set_selector.go b/pkg/cmd/set/set_selector.go index 94617421..2abe2d7d 100644 --- a/pkg/cmd/set/set_selector.go +++ b/pkg/cmd/set/set_selector.go @@ -72,8 +72,8 @@ var ( Note: currently selectors can only be set on Service objects.`) selectorExample = templates.Examples(` # set the labels and selector before creating a deployment/service pair. - kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f - - kubectl create deployment my-dep -o yaml --dry-run | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -`) + kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f - + kubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -`) ) // NewSelectorOptions returns an initialized SelectorOptions instance diff --git a/pkg/cmd/set/set_subject.go b/pkg/cmd/set/set_subject.go index e5d11cf4..488a9ea2 100644 --- a/pkg/cmd/set/set_subject.go +++ b/pkg/cmd/set/set_subject.go @@ -48,7 +48,7 @@ var ( kubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1 # Print the result (in yaml format) of updating rolebinding subjects from a local, without hitting the server - kubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run | kubectl set subject --local -f - --user=foo -o yaml`) + kubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml`) ) type updateSubjects func(existings []rbacv1.Subject, targets []rbacv1.Subject) (bool, []rbacv1.Subject) @@ -93,7 +93,7 @@ func NewSubjectOptions(streams genericclioptions.IOStreams) *SubjectOptions { func NewCmdSubject(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { o := NewSubjectOptions(streams) cmd := &cobra.Command{ - Use: "subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]", + Use: "subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]", DisableFlagsInUseLine: true, Short: i18n.T("Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding"), Long: subjectLong,