feat: add docs generation for kruise (#98)

* feat: add docs generation for kruise

Signed-off-by: maanugh <manusin46@gmail.com>

* remove unnecessary sub commands docs

Signed-off-by: maanugh <manusin46@gmail.com>

---------

Signed-off-by: maanugh <manusin46@gmail.com>
This commit is contained in:
Kiraat 2024-09-19 05:55:59 -04:00 committed by GitHub
parent 5cee01a250
commit cfd9de24fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
50 changed files with 4547 additions and 2 deletions

52
docs/kubectl-kruise.md Normal file
View File

@ -0,0 +1,52 @@
## kubectl-kruise
kubectl-kruise controls the OpenKruise CRs
### Synopsis
kubectl-kruise controls the OpenKruise manager.
Find more information at: https://openkruise.io/
```
kubectl-kruise [flags]
```
### Options
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
-h, --help help for kubectl-kruise
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise create](kubectl-kruise_create.md) - Create a resource from a file or from stdin.
* [kubectl-kruise expose](kubectl-kruise_expose.md) - Take a workload(e.g. deployment, cloneset), service or pod and expose it as a new Kubernetes Service
* [kubectl-kruise migrate](kubectl-kruise_migrate.md) - Migrate from K8s original workloads to Kruise workloads
* [kubectl-kruise rollout](kubectl-kruise_rollout.md) - Manage the rollout of a resource
* [kubectl-kruise scaledown](kubectl-kruise_scaledown.md) - Scaledown a cloneset with selective Pods
* [kubectl-kruise set](kubectl-kruise_set.md) - Set specific features on objects

View File

@ -0,0 +1,86 @@
## kubectl-kruise create
Create a resource from a file or from stdin.
### Synopsis
Create a resource from a file or from stdin.
JSON and YAML formats are accepted.
```
kubectl-kruise create -f FILENAME
```
### Examples
```
# Create a pod using the data in pod.json.
kubectl create -f ./pod.json
# Create a pod based on the JSON passed into stdin.
cat pod.json | kubectl create -f -
# Edit the data in docker-registry.yaml in JSON then create the resource using the edited data.
kubectl create -f docker-registry.yaml --edit -o json
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
--edit Edit the API resource before creating
--field-manager string Name of the manager used to track field ownership. (default "kubectl-create")
-f, --filename strings Filename, directory, or URL to files to use to create the resource
-h, --help help for create
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
--raw string Raw URI to POST to the server. Uses the transport specified by the kubeconfig file.
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--save-config If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
-l, --selector string Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--validate string Must be one of: strict (or true), warn, ignore (or false).
"true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not.
"warn" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as "ignore" otherwise.
"false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields. (default "strict")
--windows-line-endings Only relevant if --edit=true. Defaults to the line ending native to your platform.
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise](kubectl-kruise.md) - kubectl-kruise controls the OpenKruise CRs
* [kubectl-kruise create ContainerRecreateRequest](kubectl-kruise_create_ContainerRecreateRequest.md) - Create a crr with the specified name.
* [kubectl-kruise create broadcastJob](kubectl-kruise_create_broadcastJob.md) - Create a broadcastJob with the specified name.
* [kubectl-kruise create job](kubectl-kruise_create_job.md) - Create a job with the specified name.

View File

@ -0,0 +1,85 @@
## kubectl-kruise create ContainerRecreateRequest
Create a crr with the specified name.
### Synopsis
Create a crr with the specified name.
```
kubectl-kruise create ContainerRecreateRequest NAME --pod=podName [--containers=container]
```
### Examples
```
NOTE: The default value of CRR is:
strategy:
failurePolicy: Fail
orderedRecreate: false
unreadyGracePeriodSeconds: 3
activeDeadlineSeconds: 300
ttlSecondsAfterFinished: 1800
# Create a crr with default value to restart all containers in pod-1
kubectl kruise create ContainerRecreateRequest my-crr --namespace=ns --pod=pod-1
# Create a crr with default value to restart container-1 in pod-1
kubectl kruise create ContainerRecreateRequest my-crr --namespace=ns --pod=pod-1 --containers=container-1
# Create a crr with unreadyGracePeriodSeconds 5 and terminationGracePeriodSeconds 30 to restart container-1 in pod-1
kubectl kruise create ContainerRecreateRequest my-crr --namespace=ns --pod=pod-1 --containers=container-1 --unreadyGracePeriodSeconds=5 --terminationGracePeriodSeconds=30
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--containers strings The containers those need to restarted.
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
--field-manager string Name of the manager used to track field ownership. (default "kubectl kruise-create")
-h, --help help for ContainerRecreateRequest
-m, --minStartedSeconds int32 Minimum number of seconds for which a newly created container should be started and ready without any of its container crashing, for it to be considered Succeeded.Defaults to 0 (container will be considered Succeeded as soon as it is started and ready)
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-p, --pod string The name of the pod).
--save-config If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
-u, --unreadyGracePeriodSeconds int UnreadyGracePeriodSeconds is the optional duration in seconds to mark Pod as not ready over this duration before executing preStop hook and stopping the container
--validate string Must be one of: strict (or true), warn, ignore (or false).
"true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not.
"warn" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as "ignore" otherwise.
"false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields. (default "strict")
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise create](kubectl-kruise_create.md) - Create a resource from a file or from stdin.

View File

@ -0,0 +1,76 @@
## kubectl-kruise create broadcastJob
Create a broadcastJob with the specified name.
### Synopsis
Create a broadcastJob with the specified name.
```
kubectl-kruise create broadcastJob NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]
```
### Examples
```
# Create a broadcastJob
kubectl kruise create broadcastJob my-bcj --image=busybox
# Create a broadcastJob with command
kubectl kruise create broadcastJob my-bcj --image=busybox -- date
# Create a broadcastJob from a AdvancedCronJob named "a-advancedCronjob"
kubectl kruise create broadcastJob test-bcj --from=acj/a-advancedCronjob
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
--field-manager string Name of the manager used to track field ownership. (default "kubectl kruise-create")
--from string The name of the resource to create a BroadcastJob from (only advancedCronjob is supported).
-h, --help help for broadcastJob
--image string Image name to run.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
--save-config If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--validate string Must be one of: strict (or true), warn, ignore (or false).
"true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not.
"warn" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as "ignore" otherwise.
"false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields. (default "strict")
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise create](kubectl-kruise_create.md) - Create a resource from a file or from stdin.

View File

@ -0,0 +1,76 @@
## kubectl-kruise create job
Create a job with the specified name.
### Synopsis
Create a job with the specified name.
```
kubectl-kruise create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]
```
### Examples
```
# Create a job
kubectl kruise create job my-job --image=busybox
# Create a job with command
kubectl kruise create job my-job --image=busybox -- date
# Create a job from a AdvancedCronJob named "a-advancedCronjob"
kubectl kruise create job test-job --from=acj/a-advancedCronjob
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
--field-manager string Name of the manager used to track field ownership. (default "kubectl kruise-create")
--from string The name of the resource to create a Job from (cronjob and advancedCronjob are supported).
-h, --help help for job
--image string Image name to run.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
--save-config If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--validate string Must be one of: strict (or true), warn, ignore (or false).
"true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not.
"warn" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as "ignore" otherwise.
"false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields. (default "strict")
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise create](kubectl-kruise_create.md) - Create a resource from a file or from stdin.

View File

