Skip to content

Commit ba323e7

Browse files
authored
Merge pull request #40656 from bergerhoffer/OSDOCS-2906
OSDOCS-2906: Initial run of generating CLI docs for 4.10
2 parents b47f09e + f73fcfc commit ba323e7

File tree

2 files changed

+52
-305
lines changed

2 files changed

+52
-305
lines changed

modules/oc-adm-by-example-content.adoc

Lines changed: 24 additions & 284 deletions
Original file line numberDiff line numberDiff line change
@@ -78,281 +78,6 @@ Deny a certificate signing request
7878

7979

8080

81-
== oc adm completion
82-
Output shell completion code for the specified shell (bash or zsh)
83-
84-
.Example usage
85-
[source,bash,options="nowrap"]
86-
----
87-
# Installing bash completion on macOS using homebrew
88-
## If running Bash 3.2 included with macOS
89-
brew install bash-completion
90-
## or, if running Bash 4.1+
91-
brew install bash-completion@2
92-
## If oc is installed via homebrew, this should start working immediately
93-
## If you've installed via other means, you may need add the completion to your completion directory
94-
oc completion bash > $(brew --prefix)/etc/bash_completion.d/oc
95-
96-
97-
# Installing bash completion on Linux
98-
## If bash-completion is not installed on Linux, install the 'bash-completion' package
99-
## via your distribution's package manager.
100-
## Load the oc completion code for bash into the current shell
101-
source <(oc completion bash)
102-
## Write bash completion code to a file and source it from .bash_profile
103-
oc completion bash > ~/.kube/completion.bash.inc
104-
printf "
105-
# Kubectl shell completion
106-
source '$HOME/.kube/completion.bash.inc'
107-
" >> $HOME/.bash_profile
108-
source $HOME/.bash_profile
109-
110-
# Load the oc completion code for zsh[1] into the current shell
111-
source <(oc completion zsh)
112-
# Set the oc completion code for zsh[1] to autoload on startup
113-
oc completion zsh > "${fpath[1]}/_oc"
114-
----
115-
116-
117-
118-
== oc adm config current-context
119-
Display the current-context
120-
121-
.Example usage
122-
[source,bash,options="nowrap"]
123-
----
124-
# Display the current-context
125-
oc config current-context
126-
----
127-
128-
129-
130-
== oc adm config delete-cluster
131-
Delete the specified cluster from the kubeconfig
132-
133-
.Example usage
134-
[source,bash,options="nowrap"]
135-
----
136-
# Delete the minikube cluster
137-
oc config delete-cluster minikube
138-
----
139-
140-
141-
142-
== oc adm config delete-context
143-
Delete the specified context from the kubeconfig
144-
145-
.Example usage
146-
[source,bash,options="nowrap"]
147-
----
148-
# Delete the context for the minikube cluster
149-
oc config delete-context minikube
150-
----
151-
152-
153-
154-
== oc adm config delete-user
155-
Delete the specified user from the kubeconfig
156-
157-
.Example usage
158-
[source,bash,options="nowrap"]
159-
----
160-
# Delete the minikube user
161-
oc config delete-user minikube
162-
----
163-
164-
165-
166-
== oc adm config get-clusters
167-
Display clusters defined in the kubeconfig
168-
169-
.Example usage
170-
[source,bash,options="nowrap"]
171-
----
172-
# List the clusters that oc knows about
173-
oc config get-clusters
174-
----
175-
176-
177-
178-
== oc adm config get-contexts
179-
Describe one or many contexts
180-
181-
.Example usage
182-
[source,bash,options="nowrap"]
183-
----
184-
# List all the contexts in your kubeconfig file
185-
oc config get-contexts
186-
187-
# Describe one context in your kubeconfig file
188-
oc config get-contexts my-context
189-
----
190-
191-
192-
193-
== oc adm config get-users
194-
Display users defined in the kubeconfig
195-
196-
.Example usage
197-
[source,bash,options="nowrap"]
198-
----
199-
# List the users that oc knows about
200-
oc config get-users
201-
----
202-
203-
204-
205-
== oc adm config rename-context
206-
Rename a context from the kubeconfig file
207-
208-
.Example usage
209-
[source,bash,options="nowrap"]
210-
----
211-
# Rename the context 'old-name' to 'new-name' in your kubeconfig file
212-
oc config rename-context old-name new-name
213-
----
214-
215-
216-
217-
== oc adm config set
218-
Set an individual value in a kubeconfig file
219-
220-
.Example usage
221-
[source,bash,options="nowrap"]
222-
----
223-
# Set the server field on the my-cluster cluster to https://1.2.3.4
224-
oc config set clusters.my-cluster.server https://1.2.3.4
225-
226-
# Set the certificate-authority-data field on the my-cluster cluster
227-
oc config set clusters.my-cluster.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
228-
229-
# Set the cluster field in the my-context context to my-cluster
230-
oc config set contexts.my-context.cluster my-cluster
231-
232-
# Set the client-key-data field in the cluster-admin user using --set-raw-bytes option
233-
oc config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true
234-
----
235-
236-
237-
238-
== oc adm config set-cluster
239-
Set a cluster entry in kubeconfig
240-
241-
.Example usage
242-
[source,bash,options="nowrap"]
243-
----
244-
# Set only the server field on the e2e cluster entry without touching other values
245-
oc config set-cluster e2e --server=https://1.2.3.4
246-
247-
# Embed certificate authority data for the e2e cluster entry
248-
oc config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
249-
250-
# Disable cert checking for the dev cluster entry
251-
oc config set-cluster e2e --insecure-skip-tls-verify=true
252-
253-
# Set custom TLS server name to use for validation for the e2e cluster entry
254-
oc config set-cluster e2e --tls-server-name=my-cluster-name
255-
----
256-
257-
258-
259-
== oc adm config set-context
260-
Set a context entry in kubeconfig
261-
262-
.Example usage
263-
[source,bash,options="nowrap"]
264-
----
265-
# Set the user field on the gce context entry without touching other values
266-
oc config set-context gce --user=cluster-admin
267-
----
268-
269-
270-
271-
== oc adm config set-credentials
272-
Set a user entry in kubeconfig
273-
274-
.Example usage
275-
[source,bash,options="nowrap"]
276-
----
277-
# Set only the "client-key" field on the "cluster-admin"
278-
# entry, without touching other values
279-
oc config set-credentials cluster-admin --client-key=~/.kube/admin.key
280-
281-
# Set basic auth for the "cluster-admin" entry
282-
oc config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
283-
284-
# Embed client certificate data in the "cluster-admin" entry
285-
oc config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true
286-
287-
# Enable the Google Compute Platform auth provider for the "cluster-admin" entry
288-
oc config set-credentials cluster-admin --auth-provider=gcp
289-
290-
# Enable the OpenID Connect auth provider for the "cluster-admin" entry with additional args
291-
oc config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar
292-
293-
# Remove the "client-secret" config value for the OpenID Connect auth provider for the "cluster-admin" entry
294-
oc config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-
295-
296-
# Enable new exec auth plugin for the "cluster-admin" entry
297-
oc config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1
298-
299-
# Define new exec auth plugin args for the "cluster-admin" entry
300-
oc config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2
301-
302-
# Create or update exec auth plugin environment variables for the "cluster-admin" entry
303-
oc config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2
304-
305-
# Remove exec auth plugin environment variables for the "cluster-admin" entry
306-
oc config set-credentials cluster-admin --exec-env=var-to-remove-
307-
----
308-
309-
310-
311-
== oc adm config unset
312-
Unset an individual value in a kubeconfig file
313-
314-
.Example usage
315-
[source,bash,options="nowrap"]
316-
----
317-
# Unset the current-context
318-
oc config unset current-context
319-
320-
# Unset namespace in foo context
321-
oc config unset contexts.foo.namespace
322-
----
323-
324-
325-
326-
== oc adm config use-context
327-
Set the current-context in a kubeconfig file
328-
329-
.Example usage
330-
[source,bash,options="nowrap"]
331-
----
332-
# Use the context for the minikube cluster
333-
oc config use-context minikube
334-
----
335-
336-
337-
338-
== oc adm config view
339-
Display merged kubeconfig settings or a specified kubeconfig file
340-
341-
.Example usage
342-
[source,bash,options="nowrap"]
343-
----
344-
# Show merged kubeconfig settings
345-
oc config view
346-
347-
# Show merged kubeconfig settings and raw certificate data
348-
oc config view --raw
349-
350-
# Get the password for the e2e user
351-
oc config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
352-
----
353-
354-
355-
35681
== oc adm cordon
35782
Mark node as unschedulable
35883

