Skip to content

Commit bc2b4e3

Browse files
committed
OSDOCS-241: Initial CLI reference docs for dev commands
1 parent 0b6aa8d commit bc2b4e3

11 files changed

+733
-0
lines changed

_topic_map.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,10 @@ Topics:
398398
File: efk-logging-exported-fields
399399
- Name: Uninstalling the EFK stack
400400
File: efk-logging-uninstall
401+
---
402+
Name: CLI reference
403+
Dir: cli_reference
404+
Distros: openshift-*
405+
Topics:
406+
- Name: Developer CLI commands
407+
File: developer-cli-commands
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[id='cli-developer-commands']
2+
= Developer CLI commands
3+
include::modules/common-attributes.adoc[]
4+
:context: cli-developer-commands
5+
6+
toc::[]
7+
8+
// Basic CLI commands
9+
include::modules/cli-developer-basic.adoc[leveloffset=+1]
10+
11+
// Build and deploy CLI commands
12+
include::modules/cli-developer-build-deploy.adoc[leveloffset=+1]
13+
14+
// Application management CLI commands
15+
include::modules/cli-developer-application-management.adoc[leveloffset=+1]
16+
17+
// Troubleshooting and debugging CLI commands
18+
include::modules/cli-developer-troubleshooting.adoc[leveloffset=+1]
19+
20+
// Advanced developer CLI commands
21+
include::modules/cli-developer-advanced.adoc[leveloffset=+1]
22+
23+
// Settings CLI commands
24+
include::modules/cli-developer-settings.adoc[leveloffset=+1]
25+
26+
// Other developer CLI commands
27+
include::modules/cli-developer-other.adoc[leveloffset=+1]

cli_reference/images

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../images

cli_reference/modules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../modules