@ -0,0 +1,107 @@
## kubectl-kruise expose
Take a workload(e.g. deployment, cloneset), service or pod and expose it as a new Kubernetes Service
### Synopsis
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A deployment or replica set will be exposed as a service only if its selector is convertible to a selector that service supports, i.e. when the selector contains only the matchLabels component. Note that if no port is specified via --port and the exposed resource has multiple ports, all will be re-used by the new service. Also if no labels are specified, the new service will re-use the labels from the resource it exposes.
Possible resources include (case insensitive):
pod (po), service (svc), replicationcontroller (rc), cloneset (clone), deployment (deploy), replicaset (rs)
```
kubectl-kruise 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]
```
### Examples
```
# Create a service for an nginx cloneset, which serves on port 80 and connects to the containers on port 8000.
kubectl kruise expose cloneset nginx --port=80 --target-port=8000
# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
kubectl expose rc nginx --port=80 --target-port=8000
# Create a service for a replication controller identified by type and name specified in "nginx-controller.yaml", which serves on port 80 and connects to the containers on port 8000.
kubectl expose -f nginx-controller.yaml --port=80 --target-port=8000
# Create a service for a pod valid-pod, which serves on port 444 with the name "frontend"
kubectl expose pod valid-pod --port=444 --name=frontend
# Create a second service based on the above service, exposing the container port 8443 as port 443 with the name "nginx-https"
kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https
# Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
kubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream
# Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000.
kubectl expose rs nginx --port=80 --target-port=8000
# Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000.
kubectl expose deployment nginx --port=80 --target-port=8000
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--cluster-ip string ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service.
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
--external-ip string Additional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP.
--field-manager string Name of the manager used to track field ownership. (default "kubectl-expose")
-f, --filename strings Filename, directory, or URL to files identifying the resource to expose a service
--generator string The name of the API generator to use. There are 2 generators: 'service/v1' and 'service/v2'. The only difference between them is that service port in v1 is named 'default', while it is left unnamed in v2. Default is 'service/v2'. (default "service/v2")
-h, --help help for expose
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
-l, --labels string Labels to apply to the service created by this call.
--load-balancer-ip string IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and used (cloud-provider specific).
--name string The name for the newly created object.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
--overrides string An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.
--port string The port that the service should serve on. Copied from the resource being exposed, if unspecified
--protocol string The network protocol for the service to be created. Default is 'TCP'.
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--save-config If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
--selector string A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set.)
--session-affinity string If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP'
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--target-port string Name or number for the port on the container that the service should direct traffic to. Optional.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--type string Type for this service: ClusterIP, NodePort, LoadBalancer, or ExternalName. Default is 'ClusterIP'.
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise](kubectl-kruise.md) - kubectl-kruise controls the OpenKruise CRs

View File

@ -0,0 +1,73 @@
## kubectl-kruise migrate
Migrate from K8s original workloads to Kruise workloads
### Synopsis
Migrate from K8s original workloads to Kruise workloads
```
kubectl-kruise migrate [DST_KIND] --from [SRC_KIND] [flags]
```
### Examples
```
# Create an empty CloneSet from an existing Deployment.
kubectl-kruise migrate CloneSet --from Deployment -n default --dst-name deployment-name --create
# Create a same replicas CloneSet from an existing Deployment.
kubectl-kruise migrate CloneSet --from Deployment -n default --dst-name deployment-name --create --copy
# Migrate replicas from an existing Deployment to an existing CloneSet.
kubectl-kruise migrate CloneSet --from Deployment -n default --src-name cloneset-name --dst-name deployment-name --replicas 10 --max-surge=2
```
### Options
```
--copy Copy replicas from src workload when create.
--create Create dst workload with replicas=0 from src workload.
--dst-name string Name of the destination workload.
--from string Type of the source workload (e.g. Deployment).
-h, --help help for migrate
--max-surge int32 Max surge during migration. (default 1)
--replicas int32 The replicas needs to migrate, -1 indicates all replicas in src workload. (default -1)
--src-name string Name of the source workload.
--timeout-seconds int32 Timeout seconds for migration, -1 indicates no limited. (default -1)
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise](kubectl-kruise.md) - kubectl-kruise controls the OpenKruise CRs

View File

@ -0,0 +1,77 @@
## kubectl-kruise rollout
Manage the rollout of a resource
### Synopsis
Manage the rollout of a resource.
Valid resource types include:
* deployments
* daemonsets
* statefulsets
* clonesets
* statefulsets.apps.kruise.io
* daemonsets.apps.kruise.io
* rollouts.rollouts.kruise.io
```
kubectl-kruise rollout SUBCOMMAND
```
### Examples
```
# Rollback to the previous cloneset
kubectl-kruise rollout undo cloneset/abc
# Check the rollout status of a daemonset
kubectl-kruise rollout status daemonset/foo
```
### Options
```
-h, --help help for rollout
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise](kubectl-kruise.md) - kubectl-kruise controls the OpenKruise CRs
* [kubectl-kruise rollout approve](kubectl-kruise_rollout_approve.md) - Approve a resource
* [kubectl-kruise rollout history](kubectl-kruise_rollout_history.md) - View rollout history
* [kubectl-kruise rollout pause](kubectl-kruise_rollout_pause.md) - Mark the provided resource as paused
* [kubectl-kruise rollout restart](kubectl-kruise_rollout_restart.md) - Restart a resource
* [kubectl-kruise rollout resume](kubectl-kruise_rollout_resume.md) - Resume a paused resource
* [kubectl-kruise rollout status](kubectl-kruise_rollout_status.md) - Show the status of the rollout
* [kubectl-kruise rollout undo](kubectl-kruise_rollout_undo.md) - Undo a previous rollout

View File

@ -0,0 +1,67 @@
## kubectl-kruise rollout approve
Approve a resource
### Synopsis
Approve a resource which can be continued.
Paused resources will not be reconciled by a controller. By approving a resource, we allow it to be continue to rollout. Currently only kruise-rollouts support being approved.
```
kubectl-kruise rollout approve RESOURCE
```
### Examples
```
# approve a kruise rollout resource named "rollout-demo" in "ns-demo" namespace
kubectl-kruise rollout approve rollout-demo -n ns-demo
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for approve
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise rollout](kubectl-kruise_rollout.md) - Manage the rollout of a resource

View File

@ -0,0 +1,71 @@
## kubectl-kruise rollout history
View rollout history
### Synopsis
View previous rollout revisions and configurations.
```
kubectl-kruise rollout history (TYPE NAME | TYPE/NAME) [flags]
```
### Examples
```
# View the rollout history of a cloneset
kubectl-kruise rollout history cloneset/abc
# View the rollout history of a advanced statefulset
kubectl-kruise rollout history asts/abc
# View the details of daemonset revision 3
kubectl-kruise rollout history daemonset/abc --revision=3
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for history
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--revision int See the details, including podTemplate of the revision specified
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise rollout](kubectl-kruise_rollout.md) - Manage the rollout of a resource

View File

@ -0,0 +1,69 @@
## kubectl-kruise rollout pause
Mark the provided resource as paused
### Synopsis
Mark the provided resource as paused
Paused resources will not be reconciled by a controller. Use "kubectl rollout resume" to resume a paused resource. Currently deployments, clonesets, rollouts support being paused.
```
kubectl-kruise rollout pause RESOURCE
```
### Examples
```
# Mark the nginx deployment as paused. Any current state of
# the deployment will continue its function, new updates to the deployment will not
# have an effect as long as the deployment is paused.
kubectl-kruise rollout pause deployment/nginx
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for pause
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise rollout](kubectl-kruise_rollout.md) - Manage the rollout of a resource

View File

@ -0,0 +1,70 @@
## kubectl-kruise rollout restart
Restart a resource
### Synopsis
Restart a resource.
Resource will be rollout restarted.
```
kubectl-kruise rollout restart RESOURCE
```
### Examples
```
# Restart a deployment
kubectl-kruise rollout restart deployment/nginx
kubectl-kruise rollout restart cloneset/abc
# Restart a daemonset
kubectl-kruise rollout restart daemonset/abc
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for restart
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise rollout](kubectl-kruise_rollout.md) - Manage the rollout of a resource

View File

@ -0,0 +1,69 @@
## kubectl-kruise rollout resume
Resume a paused resource
### Synopsis
Resume a paused resource
Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently deployments, cloneset support being resumed.
```
kubectl-kruise rollout resume RESOURCE
```
### Examples
```
# Resume an already paused rollout/cloneset/deployment resource
kubectl-kruise rollout resume rollout/nginx
kubectl-kruise rollout resume cloneset/nginx
kubectl-kruise rollout resume deployment/nginx
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for resume
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise rollout](kubectl-kruise_rollout.md) - Manage the rollout of a resource

View File