@@ -660,10 +385,10 @@ Add a role to users or service accounts for the current project
660385
[source,bash,options="nowrap"]
661386
----
662387
# Add the 'view' role to user1 for the current project
663-
oc policy add-role-to-user view user1
388+
oc adm policy add-role-to-user view user1
664389
665390
# Add the 'edit' role to serviceaccount1 for the current project
666-
oc policy add-role-to-user edit -z serviceaccount1
391+
oc adm policy add-role-to-user edit -z serviceaccount1
667392
----
668393

669394

@@ -703,16 +428,16 @@ Check which service account can create a pod
703428
----
704429
# Check whether service accounts sa1 and sa2 can admit a pod with a template pod spec specified in my_resource.yaml
705430
# Service Account specified in myresource.yaml file is ignored
706-
oc policy scc-review -z sa1,sa2 -f my_resource.yaml
431+
oc adm policy scc-review -z sa1,sa2 -f my_resource.yaml
707432
708433
# Check whether service accounts system:serviceaccount:bob:default can admit a pod with a template pod spec specified in my_resource.yaml
709-
oc policy scc-review -z system:serviceaccount:bob:default -f my_resource.yaml
434+
oc adm policy scc-review -z system:serviceaccount:bob:default -f my_resource.yaml
710435
711436
# Check whether the service account specified in my_resource_with_sa.yaml can admit the pod
712-
oc policy scc-review -f my_resource_with_sa.yaml
437+
oc adm policy scc-review -f my_resource_with_sa.yaml
713438
714439
# Check whether the default service account can admit the pod; default is taken since no service account is defined in myresource_with_no_sa.yaml
715-
oc policy scc-review -f myresource_with_no_sa.yaml
440+
oc adm policy scc-review -f myresource_with_no_sa.yaml
716441
----
717442

