22//
33// * operators/operator_sdk/osdk-installing-cli.adoc
44
5+ :osdk_ver: latest
6+
57[id="osdk-installing-cli-linux-macos_{context}"]
68= Installing the Operator SDK CLI on Linux or macOS
79
@@ -19,15 +21,15 @@ endif::[]
1921
2022.Procedure
2123
22- . Navigate to the link:https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/operator-sdk/4.7.0 /[OpenShift mirror site].
24+ . Navigate to the link:https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/operator-sdk/{osdk_ver} /[OpenShift mirror site].
2325
24- . From the `4.7.0/ ` directory, download the latest version of the tarball that matches your operating system. Linux tarballs have a `-linux.tar.gz` suffix, and macOS tarballs have a `-darwin.tar.gz` suffix.
26+ . From the `{osdk_ver} ` directory, download the latest version of the tarball that matches your operating system. Linux tarballs have a `-linux.tar.gz` suffix, and macOS tarballs have a `-darwin.tar.gz` suffix.
2527
2628. Unpack the archive:
2729+
28- [source,terminal]
30+ [source,terminal,subs="attributes+" ]
2931----
30- $ tar xvzf operator-sdk-<version> -<os>.tar.gz
32+ $ tar xvf operator-sdk-v1.3.0-ocp -<os>.tar.gz
3133----
3234
3335. Make the file executable:
@@ -61,237 +63,4 @@ $ sudo mv operator-sdk-<release_version>-x86_64-linux-gnu /usr/local/bin/operato
6163$ operator-sdk version
6264----
6365
64- ////
65- . Set the release version variable:
66- +
67- [source,terminal]
68- ----
69- $ RELEASE_VERSION=v0.19.4
70- ----
71-
72- . Download the release binary.
73- +
74- --
75- * For Linux:
76- +
77- [source,terminal]
78- ----
79- $ curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
80- ----
81-
82- * For macOS:
83- +
84- [source,terminal]
85- ----
86- $ curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin
87- ----
88- --
89-
90- . Verify the downloaded release binary.
91-
92- .. Download the provided `.asc` file.
93- +
94- --
95- * For Linux:
96- +
97- [source,terminal]
98- ----
99- $ curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu.asc
100- ----
101-
102- * For macOS:
103- +
104- [source,terminal]
105- ----
106- $ curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin.asc
107- ----
108- --
109-
110- .. Place the binary and corresponding `.asc` file into the same directory and run the following command to verify the binary:
111- +
112- --
113- * For Linux:
114- +
115- [source,terminal]
116- ----
117- $ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu.asc
118- ----
119-
120- * For macOS:
121- +
122- [source,terminal]
123- ----
124- $ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin.asc
125- ----
126- --
127- +
128- If you do not have the public key of the maintainer on your workstation, you will get the following error:
129- +
130- .Example output with error
131- [source,terminal]
132- ----
133- $ gpg: assuming signed data in 'operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin'
134- $ gpg: Signature made Fri Apr 5 20:03:22 2019 CEST
135- $ gpg: using RSA key <key_id> <1>
136- $ gpg: Can't check signature: No public key
137- ----
138- <1> RSA key string.
139- +
140- To download the key, run the following command, replacing `<key_id>` with the RSA key string provided in the output of the previous command:
141- +
142- [source,terminal]
143- ----
144- $ gpg [--keyserver keys.gnupg.net] --recv-key "<key_id>" <1>
145- ----
146- <1> If you do not have a key server configured, specify one with the `--keyserver` option.
147-
148- . Install the release binary in your `PATH`:
149- +
150- --
151- * For Linux:
152- +
153- [source,terminal]
154- ----
155- $ chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
156- ----
157- +
158- [source,terminal]
159- ----
160- $ sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk
161- ----
162- +
163- [source,terminal]
164- ----
165- $ rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
166- ----
167-
168- * For macOS:
169- +
170- [source,terminal]
171- ----
172- $ chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin
173- ----
174- +
175- [source,terminal]
176- ----
177- $ sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin /usr/local/bin/operator-sdk
178- ----
179- +
180- [source,terminal]
181- ----
182- $ rm operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin
183- ----
184- --
185-
186- . Verify that the CLI tool was installed correctly:
187- +
188- [source,terminal]
189- ----
190- $ operator-sdk version
191- ----
192-
193- [id="osdk-installing-cli-homebrew_{context}"]
194- == Installing from Homebrew
195-
196- You can install the SDK CLI using Homebrew.
197-
198- .Prerequisites
199-
200- - link:https://brew.sh/[Homebrew]
201- ifdef::openshift-origin[]
202- - link:https://docs.docker.com/install/[`docker`] v17.03+, link:https://github.com/containers/libpod/blob/master/install.md[`podman`] v1.2.0+, or link:https://github.com/containers/buildah/blob/master/install.md[`buildah`] v1.7+
203- endif::[]
204- ifndef::openshift-origin[]
205- - `docker` v17.03+, `podman` v1.9.3+, or `buildah` v1.7+
206- endif::[]
207- - OpenShift CLI (`oc`) v{product-version}+ installed
208- - Access to a cluster based on Kubernetes v1.12.0+
209- - Access to a container registry
210-
211- .Procedure
212-
213- . Install the SDK CLI using the `brew` command:
214- +
215- [source,terminal]
216- ----
217- $ brew install operator-sdk
218- ----
219-
220- . Verify that the CLI tool was installed correctly:
221- +
222- [source,terminal]
223- ----
224- $ operator-sdk version
225- ----
226-
227- [id="osdk-installing-cli-source_{context}"]
228- == Compiling and installing from source
229-
230- You can obtain the Operator SDK source code to compile and install the SDK CLI.
231-
232- .Prerequisites
233-
234- - link:https://git-scm.com/downloads[Git]
235- - link:https://golang.org/dl/[Go] v1.13+
236- ifdef::openshift-origin[]
237- - link:https://docs.docker.com/install/[`docker`] v17.03+, link:https://github.com/containers/libpod/blob/master/install.md[`podman`] v1.2.0+, or link:https://github.com/containers/buildah/blob/master/install.md[`buildah`] v1.7+
238- endif::[]
239- ifndef::openshift-origin[]
240- - `docker` v17.03+, `podman` v1.9.3+, or `buildah` v1.7+
241- endif::[]
242- - OpenShift CLI (`oc`) v{product-version}+ installed
243- - Access to a cluster based on Kubernetes v1.12.0+
244- - Access to a container registry
245-
246- .Procedure
247-
248- . Clone the `operator-sdk` repository:
249- +
250- [source,terminal]
251- ----
252- $ mkdir -p $GOPATH/src/github.com/operator-framework
253- ----
254- +
255- [source,terminal]
256- ----
257- $ cd $GOPATH/src/github.com/operator-framework
258- ----
259- +
260- [source,terminal]
261- ----
262- $ git clone https://github.com/operator-framework/operator-sdk
263- ----
264- +
265- [source,terminal]
266- ----
267- $ cd operator-sdk
268- ----
269-
270- . Check out the desired release branch:
271- +
272- [source,terminal]
273- ----
274- $ git checkout master
275- ----
276-
277- . Compile and install the SDK CLI:
278- +
279- [source,terminal]
280- ----
281- $ make dep
282- ----
283- +
284- [source,terminal]
285- ----
286- $ make install
287- ----
288- +
289- This installs the CLI binary `operator-sdk` at *_$GOPATH/bin_*.
290-
291- . Verify that the CLI tool was installed correctly:
292- +
293- [source,terminal]
294- ----
295- $ operator-sdk version
296- ----
297- ////
66+ :!osdk_ver:
0 commit comments