@ -0,0 +1,72 @@
## kubectl-kruise rollout status
Show the status of the rollout
### Synopsis
Show the status of the rollout.
By default 'rollout status' will watch the status of the latest rollout until it's done. If you don't want to wait for the rollout to finish then you can use --watch=false. Note that if a new rollout starts in-between, then 'rollout status' will continue watching the latest revision. If you want to pin to a specific revision and abort if it is rolled over by another revision, use --revision=N where N is the revision you need to watch for.
```
kubectl-kruise rollout status (TYPE NAME | TYPE/NAME) [flags]
```
### Examples
```
# Watch the rollout status of a deployment
kubectl-kruise rollout status deployment/nginx
# Watch the rollout status of a cloneset
kubectl-kruise rollout status cloneset/nginx
# Watch the rollout status of a advanced statefulset
kubectl-kruise rollout status asts/nginx
```
### Options
```
-d, --detail Show the detail status of the rollout.
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for status
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--revision int Pin to a specific revision for showing its status. Defaults to 0 (last revision).
--timeout duration The length of time to wait before ending watch, zero means never. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).
-w, --watch Watch the status of the rollout until it's done. (default true)
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise rollout](kubectl-kruise_rollout.md) - Manage the rollout of a resource

View File

@ -0,0 +1,78 @@
## kubectl-kruise rollout undo
Undo a previous rollout
### Synopsis
Rollback to a previous rollout.
```
kubectl-kruise rollout undo (TYPE NAME | TYPE/NAME) [flags]
```
### Examples
```
# Rollback to the previous cloneset
kubectl-kruise rollout undo cloneset/abc
# Rollback to the previous Advanced StatefulSet
kubectl-kruise rollout undo asts/abc
# Rollback to daemonset revision 3
kubectl-kruise rollout undo daemonset/abc --to-revision=3
# Rollback to the previous deployment with dry-run
kubectl-kruise rollout undo --dry-run=server deployment/abc
# Rollback to workload via rollout api object
kubectl-kruise rollout undo rollout/abc
```
### Options
```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for undo
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--to-revision int The revision to rollback to. Default to 0 (last revision).
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise rollout](kubectl-kruise_rollout.md) - Manage the rollout of a resource

View File

@ -0,0 +1,60 @@
## kubectl-kruise scaledown
Scaledown a cloneset with selective Pods
### Synopsis
Scaledown a cloneset with selective Pods
```
kubectl-kruise scaledown [CLONESET] --pods [POD1,POD2] -n [NAMESPACE]
```
### Examples
```
# Scale down 2 with selective pods
kubectl-kruise scaledown CloneSet cloneset-demo --pods pod-1, pod-2 -n default
```
### Options
```
-h, --help help for scaledown
--pods string Name of the pods to delete
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise](kubectl-kruise.md) - kubectl-kruise controls the OpenKruise CRs

View File

@ -0,0 +1,58 @@
## kubectl-kruise set
Set specific features on objects
### Synopsis
Configure application resources
These commands help you make changes to existing application resources.
```
kubectl-kruise set SUBCOMMAND
```
### Options
```
-h, --help help for set
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise](kubectl-kruise.md) - kubectl-kruise controls the OpenKruise CRs
* [kubectl-kruise set env](kubectl-kruise_set_env.md) - Update environment variables on a pod template
* [kubectl-kruise set image](kubectl-kruise_set_image.md) - Update image of a pod template
* [kubectl-kruise set resources](kubectl-kruise_set_resources.md) - Update resource requests/limits on objects with pod templates
* [kubectl-kruise set selector](kubectl-kruise_set_selector.md) - Set the selector on a resource
* [kubectl-kruise set serviceaccount](kubectl-kruise_set_serviceaccount.md) - Update ServiceAccount of a resource
* [kubectl-kruise set subject](kubectl-kruise_set_subject.md) - Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding

View File

@ -0,0 +1,115 @@
## kubectl-kruise set env
Update environment variables on a pod template
### Synopsis
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (within replication controllers or deployment configurations). View or modify the environment variable definitions on all containers in the specified pods or pod templates, or just those that match a wildcard.
If "--env -" is passed, environment variables can be read from STDIN using the standard env syntax.
Possible resources include (case insensitive):
pod (po), deployment (deploy), statefulset (sts), daemonset (ds), replicaset (rs), cloneset (clone), statefulset.apps.kruise.io (asts), daemonset.apps.kruise.io (ads)
```
kubectl-kruise set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N
```
### Examples
```
# Update cloneset 'sample' with a new environment variable
kubectl-kruise set env cloneset/sample STORAGE_DIR=/local
# List the environment variables defined on a cloneset 'sample'
kubectl-kruise set env cloneset/sample --list
# List the environment variables defined on all pods
kubectl-kruise set env pods --all --list
# Output modified cloneset in YAML, and does not alter the object on the server
kubectl-kruise set env cloneset/sample STORAGE_DIR=/data -o yaml
# Update all containers in all replication controllers in the project to have ENV=prod
kubectl-kruise set env rc --all ENV=prod
# Import environment from a secret
kubectl-kruise set env --from=secret/mysecret cloneset/sample
# Import environment from a config map with a prefix
kubectl-kruise set env --from=configmap/myconfigmap --prefix=MYSQL_ cloneset/sample
# Import specific keys from a config map
kubectl-kruise set env --keys=my-example-key --from=configmap/myconfigmap cloneset/sample
# Remove the environment variable ENV from container 'c1' in all deployment configs
kubectl-kruise set env clonesets --all --containers="c1" ENV-
# Remove the environment variable ENV from a deployment definition on disk and
# update the deployment config on the server
kubectl-kruise set env -f deploy.json ENV-
# Set some of the local shell environment into a deployment config on the server
env | grep RAILS_ | kubectl-kruise set env -e - cloneset/sample
```
### Options
```
--all If true, select all resources in the namespace of the specified resource types
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-c, --containers string The names of containers in the selected pod templates to change - may use wildcards (default "*")
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
-e, --env stringArray Specify a key-value pair for an environment variable to set into each container.
-f, --filename strings Filename, directory, or URL to files the resource to update the env
--from string The name of a resource from which to inject environment variables
-h, --help help for env
--keys strings Comma-separated list of keys to import from specified resource
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
--list If true, display the environment and any changes in the standard format. this flag will removed when we have kubectl view env.
--local If true, set env will NOT contact api-server but run locally.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
--overwrite If true, allow environment to be overwritten, otherwise reject updates that overwrite existing environment. (default true)
--prefix string Prefix to append to variable names
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--resolve If true, show secret or configmap references when listing variables
-l, --selector string Selector (label query) to filter on
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise set](kubectl-kruise_set.md) - Set specific features on objects

View File

@ -0,0 +1,81 @@
## kubectl-kruise set image
Update image of a pod template
### Synopsis
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), deployment (deploy), statefulset (sts), daemonset (ds), replicaset (rs), cloneset (clone), statefulset.apps.kruise.io (asts), daemonset.apps.kruise.io (ads)
```
kubectl-kruise set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N
```
### Examples
```
# Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.
kubectl-kruise set image cloneset/sample busybox=busybox nginx=nginx:1.9.1
# Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'
kubectl-kruise set image cloneset,rc nginx=nginx:1.9.1 --all
# Update image of all containers of cloneset sample to 'nginx:1.9.1'
kubectl-kruise set image cloneset sample *=nginx:1.9.1
# Print result (in yaml format) of updating nginx container image from local file, without hitting the server
kubectl-kruise set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml
```
### Options
```
--all Select all resources, including uninitialized ones, in the namespace of the specified resource types
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for image
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
--local If true, set image will NOT contact api-server but run locally.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
-l, --selector string Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise set](kubectl-kruise_set.md) - Set specific features on objects

View File