718443

@@ -724,13 +449,13 @@ Check whether a user or a service account can create a pod
724449
[source,bash,options="nowrap"]
725450
----
726451
# Check whether user bob can create a pod specified in myresource.yaml
727-
oc policy scc-subject-review -u bob -f myresource.yaml
452+
oc adm policy scc-subject-review -u bob -f myresource.yaml
728453
729454
# Check whether user bob who belongs to projectAdmin group can create a pod specified in myresource.yaml
730-
oc policy scc-subject-review -u bob -g projectAdmin -f myresource.yaml
455+
oc adm policy scc-subject-review -u bob -g projectAdmin -f myresource.yaml
731456
732457
# Check whether a service account specified in the pod template spec in myresourcewithsa.yaml can create the pod
733-
oc policy scc-subject-review -f myresourcewithsa.yaml
458+
oc adm policy scc-subject-review -f myresourcewithsa.yaml
734459
----
735460

736461

@@ -1000,6 +725,21 @@ Mark node as schedulable
1000725

1001726

1002727

728+
== oc adm upgrade
729+
Upgrade a cluster
730+
731+
.Example usage
732+
[source,bash,options="nowrap"]
733+
----
734+
# Review the available cluster updates
735+
oc adm upgrade
736+
737+
# Update to the latest version
738+
oc adm upgrade --to-latest=true
739+
----
740+
741+
742+
1003743
== oc adm verify-image-signature
1004744
Verify the image identity contained in the image signature
1005745

0 commit comments

Comments
 (0)