modules/cli-developer-advanced.adoc

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * cli_reference/developer-cli-commands.adoc
4+
5+
[id='cli-advanced-developer-commands-{context}']
6+
= Advanced developer CLI commands
7+
8+
== api-resources
9+
10+
Display the full list of API resources that the server supports.
11+
12+
.Example: List the supported API resources
13+
----
14+
$ oc api-resources
15+
----
16+
17+
== api-versions
18+
19+
Display the full list of API versions that the server supports.
20+
21+
.Example: List the supported API versions
22+
----
23+
$ oc api-versions
24+
----
25+
26+
== auth
27+
28+
Inspect permissions and reconcile RBAC roles.
29+
30+
.Example: Check whether the current user can read Pod logs
31+
----
32+
$ oc auth can-i get pods --subresource=log
33+
----
34+
35+
.Example: Reconcile RBAC roles and permissions from a file
36+
----
37+
$ oc auth reconcile -f policy.json
38+
----
39+
40+
== cluster-info
41+
42+
Display the address of the master and cluster services.
43+
44+
.Example: Display cluster information
45+
----
46+
$ oc cluster-info
47+
----
48+
49+
== convert
50+
51+
Convert a YAML or JSON configuration file to a different API version and print
52+
to standard output (stdout).
53+
54+
.Example: Convert `pod.yaml` to the latest version
55+
----
56+
$ oc convert -f pod.yaml
57+
----
58+
59+
== extract
60+
61+
Extract the contents of a ConfigMap or secret. Each key in the ConfigMap or
62+
secret is created as a separate file with the name of the key.
63+
64+
.Example: Download the contents of the `ruby-1-ca` ConfigMap to the current directory
65+
----
66+
$ oc extract configmap/ruby-1-ca
67+
----
68+
69+
.Example: Print the contents of the `ruby-1-ca` ConfigMap to stdout
70+
----
71+
$ oc extract configmap/ruby-1-ca --to=-
72+
----
73+
74+
== idle
75+
76+
Idle scalable resources. An idled Service will automatically become unidled when
77+
it receives traffic or it can be manually unidled using the `oc scale` command.
78+
79+
.Example: Idle the `ruby-app` Service
80+
----
81+
$ oc idle ruby-app
82+
----
83+
84+
== image
85+
86+
Manage images in your {product-title} cluster.
87+
88+
.Example: Copy an image to another tag
89+
----
90+
$ oc image mirror myregistry.com/myimage:latest myregistry.com/myimage:stable
91+
----
92+
93+
== observe
94+
95+
Observe changes to resources and take action on them.
96+
97+
.Example: Observe changes to Services
98+
----
99+
$ oc observe services
100+
----
101+
102+
== patch
103+
104+
Updates one or more fields of an object using strategic merge patch in JSON or
105+
YAML format.
106+
107+
.Example: Update the `spec.unschedulable` field for node `node1` to `true`
108+
----
109+
$ oc patch node/node1 -p '{"spec":{"unschedulable":true}}'
110+
----
111+
112+
== policy
113+
114+
Manage authorization policies.
115+
116+
.Example: Add the `edit` role to `user1` for the current project
117+
----
118+
$ oc policy add-role-to-user edit user1
119+
----
120+
121+
== process
122+
123+
Process a template into a list of resources.
124+
125+
.Example: Convert `template.json` to a resource list and pass to `oc create`
126+
----
127+
$ oc process -f template.json | oc create -f -
128+
----
129+
130+
== registry
131+
132+
Manage the integrated registry on {product-title}.
133+
134+
.Example: Display information about the integrated registry
135+
----
136+
$ oc registry info
137+
----
138+
139+
== replace
140+
141+
Modify an existing object based on the contents of the specified configuration
142+
file.
143+
144+
.Example: Update a Pod using the content in `pod.json`
145+
----
146+
$ oc replace -f pod.json
147+
----
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * cli_reference/developer-cli-commands.adoc
4+
5+
[id='cli-application-management-commands-{context}']
6+
= Application management CLI commands
7+
8+
== annotate
9+
10+
Update the annotations on one or more resources.
11+
12+
.Example: Add an annotation to a Route
13+
----
14+
$ oc annotate route/test-route haproxy.router.openshift.io/ip_whitelist="192.168.1.10"
15+
----
16+
17+
.Example: Remove the annotation from the Route
18+
----
19+
$ oc annotate route/test-route haproxy.router.openshift.io/ip_whitelist-
20+
----
21+
22+
== apply
23+
24+
Apply a configuration to a resource by file name or standard in (stdin) in JSON
25+
or YAML format.
26+
27+
.Example: Apply the configuration in `pod.json` to a Pod
28+
----
29+
$ oc apply -f pod.json
30+
----
31+
32+
== autoscale
33+
34+
Autoscale a DeploymentConfig or ReplicationController.
35+
36+
.Example: Autoscale to a minimum of two and maximum of five Pods
37+
----
38+
$ oc autoscale deploymentconfig/parksmap-katacoda --min=2 --max=5
39+
----
40+
41+
== create
42+
43+
Create a resource by file name or standard in (stdin) in JSON or YAML format.
44+
45+
.Example: Create a Pod using the content in `pod.json`
46+
----
47+
$ oc create -f pod.json
48+
----
49+
50+
== delete
51+
52+
Delete a resource.
53+
54+
.Example: Delete a Pod named `parksmap-katacoda-1-qfqz4`
55+
----
56+
$ oc delete pod/parksmap-katacoda-1-qfqz4
57+
----
58+
59+
.Example: Delete all Pods with the `app=parksmap-katacoda` label
60+
----
61+
$ oc delete pods -l app=parksmap-katacoda
62+
----
63+
64+
== describe
65+
66+
Return detailed information about a specific object.
67+
68+
.Example: Describe a Deployment named `example`
69+
----
70+
$ oc describe deployment/example
71+
----
72+
73+
.Example: Describe all Pods
74+
----
75+
$ oc describe pods
76+
----
77+
78+
== edit
79+
80+
Edit a resource.
81+
82+
.Example: Edit a DeploymentConfig using the default editor
83+
----
84+
$ oc edit deploymentconfig/parksmap-katacoda
85+
----
86+
87+
.Example: Edit a DeploymentConfig using a different editor
88+
----
89+
$ OC_EDITOR="nano" oc edit deploymentconfig/parksmap-katacoda
90+
----
91+
92+
.Example: Edit a DeploymentConfig in JSON format
93+
----
94+
$ oc edit deploymentconfig/parksmap-katacoda -o json
95+
----
96+
97+
== expose
98+
99+
Expose a Service externally as a Route.
100+
101+
.Example: Expose a Service
102+
----
103+
$ oc expose service/parksmap-katacoda
104+
----
105+
106+
.Example: Expose a Service and specify the host name
107+
----
108+
$ oc expose service/parksmap-katacoda --hostname=www.my-host.com
109+
----
110+
111+
== get
112+
113+
Display one or more resources.
114+
115+
.Example: List Pods in the `default` namespace
116+
----
117+
$ oc get pods -n default
118+
----
119+
120+
.Example: Get details about the `python` DeploymentConfig in JSON format
121+
----
122+
$ oc get deploymentconfig/python -o json
123+
----
124+
125+
== label
126+
127+
Update the labels on one or more resources.
128+
129+
.Example: Update the `python-1-mz2rf` Pod with the label `status` set to `unhealthy`
130+
----
131+
$ oc label pod/python-1-mz2rf status=unhealthy
132+
----
133+
134+
== scale
135+
136+
Set the desired number of replicas for a ReplicationController or a
137+
DeploymentConfig.
138+
139+
.Example: Scale the `ruby-app` DeploymentConfig to three Pods
140+
----
141+
$ oc scale deploymentconfig/ruby-app --replicas=3
142+
----
143+
144+
== secrets
145+
146+
Manage secrets in your project.
147+
148+
.Example: Allow `my-pull-secret` to be used as an image pull secret by the `default` service account
149+
----
150+
$ oc secrets link default my-pull-secret --for=pull
151+
----
152+
153+
== serviceaccounts
154+
155+
Get a token assigned to a service account or create a new token or `kubeconfig`
156+
file for a service account.
157+
158+
.Example: Get the token assigned to the `default` service account
159+
----
160+
$ oc serviceaccounts get-token default
161+
----
162+
163+
== set
164+
165+
Configure existing application resources.
166+
167+
.Example: Sets the name of a secret on a BuildConfig
168+
----
169+
$ oc set build-secret --source buildconfig/mybc mysecret
170+
----

0 commit comments

Comments
 (0)