@ -0,0 +1,86 @@
## kubectl-kruise set resources
Update resource requests/limits on objects with pod templates
### Synopsis
Specify compute resource requirements (cpu, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its specified limits.
for each compute resource, if a limit is specified and a request is omitted, the request will default to the limit.
Possible resources include (case insensitive):
pod (po), deployment (deploy), statefulset (sts), daemonset (ds), replicaset (rs), cloneset (clone), statefulset.apps.kruise.io (asts), daemonset.apps.kruise.io (ads)
```
kubectl-kruise set resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]
```
### Examples
```
# Set a deployments nginx container cpu limits to "200m" and memory to "512Mi"
kubectl-kruise set resources cloneset sample -c=nginx --limits=cpu=200m,memory=512Mi
# Set the resource request and limits for all containers in nginx
kubectl-kruise set resources cloneset sample --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
# Remove the resource requests for resources on containers in nginx
kubectl-kruise set resources cloneset sample --limits=cpu=0,memory=0 --requests=cpu=0,memory=0
# Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server
kubectl-kruise set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml
```
### Options
```
--all Select all resources, including uninitialized ones, in the namespace of the specified resource types
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-c, --containers string The names of containers in the selected pod templates to change, all containers are selected by default - may use wildcards (default "*")
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for resources
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
--limits string The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.
--local If true, set resources will NOT contact api-server but run locally.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--requests string The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.
-l, --selector string Selector (label query) to filter on, not including uninitialized ones,supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise set](kubectl-kruise_set.md) - Set specific features on objects

View File

@ -0,0 +1,70 @@
## kubectl-kruise set selector
Set the selector on a resource
### Synopsis
Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'.
A selector must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters. If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used. Note: currently selectors can only be set on Service objects.
```
kubectl-kruise set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]
```
### Examples
```
# set the labels and selector before creating a deployment/service pair.
kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run=client | kubectl-kruise set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -
kubectl create cloneset sample -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -
```
### Options
```
--all Select all resources in the namespace of the specified resource types
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
-f, --filename strings identifying the resource.
-h, --help help for selector
--local If true, annotation will NOT contact api-server but run locally.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. (default true)
--resource-version string If non-empty, the selectors update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise set](kubectl-kruise_set.md) - Set specific features on objects

View File

@ -0,0 +1,74 @@
## kubectl-kruise set serviceaccount
Update ServiceAccount of a resource
### Synopsis
Update ServiceAccount of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset, cloneset (cs)
```
kubectl-kruise set serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT
```
### Examples
```
# Set Deployment nginx-deployment's ServiceAccount to serviceaccount1
kubectl-kruise set serviceaccount cloneset sample serviceaccount1
# Print the result (in yaml format) of updated cloneset with serviceaccount from local file, without hitting apiserver
kubectl-kruise set sa -f CloneSet.yaml serviceaccount1 --local --dry-run=client -o yaml
```
### Options
```
--all Select all resources, including uninitialized ones, in the namespace of the specified resource types
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
-f, --filename strings Filename, directory, or URL to files identifying the resource to get from a server.
-h, --help help for serviceaccount
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
--local If true, set serviceaccount will NOT contact api-server but run locally.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise set](kubectl-kruise_set.md) - Set specific features on objects

View File

@ -0,0 +1,76 @@
## kubectl-kruise set subject
Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding
### Synopsis
Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.
```
kubectl-kruise set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]
```
### Examples
```
# Update a ClusterRoleBinding for serviceaccount1
kubectl-kruise set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1
# Update a RoleBinding for user1, user2, and group1
kubectl-kruise 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=client | kubectl-kruise set subject --local -f - --user=foo -o yaml
```
### Options
```
--all Select all resources, including uninitialized ones, in the namespace of the specified resource types
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--dry-run string[="unchanged"] Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. (default "none")
-f, --filename strings Filename, directory, or URL to files the resource to update the subjects
--group stringArray Groups to bind to the role
-h, --help help for subject
-k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R.
--local If true, set subject will NOT contact api-server but run locally.
-o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
-l, --selector string Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
--serviceaccount stringArray Service accounts to bind to the role
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--user stringArray Usernames to bind to the role
```
### Options inherited from parent commands
```
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "$HOME/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--password string Password for basic authentication to the API server
--profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")
--profile-output string Name of the file to write the profile to (default "profile.pprof")
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
-s, --server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--username string Username for basic authentication to the API server
--warnings-as-errors Treat warnings received from the server as errors and exit with a non-zero exit code
```
### SEE ALSO
* [kubectl-kruise set](kubectl-kruise_set.md) - Set specific features on objects

View File

@ -0,0 +1,82 @@
name: kubectl-kruise
synopsis: kubectl-kruise controls the OpenKruise CRs
description: |-
kubectl-kruise controls the OpenKruise manager.
Find more information at: https://openkruise.io/
usage: kubectl-kruise [flags]
options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: help
shorthand: h
default_value: "false"
usage: help for kubectl-kruise
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
see_also:
- kubectl-kruise create - Create a resource from a file or from stdin.
- kubectl-kruise expose - Take a workload(e.g. deployment, cloneset), service or pod and expose it as a new Kubernetes Service
- kubectl-kruise migrate - Migrate from K8s original workloads to Kruise workloads
- kubectl-kruise rollout - Manage the rollout of a resource
- kubectl-kruise scaledown - Scaledown a cloneset with selective Pods
- kubectl-kruise set - Set specific features on objects

View File

@ -0,0 +1,147 @@
name: kubectl-kruise create
synopsis: Create a resource from a file or from stdin.
description: |-
Create a resource from a file or from stdin.
JSON and YAML formats are accepted.
usage: kubectl-kruise create -f FILENAME
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: edit
default_value: "false"
usage: Edit the API resource before creating
- name: field-manager
default_value: kubectl-create
usage: Name of the manager used to track field ownership.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files to use to create the resource
- name: help
shorthand: h
default_value: "false"
usage: help for create
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: raw
usage: |
Raw URI to POST to the server. Uses the transport specified by the kubeconfig file.
- name: record
default_value: "false"
usage: |
Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: save-config
default_value: "false"
usage: |
If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
- name: selector
shorthand: l
usage: |
Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: validate
default_value: strict
usage: |-
Must be one of: strict (or true), warn, ignore (or false).
"true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not.
"warn" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as "ignore" otherwise.
"false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields.
- name: windows-line-endings
default_value: "false"
usage: |
Only relevant if --edit=true. Defaults to the line ending native to your platform.
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Create a pod using the data in pod.json.\n kubectl create -f ./pod.json\n \n # Create a pod based on the JSON passed into stdin.\n cat pod.json | kubectl create -f -\n \n # Edit the data in docker-registry.yaml in JSON then create the resource using the edited data.\n kubectl create -f docker-registry.yaml --edit -o json"
see_also:
- kubectl-kruise - kubectl-kruise controls the OpenKruise CRs
- kubectl-kruise create ContainerRecreateRequest - Create a crr with the specified name.
- kubectl-kruise create broadcastJob - Create a broadcastJob with the specified name.
- kubectl-kruise create job - Create a job with the specified name.

View File

@ -0,0 +1,125 @@
name: kubectl-kruise create ContainerRecreateRequest
synopsis: Create a crr with the specified name.
description: Create a crr with the specified name.
usage: kubectl-kruise create ContainerRecreateRequest NAME --pod=podName [--containers=container]
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: containers
default_value: '[]'
usage: The containers those need to restarted.
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: field-manager
default_value: kubectl kruise-create
usage: Name of the manager used to track field ownership.
- name: help
shorthand: h
default_value: "false"
usage: help for ContainerRecreateRequest
- name: minStartedSeconds
shorthand: m
default_value: "0"
usage: |
Minimum number of seconds for which a newly created container should be started and ready without any of its container crashing, for it to be considered Succeeded.Defaults to 0 (container will be considered Succeeded as soon as it is started and ready)
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: pod
shorthand: p
usage: The name of the pod).
- name: save-config
default_value: "false"
usage: |
If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: unreadyGracePeriodSeconds
shorthand: u
default_value: "0"
usage: |
UnreadyGracePeriodSeconds is the optional duration in seconds to mark Pod as not ready over this duration before executing preStop hook and stopping the container
- name: validate
default_value: strict
usage: |-
Must be one of: strict (or true), warn, ignore (or false).
"true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not.
"warn" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as "ignore" otherwise.
"false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields.
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " NOTE: The default value of CRR is:\n strategy:\n failurePolicy: Fail\n orderedRecreate: false\n unreadyGracePeriodSeconds: 3\n activeDeadlineSeconds: 300\n ttlSecondsAfterFinished: 1800\n # Create a crr with default value to restart all containers in pod-1\n kubectl kruise create ContainerRecreateRequest my-crr --namespace=ns --pod=pod-1\n \n # Create a crr with default value to restart container-1 in pod-1\n kubectl kruise create ContainerRecreateRequest my-crr --namespace=ns --pod=pod-1 --containers=container-1\n \n # Create a crr with unreadyGracePeriodSeconds 5 and terminationGracePeriodSeconds 30 to restart container-1 in pod-1\n kubectl kruise create ContainerRecreateRequest my-crr --namespace=ns --pod=pod-1 --containers=container-1 --unreadyGracePeriodSeconds=5 --terminationGracePeriodSeconds=30"
see_also:
- kubectl-kruise create - Create a resource from a file or from stdin.

View File

@ -0,0 +1,114 @@
name: kubectl-kruise create broadcastJob
synopsis: Create a broadcastJob with the specified name.
description: Create a broadcastJob with the specified name.
usage: kubectl-kruise create broadcastJob NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: field-manager
default_value: kubectl kruise-create
usage: Name of the manager used to track field ownership.
- name: from
usage: |
The name of the resource to create a BroadcastJob from (only advancedCronjob is supported).
- name: help
shorthand: h
default_value: "false"
usage: help for broadcastJob
- name: image
usage: Image name to run.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: save-config
default_value: "false"
usage: |
If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: validate
default_value: strict
usage: |-
Must be one of: strict (or true), warn, ignore (or false).
"true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not.
"warn" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as "ignore" otherwise.
"false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields.
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Create a broadcastJob\n kubectl kruise create broadcastJob my-bcj --image=busybox\n \n # Create a broadcastJob with command\n kubectl kruise create broadcastJob my-bcj --image=busybox -- date\n \n # Create a broadcastJob from a AdvancedCronJob named \"a-advancedCronjob\"\n kubectl kruise create broadcastJob test-bcj --from=acj/a-advancedCronjob"
see_also:
- kubectl-kruise create - Create a resource from a file or from stdin.

View File

@ -0,0 +1,114 @@
name: kubectl-kruise create job
synopsis: Create a job with the specified name.
description: Create a job with the specified name.
usage: kubectl-kruise create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: field-manager
default_value: kubectl kruise-create
usage: Name of the manager used to track field ownership.
- name: from
usage: |
The name of the resource to create a Job from (cronjob and advancedCronjob are supported).
- name: help
shorthand: h
default_value: "false"
usage: help for job
- name: image
usage: Image name to run.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: save-config
default_value: "false"
usage: |
If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: validate
default_value: strict
usage: |-
Must be one of: strict (or true), warn, ignore (or false).
"true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not.
"warn" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as "ignore" otherwise.
"false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields.
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Create a job\n kubectl kruise create job my-job --image=busybox\n \n # Create a job with command\n kubectl kruise create job my-job --image=busybox -- date\n \n # Create a job from a AdvancedCronJob named \"a-advancedCronjob\"\n kubectl kruise create job test-job --from=acj/a-advancedCronjob"
see_also:
- kubectl-kruise create - Create a resource from a file or from stdin.

View File

@ -0,0 +1,169 @@
name: kubectl-kruise expose
synopsis: |
Take a workload(e.g. deployment, cloneset), service or pod and expose it as a new Kubernetes Service
description: |-
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A deployment or replica set will be exposed as a service only if its selector is convertible to a selector that service supports, i.e. when the selector contains only the matchLabels component. Note that if no port is specified via --port and the exposed resource has multiple ports, all will be re-used by the new service. Also if no labels are specified, the new service will re-use the labels from the resource it exposes.
Possible resources include (case insensitive):
pod (po), service (svc), replicationcontroller (rc), cloneset (clone), deployment (deploy), replicaset (rs)
usage: kubectl-kruise 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]
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: cluster-ip
usage: |
ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service.
- name: container-port
usage: Synonym for --target-port
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: external-ip
usage: |
Additional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP.
- name: field-manager
default_value: kubectl-expose
usage: Name of the manager used to track field ownership.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to expose a service
- name: generator
default_value: service/v2
usage: |
The name of the API generator to use. There are 2 generators: 'service/v1' and 'service/v2'. The only difference between them is that service port in v1 is named 'default', while it is left unnamed in v2. Default is 'service/v2'.
- name: help
shorthand: h
default_value: "false"
usage: help for expose
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: labels
shorthand: l
usage: Labels to apply to the service created by this call.
- name: load-balancer-ip
usage: |
IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and used (cloud-provider specific).
- name: name
usage: The name for the newly created object.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: overrides
usage: |
An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.
- name: port
usage: |
The port that the service should serve on. Copied from the resource being exposed, if unspecified
- name: protocol
usage: |
The network protocol for the service to be created. Default is 'TCP'.
- name: record
default_value: "false"
usage: |
Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: save-config
default_value: "false"
usage: |
If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
- name: selector
usage: |
A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set.)
- name: session-affinity
usage: |
If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP'
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: target-port
usage: |
Name or number for the port on the container that the service should direct traffic to. Optional.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: type
usage: |
Type for this service: ClusterIP, NodePort, LoadBalancer, or ExternalName. Default is 'ClusterIP'.
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Create a service for an nginx cloneset, which serves on port 80 and connects to the containers on port 8000.\n kubectl kruise expose cloneset nginx --port=80 --target-port=8000\n \n # Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.\n kubectl expose rc nginx --port=80 --target-port=8000\n \n # Create a service for a replication controller identified by type and name specified in \"nginx-controller.yaml\", which serves on port 80 and connects to the containers on port 8000.\n kubectl expose -f nginx-controller.yaml --port=80 --target-port=8000\n \n # Create a service for a pod valid-pod, which serves on port 444 with the name \"frontend\"\n kubectl expose pod valid-pod --port=444 --name=frontend\n \n # Create a second service based on the above service, exposing the container port 8443 as port 443 with the name \"nginx-https\"\n kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https\n \n # Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.\n kubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream\n \n # Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000.\n kubectl expose rs nginx --port=80 --target-port=8000\n \n # Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000.\n kubectl expose deployment nginx --port=80 --target-port=8000"
see_also:
- kubectl-kruise - kubectl-kruise controls the OpenKruise CRs

View File

@ -0,0 +1,106 @@
name: kubectl-kruise migrate
synopsis: Migrate from K8s original workloads to Kruise workloads
description: Migrate from K8s original workloads to Kruise workloads
usage: kubectl-kruise migrate [DST_KIND] --from [SRC_KIND] [flags]
options:
- name: copy
default_value: "false"
usage: Copy replicas from src workload when create.
- name: create
default_value: "false"
usage: Create dst workload with replicas=0 from src workload.
- name: dst-name
usage: Name of the destination workload.
- name: from
usage: Type of the source workload (e.g. Deployment).
- name: help
shorthand: h
default_value: "false"
usage: help for migrate
- name: max-surge
default_value: "1"
usage: Max surge during migration.
- name: replicas
default_value: "-1"
usage: |
The replicas needs to migrate, -1 indicates all replicas in src workload.
- name: src-name
usage: Name of the source workload.
- name: timeout-seconds
default_value: "-1"
usage: Timeout seconds for migration, -1 indicates no limited.
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: |4
# Create an empty CloneSet from an existing Deployment.
kubectl-kruise migrate CloneSet --from Deployment -n default --dst-name deployment-name --create
# Create a same replicas CloneSet from an existing Deployment.
kubectl-kruise migrate CloneSet --from Deployment -n default --dst-name deployment-name --create --copy
# Migrate replicas from an existing Deployment to an existing CloneSet.
kubectl-kruise migrate CloneSet --from Deployment -n default --src-name cloneset-name --dst-name deployment-name --replicas 10 --max-surge=2
see_also:
- kubectl-kruise - kubectl-kruise controls the OpenKruise CRs

View File

@ -0,0 +1,83 @@
name: kubectl-kruise rollout
synopsis: Manage the rollout of a resource
description: "Manage the rollout of a resource.\n \n Valid resource types include:\n\n * deployments\n * daemonsets\n * statefulsets\n * clonesets\n * statefulsets.apps.kruise.io\n * daemonsets.apps.kruise.io\n * rollouts.rollouts.kruise.io"
usage: kubectl-kruise rollout SUBCOMMAND
options:
- name: help
shorthand: h
default_value: "false"
usage: help for rollout
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Rollback to the previous cloneset\n kubectl-kruise rollout undo cloneset/abc\n \n # Check the rollout status of a daemonset\n kubectl-kruise rollout status daemonset/foo"
see_also:
- kubectl-kruise - kubectl-kruise controls the OpenKruise CRs
- kubectl-kruise rollout approve - Approve a resource
- kubectl-kruise rollout history - View rollout history
- kubectl-kruise rollout pause - Mark the provided resource as paused
- kubectl-kruise rollout restart - Restart a resource
- kubectl-kruise rollout resume - Resume a paused resource
- kubectl-kruise rollout status - Show the status of the rollout
- kubectl-kruise rollout undo - Undo a previous rollout

View File

@ -0,0 +1,108 @@
name: kubectl-kruise rollout approve
synopsis: Approve a resource
description: |-
Approve a resource which can be continued.
Paused resources will not be reconciled by a controller. By approving a resource, we allow it to be continue to rollout. Currently only kruise-rollouts support being approved.
usage: kubectl-kruise rollout approve RESOURCE
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for approve
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # approve a kruise rollout resource named \"rollout-demo\" in \"ns-demo\" namespace\n \n kubectl-kruise rollout approve rollout-demo -n ns-demo"
see_also:
- kubectl-kruise rollout - Manage the rollout of a resource

View File

@ -0,0 +1,109 @@
name: kubectl-kruise rollout history
synopsis: View rollout history
description: View previous rollout revisions and configurations.
usage: kubectl-kruise rollout history (TYPE NAME | TYPE/NAME) [flags]
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for history
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: revision
default_value: "0"
usage: |
See the details, including podTemplate of the revision specified
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # View the rollout history of a cloneset\n kubectl-kruise rollout history cloneset/abc\n \n # View the rollout history of a advanced statefulset\n kubectl-kruise rollout history asts/abc\n \n # View the details of daemonset revision 3\n kubectl-kruise rollout history daemonset/abc --revision=3"
see_also:
- kubectl-kruise rollout - Manage the rollout of a resource

View File

@ -0,0 +1,108 @@
name: kubectl-kruise rollout pause
synopsis: Mark the provided resource as paused
description: |-
Mark the provided resource as paused
Paused resources will not be reconciled by a controller. Use "kubectl rollout resume" to resume a paused resource. Currently deployments, clonesets, rollouts support being paused.
usage: kubectl-kruise rollout pause RESOURCE
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for pause
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Mark the nginx deployment as paused. Any current state of\n # the deployment will continue its function, new updates to the deployment will not\n # have an effect as long as the deployment is paused.\n \n kubectl-kruise rollout pause deployment/nginx"
see_also:
- kubectl-kruise rollout - Manage the rollout of a resource

View File

@ -0,0 +1,108 @@
name: kubectl-kruise rollout restart
synopsis: Restart a resource
description: |-
Restart a resource.
Resource will be rollout restarted.
usage: kubectl-kruise rollout restart RESOURCE
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for restart
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Restart a deployment\n kubectl-kruise rollout restart deployment/nginx\n kubectl-kruise rollout restart cloneset/abc\n \n # Restart a daemonset\n kubectl-kruise rollout restart daemonset/abc"
see_also:
- kubectl-kruise rollout - Manage the rollout of a resource

View File

@ -0,0 +1,108 @@
name: kubectl-kruise rollout resume
synopsis: Resume a paused resource
description: |-
Resume a paused resource
Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently deployments, cloneset support being resumed.
usage: kubectl-kruise rollout resume RESOURCE
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for resume
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Resume an already paused rollout/cloneset/deployment resource\n \n kubectl-kruise rollout resume rollout/nginx\n kubectl-kruise rollout resume cloneset/nginx\n kubectl-kruise rollout resume deployment/nginx"
see_also:
- kubectl-kruise rollout - Manage the rollout of a resource

View File

@ -0,0 +1,109 @@
name: kubectl-kruise rollout status
synopsis: Show the status of the rollout
description: |-
Show the status of the rollout.
By default 'rollout status' will watch the status of the latest rollout until it's done. If you don't want to wait for the rollout to finish then you can use --watch=false. Note that if a new rollout starts in-between, then 'rollout status' will continue watching the latest revision. If you want to pin to a specific revision and abort if it is rolled over by another revision, use --revision=N where N is the revision you need to watch for.
usage: kubectl-kruise rollout status (TYPE NAME | TYPE/NAME) [flags]
options:
- name: detail
shorthand: d
default_value: "false"
usage: Show the detail status of the rollout.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for status
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: revision
default_value: "0"
usage: |
Pin to a specific revision for showing its status. Defaults to 0 (last revision).
- name: timeout
default_value: 0s
usage: |
The length of time to wait before ending watch, zero means never. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).
- name: watch
shorthand: w
default_value: "true"
usage: Watch the status of the rollout until it's done.
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Watch the rollout status of a deployment\n kubectl-kruise rollout status deployment/nginx\n \n # Watch the rollout status of a cloneset\n kubectl-kruise rollout status cloneset/nginx\n \n # Watch the rollout status of a advanced statefulset\n kubectl-kruise rollout status asts/nginx"
see_also:
- kubectl-kruise rollout - Manage the rollout of a resource

View File

@ -0,0 +1,112 @@
name: kubectl-kruise rollout undo
synopsis: Undo a previous rollout
description: Rollback to a previous rollout.
usage: kubectl-kruise rollout undo (TYPE NAME | TYPE/NAME) [flags]
options:
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for undo
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: to-revision
default_value: "0"
usage: The revision to rollback to. Default to 0 (last revision).
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Rollback to the previous cloneset\n kubectl-kruise rollout undo cloneset/abc\n \n # Rollback to the previous Advanced StatefulSet\n kubectl-kruise rollout undo asts/abc\n \n # Rollback to daemonset revision 3\n kubectl-kruise rollout undo daemonset/abc --to-revision=3\n \n # Rollback to the previous deployment with dry-run\n kubectl-kruise rollout undo --dry-run=server deployment/abc\n \n # Rollback to workload via rollout api object\n kubectl-kruise rollout undo rollout/abc"
see_also:
- kubectl-kruise rollout - Manage the rollout of a resource

View File

@ -0,0 +1,80 @@
name: kubectl-kruise scaledown
synopsis: Scaledown a cloneset with selective Pods
description: Scaledown a cloneset with selective Pods
usage: kubectl-kruise scaledown [CLONESET] --pods [POD1,POD2] -n [NAMESPACE]
options:
- name: help
shorthand: h
default_value: "false"
usage: help for scaledown
- name: pods
usage: Name of the pods to delete
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: |4
# Scale down 2 with selective pods
kubectl-kruise scaledown CloneSet cloneset-demo --pods pod-1, pod-2 -n default
see_also:
- kubectl-kruise - kubectl-kruise controls the OpenKruise CRs

View File

@ -0,0 +1,84 @@
name: kubectl-kruise set
synopsis: Set specific features on objects
description: |-
Configure application resources
These commands help you make changes to existing application resources.
usage: kubectl-kruise set SUBCOMMAND
options:
- name: help
shorthand: h
default_value: "false"
usage: help for set
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
see_also:
- kubectl-kruise - kubectl-kruise controls the OpenKruise CRs
- kubectl-kruise set env - Update environment variables on a pod template
- kubectl-kruise set image - Update image of a pod template
- kubectl-kruise set resources - Update resource requests/limits on objects with pod templates
- kubectl-kruise set selector - Set the selector on a resource
- kubectl-kruise set serviceaccount - Update ServiceAccount of a resource
- kubectl-kruise set subject - Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding

View File

@ -0,0 +1,160 @@
name: kubectl-kruise set env
synopsis: Update environment variables on a pod template
description: |-
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (within replication controllers or deployment configurations). View or modify the environment variable definitions on all containers in the specified pods or pod templates, or just those that match a wildcard.
If "--env -" is passed, environment variables can be read from STDIN using the standard env syntax.
Possible resources include (case insensitive):
pod (po), deployment (deploy), statefulset (sts), daemonset (ds), replicaset (rs), cloneset (clone), statefulset.apps.kruise.io (asts), daemonset.apps.kruise.io (ads)
usage: kubectl-kruise set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N
options:
- name: all
default_value: "false"
usage: |
If true, select all resources in the namespace of the specified resource types
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: containers
shorthand: c
default_value: '*'
usage: |
The names of containers in the selected pod templates to change - may use wildcards
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: env
shorthand: e
default_value: '[]'
usage: |
Specify a key-value pair for an environment variable to set into each container.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files the resource to update the env
- name: from
usage: |
The name of a resource from which to inject environment variables
- name: help
shorthand: h
default_value: "false"
usage: help for env
- name: keys
default_value: '[]'
usage: |
Comma-separated list of keys to import from specified resource
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: list
default_value: "false"
usage: |
If true, display the environment and any changes in the standard format. this flag will removed when we have kubectl view env.
- name: local
default_value: "false"
usage: |
If true, set env will NOT contact api-server but run locally.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: overwrite
default_value: "true"
usage: |
If true, allow environment to be overwritten, otherwise reject updates that overwrite existing environment.
- name: prefix
usage: Prefix to append to variable names
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: resolve
default_value: "false"
usage: |
If true, show secret or configmap references when listing variables
- name: selector
shorthand: l
usage: Selector (label query) to filter on
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Update cloneset 'sample' with a new environment variable\n kubectl-kruise set env cloneset/sample STORAGE_DIR=/local\n \n # List the environment variables defined on a cloneset 'sample'\n kubectl-kruise set env cloneset/sample --list\n \n # List the environment variables defined on all pods\n kubectl-kruise set env pods --all --list\n \n # Output modified cloneset in YAML, and does not alter the object on the server\n kubectl-kruise set env cloneset/sample STORAGE_DIR=/data -o yaml\n \n # Update all containers in all replication controllers in the project to have ENV=prod\n kubectl-kruise set env rc --all ENV=prod\n \n # Import environment from a secret\n kubectl-kruise set env --from=secret/mysecret cloneset/sample\n \n # Import environment from a config map with a prefix\n kubectl-kruise set env --from=configmap/myconfigmap --prefix=MYSQL_ cloneset/sample\n \n # Import specific keys from a config map\n kubectl-kruise set env --keys=my-example-key --from=configmap/myconfigmap cloneset/sample\n \n # Remove the environment variable ENV from container 'c1' in all deployment configs\n kubectl-kruise set env clonesets --all --containers=\"c1\" ENV-\n \n # Remove the environment variable ENV from a deployment definition on disk and\n # update the deployment config on the server\n kubectl-kruise set env -f deploy.json ENV-\n \n # Set some of the local shell environment into a deployment config on the server\n env | grep RAILS_ | kubectl-kruise set env -e - cloneset/sample"
see_also:
- kubectl-kruise set - Set specific features on objects

View File

@ -0,0 +1,130 @@
name: kubectl-kruise set image
synopsis: Update image of a pod template
description: |-
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), deployment (deploy), statefulset (sts), daemonset (ds), replicaset (rs), cloneset (clone), statefulset.apps.kruise.io (asts), daemonset.apps.kruise.io (ads)
usage: kubectl-kruise set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N
options:
- name: all
default_value: "false"
usage: |
Select all resources, including uninitialized ones, in the namespace of the specified resource types
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for image
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: local
default_value: "false"
usage: |
If true, set image will NOT contact api-server but run locally.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: record
default_value: "false"
usage: |
Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: selector
shorthand: l
usage: |
Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.\n kubectl-kruise set image cloneset/sample busybox=busybox nginx=nginx:1.9.1\n \n # Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'\n kubectl-kruise set image cloneset,rc nginx=nginx:1.9.1 --all\n \n # Update image of all containers of cloneset sample to 'nginx:1.9.1'\n kubectl-kruise set image cloneset sample *=nginx:1.9.1\n \n # Print result (in yaml format) of updating nginx container image from local file, without hitting the server\n kubectl-kruise set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml"
see_also:
- kubectl-kruise set - Set specific features on objects

View File

@ -0,0 +1,144 @@
name: kubectl-kruise set resources
synopsis: |
Update resource requests/limits on objects with pod templates
description: |-
Specify compute resource requirements (cpu, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its specified limits.
for each compute resource, if a limit is specified and a request is omitted, the request will default to the limit.
Possible resources include (case insensitive):
pod (po), deployment (deploy), statefulset (sts), daemonset (ds), replicaset (rs), cloneset (clone), statefulset.apps.kruise.io (asts), daemonset.apps.kruise.io (ads)
usage: kubectl-kruise set resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]
options:
- name: all
default_value: "false"
usage: |
Select all resources, including uninitialized ones, in the namespace of the specified resource types
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: containers
shorthand: c
default_value: '*'
usage: |
The names of containers in the selected pod templates to change, all containers are selected by default - may use wildcards
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for resources
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: limits
usage: |
The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.
- name: local
default_value: "false"
usage: |
If true, set resources will NOT contact api-server but run locally.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: record
default_value: "false"
usage: |
Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: requests
usage: |
The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.
- name: selector
shorthand: l
usage: |
Selector (label query) to filter on, not including uninitialized ones,supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Set a deployments nginx container cpu limits to \"200m\" and memory to \"512Mi\"\n kubectl-kruise set resources cloneset sample -c=nginx --limits=cpu=200m,memory=512Mi\n \n # Set the resource request and limits for all containers in nginx\n kubectl-kruise set resources cloneset sample --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi\n \n # Remove the resource requests for resources on containers in nginx\n kubectl-kruise set resources cloneset sample --limits=cpu=0,memory=0 --requests=cpu=0,memory=0\n \n # Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server\n kubectl-kruise set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml"
see_also:
- kubectl-kruise set - Set specific features on objects

View File

@ -0,0 +1,125 @@
name: kubectl-kruise set selector
synopsis: Set the selector on a resource
description: |-
Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'.
A selector must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters. If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used. Note: currently selectors can only be set on Service objects.
usage: kubectl-kruise set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]
options:
- name: all
default_value: "false"
usage: |
Select all resources in the namespace of the specified resource types
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: filename
shorthand: f
default_value: '[]'
usage: identifying the resource.
- name: help
shorthand: h
default_value: "false"
usage: help for selector
- name: local
default_value: "false"
usage: |
If true, annotation will NOT contact api-server but run locally.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: record
default_value: "false"
usage: |
Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
- name: recursive
shorthand: R
default_value: "true"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: resource-version
usage: |
If non-empty, the selectors update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: |4-
# set the labels and selector before creating a deployment/service pair.
kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run=client | kubectl-kruise set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -
kubectl create cloneset sample -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -
see_also:
- kubectl-kruise set - Set specific features on objects

View File

@ -0,0 +1,126 @@
name: kubectl-kruise set serviceaccount
synopsis: Update ServiceAccount of a resource
description: |-
Update ServiceAccount of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset, cloneset (cs)
usage: kubectl-kruise set serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT
options:
- name: all
default_value: "false"
usage: |
Select all resources, including uninitialized ones, in the namespace of the specified resource types
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files identifying the resource to get from a server.
- name: help
shorthand: h
default_value: "false"
usage: help for serviceaccount
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: local
default_value: "false"
usage: |
If true, set serviceaccount will NOT contact api-server but run locally.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: record
default_value: "false"
usage: |
Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: user
usage: The name of the kubeconfig user to use
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Set Deployment nginx-deployment's ServiceAccount to serviceaccount1\n kubectl-kruise set serviceaccount cloneset sample serviceaccount1\n \n # Print the result (in yaml format) of updated cloneset with serviceaccount from local file, without hitting apiserver\n kubectl-kruise set sa -f CloneSet.yaml serviceaccount1 --local --dry-run=client -o yaml"
see_also:
- kubectl-kruise set - Set specific features on objects

View File

@ -0,0 +1,130 @@
name: kubectl-kruise set subject
synopsis: |
Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding
description: |
Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.
usage: kubectl-kruise set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]
options:
- name: all
default_value: "false"
usage: |
Select all resources, including uninitialized ones, in the namespace of the specified resource types
- name: allow-missing-template-keys
default_value: "true"
usage: |
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
- name: dry-run
default_value: none
usage: |
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
- name: filename
shorthand: f
default_value: '[]'
usage: |
Filename, directory, or URL to files the resource to update the subjects
- name: group
default_value: '[]'
usage: Groups to bind to the role
- name: help
shorthand: h
default_value: "false"
usage: help for subject
- name: kustomize
shorthand: k
usage: |
Process the kustomization directory. This flag can't be used together with -f or -R.
- name: local
default_value: "false"
usage: |
If true, set subject will NOT contact api-server but run locally.
- name: output
shorthand: o
usage: |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
- name: recursive
shorthand: R
default_value: "false"
usage: |
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
- name: selector
shorthand: l
usage: |
Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
- name: serviceaccount
default_value: '[]'
usage: Service accounts to bind to the role
- name: show-managed-fields
default_value: "false"
usage: |
If true, keep the managedFields when printing objects in JSON or YAML format.
- name: template
usage: |
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
- name: user
default_value: '[]'
usage: Usernames to bind to the role
inherited_options:
- name: as
usage: |
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
- name: as-group
default_value: '[]'
usage: |
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
- name: as-uid
usage: UID to impersonate for the operation.
- name: cache-dir
default_value: $HOME/.kube/cache
usage: Default cache directory
- name: certificate-authority
usage: Path to a cert file for the certificate authority
- name: client-certificate
usage: Path to a client certificate file for TLS
- name: client-key
usage: Path to a client key file for TLS
- name: cluster
usage: The name of the kubeconfig cluster to use
- name: context
usage: The name of the kubeconfig context to use
- name: insecure-skip-tls-verify
default_value: "false"
usage: |
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
- name: kubeconfig
usage: Path to the kubeconfig file to use for CLI requests.
- name: match-server-version
default_value: "false"
usage: Require server version to match client version
- name: namespace
shorthand: "n"
usage: If present, the namespace scope for this CLI request
- name: password
usage: Password for basic authentication to the API server
- name: profile
default_value: none
usage: |
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
- name: profile-output
default_value: profile.pprof
usage: Name of the file to write the profile to
- name: request-timeout
default_value: "0"
usage: |
The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
- name: server
shorthand: s
usage: The address and port of the Kubernetes API server
- name: tls-server-name
usage: |
Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
- name: token
usage: Bearer token for authentication to the API server
- name: username
usage: Username for basic authentication to the API server
- name: warnings-as-errors
default_value: "false"
usage: |
Treat warnings received from the server as errors and exit with a non-zero exit code
example: " # Update a ClusterRoleBinding for serviceaccount1\n kubectl-kruise set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1\n \n # Update a RoleBinding for user1, user2, and group1\n kubectl-kruise set subject rolebinding admin --user=user1 --user=user2 --group=group1\n \n # Print the result (in yaml format) of updating rolebinding subjects from a local, without hitting the server\n kubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl-kruise set subject --local -f - --user=foo -o yaml"
see_also:
- kubectl-kruise set - Set specific features on objects

6
go.mod
View File

@ -8,7 +8,7 @@ require (
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
github.com/openkruise/kruise-api v1.5.0 github.com/openkruise/kruise-api v1.5.0
github.com/openkruise/kruise-rollout-api v0.5.0 github.com/openkruise/kruise-rollout-api v0.5.0
github.com/spf13/cobra v1.4.0 github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.2 github.com/stretchr/testify v1.8.2
k8s.io/api v0.24.16 k8s.io/api v0.24.16
@ -36,6 +36,7 @@ require (
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.16.0+incompatible // indirect github.com/emicklei/go-restful v2.16.0+incompatible // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/evanphx/json-patch v4.12.0+incompatible // indirect
@ -57,7 +58,7 @@ require (
github.com/google/uuid v1.3.0 // indirect github.com/google/uuid v1.3.0 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/imdario/mergo v0.3.12 // indirect github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/josharian/intern v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
@ -74,6 +75,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday v1.5.2 // indirect github.com/russross/blackfriday v1.5.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.21.0 // indirect golang.org/x/crypto v0.21.0 // indirect

7
go.sum
View File

@ -105,6 +105,8 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
@ -294,6 +296,8 @@ github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
@ -426,6 +430,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
@ -444,6 +449,8 @@ github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=

View File

@ -440,6 +440,7 @@ func NewKubectlCommand(in io.Reader, out, err io.Writer) *cobra.Command {
} }
cmds.AddCommand(alpha) cmds.AddCommand(alpha)
cmds.AddCommand(NewCmdGenerateDocs(f, ioStreams))
cmds.AddCommand(cmdconfig.NewCmdConfig(clientcmd.NewDefaultPathOptions(), ioStreams)) cmds.AddCommand(cmdconfig.NewCmdConfig(clientcmd.NewDefaultPathOptions(), ioStreams))
cmds.AddCommand(plugin.NewCmdPlugin(ioStreams)) cmds.AddCommand(plugin.NewCmdPlugin(ioStreams))
cmds.AddCommand(version.NewCmdVersion(f, ioStreams)) cmds.AddCommand(version.NewCmdVersion(f, ioStreams))

106
pkg/cmd/generate-docs.go Normal file
View File

@ -0,0 +1,106 @@
/*
Copyright 2021 The Kruise Authors.
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"fmt"
"os"
"path/filepath"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
"k8s.io/cli-runtime/pkg/genericclioptions"
cmdutil "k8s.io/kubectl/pkg/cmd/util"
)
var (
defaultDocDir = "docs"
yamlDir = "yaml"
)
func NewCmdGenerateDocs(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
cmd := &cobra.Command{
Use: "generate-docs",
Short: "Generate documentation for kruise",
Long: "Generate documentation for kruise",
Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(generateDocs(cmd))
},
Hidden: true,
}
cmd.Flags().String("directory", "", "The directory to write the generated docs to")
return cmd
}
func generateDocs(cmd *cobra.Command) error {
directory, err := cmd.Flags().GetString("directory")
if err != nil {
return err
}
if directory == "" {
directory = defaultDocDir
}
// Remove the commands from the root command tree
removeCmds(cmd.Root(), []string{"exec", "apply", "wait", "diff", "options", "help", "api-resources", "api-versions", "patch", "plugin", "scale", "replace", "options", "kustomize", "version", "config", "completion"})
err = os.MkdirAll(directory, os.ModePerm)
if err != nil {
return err
}
err = os.MkdirAll(filepath.Join(directory, yamlDir), os.ModePerm)
if err != nil {
return err
}
err = doc.GenMarkdownTree(cmd.Root(), directory)
if err != nil {
return err
}
err = doc.GenYamlTree(cmd.Root(), filepath.Join(directory, yamlDir))
if err != nil {
return err
}
fmt.Println("documentation generated successfully")
return nil
}
func removeCmds(rootCmd *cobra.Command, cmdsToRemove []string) {
// Keep track of command names to detect duplicates
encountered := make(map[string]bool)
for _, cmdName := range cmdsToRemove {
for _, cmd := range rootCmd.Commands() {
if cmd.Name() == cmdName {
rootCmd.RemoveCommand(cmd)
}
}
}
// Remove duplicates
var uniqueCmds []*cobra.Command
for _, cmd := range rootCmd.Commands() {
if encountered[cmd.Name()] {
continue
}
encountered[cmd.Name()] = true
uniqueCmds = append(uniqueCmds, cmd)
}
rootCmd.ResetCommands()
rootCmd.AddCommand(uniqueCmds...)
}