Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
kublr-api: kublr/kublr-api@1.0.1
Use kublr-api
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Authenticate with Kublr API with API endpoint, username, and password in KUBLR_ENDPOINT, KUBLR_USERNAME, and KUBLR_PASSWORD env vars correspondingly. Normally you would set these environment variables via CircleCI contexts. Resulting authentication token is stored in KUBLR_TOKEN env var.
1
2
3
4
5
6
7
8
9
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- kublr-api/auth
Authenticate with Kublr API with non-default API endpoint, username, password, and resulting token env var names passed directly.
1
2
3
4
5
6
7
8
9
10
11
12
13
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- kublr-api/auth:
kublr-endpoint: KUBLR_DEV_ENDPOINT
kublr-username: KUBLR_DEV_USERNAME
kublr-password: KUBLR_DEV_PASSWORD
kublr-token: KUBLR_DEV_TOKEN
Call Kublr API with specified HTTP method, path, and optionally input data. The method assumes that authenticaiton is already performed and the token is stored in KUBLR_TOKEN env var.
1
2
3
4
5
6
7
8
9
10
11
12
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- kublr-api/auth
- kublr-api/call:
call-method: DELETE
call-path: /api/spaces/my-space/cluster/my-cluster
Acquire Kubernetes config via Kublr API, save it in a file and configure it for use with kubectl. The method assumes that authenticaiton is already performed and the token is stored in KUBLR_TOKEN env var.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- kublr-api/auth
- kublr-api/get-cluster-config:
kublr-space: demo
kublr-cluster: aws-demo
- run: |
echo "Kubernetes config in '${KUBECONFIG:-}' file:"
cat "${KUBECONFIG:-}"
- run:
name: Setup kubectl
command: >-
curl
https://storage.googleapis.com/kubernetes-release/release/v1.10.7/bin/linux/amd64/kubectl
> kubectl && chmod a+x kubectl
- run:
name: Test kubectl with kubeconfig
command: ./kubectl get nodes
This example shows full sequence of operations with Kublr control plane: authentication, API calls (possibly including Kubernetes cluster creation, status checks, deletion etc), acquisition of Kubernetes cluster config file, and download, setup, and using kubectl tool. Authentication with Kublr API relies on the API endpoint, username, and password provided in KUBLR_ENDPOINT, KUBLR_USERNAME, and KUBLR_PASSWORD env vars correspondingly. Normally you would set these environment variables via CircleCI contexts.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- checkout
- kublr-api/auth
- run:
name: Print Kublr API token
command: echo "KUBLR_TOKEN=${KUBLR_TOKEN:-}"
- kublr-api/call:
result-env-var: KUBLR_VERSION_JSON
result-file: kublr-version.json
- run:
name: Print Kublr API call results stored in an env var
command: echo "KUBLR_VERSION_JSON=${KUBLR_VERSION_JSON:-}"
- run:
name: Print Kublr API call results stored in a file
command: cat kublr-version.json
- kublr-api/get-cluster-config:
kublr-space: demo
kublr-cluster: aws-demo
- run:
name: Print KUBECONFIG env var
command: echo "KUBECONFIG=${KUBECONFIG:-}"
- run:
name: Print Kubernetes config file content
command: |
echo "Kubernetes config in '${KUBECONFIG:-}' file:"
cat "${KUBECONFIG:-}"
- kublr-api/get-kubernetes-client:
kublr-space: demo
kublr-cluster: aws-demo
- run:
name: Run kubectl command
command: ./kubectl get nodes
Authenticate in Kublr Control Plane. Kublr endpoint, username, and password should be configuered in KUBLR_ENDPOINT, KUBLR_USERNAME, and KUBLR_PASSWORD env vars (normally configured via contexts). Kublr API authentication token will be stored in KUBLR_TOKEN environment variable, or refreshed if necessary. Optionally the names of the environment variables may be overriden in the parameters.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
kublr-endpoint | Kublr Control Plane URL (MUST NOT include trailing slash), e.g. 'https://my-kublr-kcp.my-org.com' | No | KUBLR_ENDPOINT | env_var_name |
kublr-username | Kublr Control Plane Username | No | KUBLR_USERNAME | env_var_name |
kublr-password | Kublr Control Plane Password | No | KUBLR_PASSWORD | env_var_name |
kublr-token | Kublr Control Plane Password | No | KUBLR_TOKEN | env_var_name |
insecure | Do not check ssl certificate for https requests to kublr API | No | false | boolean |
Call Kublr API given an HTTP method (GET, POST, DELETE etc), API URL path ('/api/meta/version' by default), and optionally data to send (e.g. Kublr Kubernetes JSON cluster specification document). The command relies on Kublr API authentication token available in KUBLR_TOKEN env var; you can use 'auth' command to get or refresh it.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
kublr-endpoint | Kublr Control Plane URL | No | KUBLR_ENDPOINT | env_var_name |
kublr-token | Kublr Control Plane Password | No | KUBLR_TOKEN | env_var_name |
call-method | Method to use when calling API (GET, POST, DELETE etc) | No | GET | string |
call-path | API path to call | No | /api/meta/version | string |
call-data-file | File with data to send with a call, e.g. JSON cluster spec for cluster creation call. | No | '' | string |
result-env-var | Env var to use to save result (none if empty) | No | '' | string |
result-file | File to save the result to (none if empty) | No | '' | string |
insecure | Do not check ssl certificate for https requests to kublr API | No | false | boolean |
Retrieve a kubectl config file for a Kublr Kubernetes cluster and configure it for use by kubectl tool. The config is saved in a file and KUBECONFIG environment variable is set correspondingly. The command relies on Kublr API authentication token available in KUBLR_TOKEN env var; you can use 'auth' command to get or refresh it.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
kublr-space | Kublr space name | No | default | string |
kublr-cluster | Kublr cluster name | No | '' | string |
kubeconfig-env-var | Env var for Kubernetes config path (set to empty if need not be set) | No | KUBECONFIG | env_var_name |
kubeconfig-file | File for Kubernetes config | No | config | string |
insecure | Do not check ssl certificate for https requests to kublr API | No | false | boolean |
Get current kubernetes version from kublr configuration and download a kubernetes client (kubectl) from official site. The version is saved to KUBEVER environment (by default) and download client to file "kubectl". The command relies on Kublr API authentication token available in KUBLR_TOKEN env var; you can use 'auth' command to get or refresh it.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
kublr-space | Kublr space name | No | default | string |
kublr-cluster | Kublr cluster name | No | '' | string |
kubever-env-var | Env var for Kubernetes version | No | KUBEVER | env_var_name |
kubectl-file | File for Kubernetes config | No | kubectl | string |
insecure | Do not check ssl certificate for https requests to kublr API | No | false | boolean |
Creates cluster by json spec using API.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
kublr-space | Kublr space name | No | default | string |
kublr-cluster | Kublr cluster name | No | '' | string |
kubever-env-var | Env var for Kubernetes version | No | KUBEVER | env_var_name |
kubectl-file | File for Kubernetes config | No | kubectl | string |
insecure | Do not check ssl certificate for https requests to kublr API | No | false | boolean |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
Kublr is an enterprise Kubernetes management platform that enables organizations to centrally deploy,
run, and manage Kubernetes clusters across multiple environments with a comprehensive container management
platform that finally delivers on the Kubernetes promise. Optimized for large enterprises, Kublr is
designed to provide multi-cluster deployments and observability.
Kublr Documentation - https://docs.kublr.com
display:
home_url: https://www.kublr.com
source_url: https://github.com/kublr/circleci-orbs
examples:
simple_authentication:
description: >
Authenticate with Kublr API with API endpoint, username, and password
in KUBLR_ENDPOINT, KUBLR_USERNAME, and KUBLR_PASSWORD env vars correspondingly.
Normally you would set these environment variables via CircleCI contexts.
Resulting authentication token is stored in KUBLR_TOKEN env var.
usage:
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- kublr-api/auth
parameterized_authentication:
description: >
Authenticate with Kublr API with non-default API endpoint, username, password,
and resulting token env var names passed directly.
usage:
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- kublr-api/auth:
kublr-endpoint: KUBLR_DEV_ENDPOINT
kublr-username: KUBLR_DEV_USERNAME
kublr-password: KUBLR_DEV_PASSWORD
kublr-token: KUBLR_DEV_TOKEN
api_call:
description: >
Call Kublr API with specified HTTP method, path, and optionally input data. The method assumes that
authenticaiton is already performed and the token is stored in KUBLR_TOKEN env var.
usage:
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- kublr-api/auth
- kublr-api/call:
call-method: DELETE
call-path: '/api/spaces/my-space/cluster/my-cluster'
get_and_configure_kubernetes_config:
description: >
Acquire Kubernetes config via Kublr API, save it in a file and configure it for use with kubectl.
The method assumes that authenticaiton is already performed and the token is stored in KUBLR_TOKEN env var.
usage:
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- kublr-api/auth
- kublr-api/get-cluster-config:
kublr-space: demo
kublr-cluster: aws-demo
- run: |
echo "Kubernetes config in '${KUBECONFIG:-}' file:"
cat "${KUBECONFIG:-}"
- run:
name: 'Setup kubectl'
command: 'curl https://storage.googleapis.com/kubernetes-release/release/v1.10.7/bin/linux/amd64/kubectl > kubectl && chmod a+x kubectl'
- run:
name: 'Test kubectl with kubeconfig'
command: './kubectl get nodes'
full_example:
description: >
This example shows full sequence of operations with Kublr control plane: authentication,
API calls (possibly including Kubernetes cluster creation, status checks, deletion etc),
acquisition of Kubernetes cluster config file, and download, setup, and using kubectl tool.
Authentication with Kublr API relies on the API endpoint, username, and password provided
in KUBLR_ENDPOINT, KUBLR_USERNAME, and KUBLR_PASSWORD env vars correspondingly.
Normally you would set these environment variables via CircleCI contexts.
usage:
version: 2.1
orbs:
kublr-api: kublr/kublr-api@dev
jobs:
build:
docker:
- image: circleci/node:9.9.0
steps:
- checkout
- kublr-api/auth
- run:
name: Print Kublr API token
command: 'echo "KUBLR_TOKEN=${KUBLR_TOKEN:-}"'
- kublr-api/call:
result-env-var: KUBLR_VERSION_JSON
result-file: kublr-version.json
- run:
name: Print Kublr API call results stored in an env var
command: 'echo "KUBLR_VERSION_JSON=${KUBLR_VERSION_JSON:-}"'
- run:
name: Print Kublr API call results stored in a file
command: 'cat kublr-version.json'
- kublr-api/get-cluster-config:
kublr-space: demo
kublr-cluster: aws-demo
- run:
name: Print KUBECONFIG env var
command: 'echo "KUBECONFIG=${KUBECONFIG:-}"'
- run:
name: Print Kubernetes config file content
command: |
echo "Kubernetes config in '${KUBECONFIG:-}' file:"
cat "${KUBECONFIG:-}"
- kublr-api/get-kubernetes-client:
kublr-space: demo
kublr-cluster: aws-demo
- run:
name: Run kubectl command
command: './kubectl get nodes'
commands:
auth:
description: >
Authenticate in Kublr Control Plane. Kublr endpoint, username, and password should
be configuered in KUBLR_ENDPOINT, KUBLR_USERNAME, and KUBLR_PASSWORD env vars (normally
configured via contexts). Kublr API authentication token will be stored in KUBLR_TOKEN
environment variable, or refreshed if necessary. Optionally the names of the environment
variables may be overriden in the parameters.
parameters:
kublr-endpoint:
type: env_var_name
description: Kublr Control Plane URL (MUST NOT include trailing slash), e.g. 'https://my-kublr-kcp.my-org.com'
default: KUBLR_ENDPOINT
kublr-username:
type: env_var_name
description: Kublr Control Plane Username
default: KUBLR_USERNAME
kublr-password:
type: env_var_name
description: Kublr Control Plane Password
default: KUBLR_PASSWORD
kublr-token:
type: env_var_name
description: Kublr Control Plane Password
default: KUBLR_TOKEN
insecure:
type: boolean
description: Do not check ssl certificate for https requests to kublr API
default: false
steps:
- run:
name: "Kublr authenticate"
command: |
CURL_PARAMS=''
if [ "<<parameters.insecure>>" == "true" ]; then
CURL_PARAMS='-k'
fi
if [ -n "${<<parameters.kublr-token>>:-}" ] ; then
if ! curl $CURL_PARAMS -s -f -H "Authorization: Bearer ${<<parameters.kublr-token>>:-}" "${<<parameters.kublr-endpoint>>}/api/meta/version" > /dev/null ; then
echo "Kublr token is expired, refresh"
export <<parameters.kublr-token>>=
else
echo "Kublr token is valid"
fi
fi
if [ -z "${<<parameters.kublr-token>>:-}" ] ; then
echo "Refreshing Kublr token with endpoint '${<<parameters.kublr-endpoint>>:-}' and user '${<<parameters.kublr-username>>:-}'"
KUBLR_RESPONSE="$(curl $CURL_PARAMS -s \
-d "grant_type=password" \
-d "client_id=kublr-ui" \
-d "username=${<<parameters.kublr-username>>}" \
-d "password=${<<parameters.kublr-password>>}" \
"${<<parameters.kublr-endpoint>>}/auth/realms/kublr-ui/protocol/openid-connect/token")"
export <<parameters.kublr-token>>="$(echo "${KUBLR_RESPONSE:-}" | jq -r '.access_token // empty')"
if [ -n "${<<parameters.kublr-token>>:-}" ]; then
echo "Kublr token refresh successful"
echo "export <<parameters.kublr-token>>='${<<parameters.kublr-token>>}'" >> $BASH_ENV
else
echo "Kublr token refresh failed, response: ${KUBLR_RESPONSE}"
exit 1
fi
fi
call:
description: >
Call Kublr API given an HTTP method (GET, POST, DELETE etc), API URL path ('/api/meta/version'
by default), and optionally data to send (e.g. Kublr Kubernetes JSON cluster specification
document). The command relies on Kublr API authentication token available in KUBLR_TOKEN
env var; you can use 'auth' command to get or refresh it.
parameters:
kublr-endpoint:
type: env_var_name
description: Kublr Control Plane URL
default: KUBLR_ENDPOINT
kublr-token:
type: env_var_name
description: Kublr Control Plane Password
default: KUBLR_TOKEN
call-method:
type: string
description: Method to use when calling API (GET, POST, DELETE etc)
default: GET
call-path:
type: string
description: API path to call
default: /api/meta/version
call-data-file:
type: string
description: File with data to send with a call, e.g. JSON cluster spec for cluster creation call.
default: ''
result-env-var:
type: string
description: Env var to use to save result (none if empty)
default: ''
result-file:
type: string
description: File to save the result to (none if empty)
default: ''
insecure:
type: boolean
description: Do not check ssl certificate for https requests to kublr API
default: false
steps:
- run:
name: "Kublr API call"
command: |
PARAMS=(-s -f -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: bearer '${<<parameters.kublr-token>>:-})
if [ -n './k8s/cluster-spec.json' ] ; then
PARAMS+=(--data '@<<parameters.call-data-file>>')
fi
if [ "<<parameters.insecure>>" == "true" ]; then
PARAMS+=(-k)
fi
API_URL="${<<parameters.kublr-endpoint>>}<<parameters.call-path>>"
echo "Call API URL ${API_URL}"
OUT="$(curl "${PARAMS[@]}" "-X<<parameters.call-method>>" "$API_URL")"
if [ "$?" != '0' ] ; then
echo "Kublr API call -X'<<parameters.call-method>>' '${<<parameters.kublr-endpoint>>}<<parameters.call-path>>' failed, result: ${OUT:-}"
exit 1
fi
echo "Kublr API call -X'<<parameters.call-method>>' '${<<parameters.kublr-endpoint>>}<<parameters.call-path>>' successful"
if [ -n '<<parameters.result-file>>' ] ; then
echo "Saving the result to file '<<parameters.result-file>>'"
echo "${OUT:-}" > '<<parameters.result-file>>'
fi
if [ -n '<<parameters.result-env-var>>' ] ; then
echo "Saving the result to env var '<<parameters.result-env-var>>'"
echo "export <<parameters.result-env-var>>='${OUT:-}'" >> $BASH_ENV
fi
get-cluster-config:
description: >
Retrieve a kubectl config file for a Kublr Kubernetes cluster and configure it for
use by kubectl tool. The config is saved in a file and KUBECONFIG environment variable
is set correspondingly. The command relies on Kublr API authentication token available
in KUBLR_TOKEN env var; you can use 'auth' command to get or refresh it.
parameters:
kublr-space:
type: string
description: Kublr space name
default: 'default'
kublr-cluster:
type: string
description: Kublr cluster name
default: ''
kubeconfig-env-var:
type: env_var_name
description: Env var for Kubernetes config path (set to empty if need not be set)
default: 'KUBECONFIG'
kubeconfig-file:
type: string
description: File for Kubernetes config
default: 'config'
insecure:
type: boolean
description: Do not check ssl certificate for https requests to kublr API
default: false
steps:
- call:
call-path: '/api/spaces/<<parameters.kublr-space>>/cluster/<<parameters.kublr-cluster>>/config'
result-file: '<<parameters.kubeconfig-file>>'
insecure: '<<parameters.insecure>>'
- run:
name: Configure Kubernetes Config file
command: |
if [ -n '<<parameters.kubeconfig-env-var>>' ] ; then
export <<parameters.kubeconfig-env-var>>="$(readlink -f '<<parameters.kubeconfig-file>>')"
echo "Setting env var '<<parameters.kubeconfig-env-var>>' to '${<<parameters.kubeconfig-env-var>>:-}'"
echo "export <<parameters.kubeconfig-env-var>>='${<<parameters.kubeconfig-env-var>>:-}'" >> $BASH_ENV
fi
get-kubernetes-client:
description: >
Get current kubernetes version from kublr configuration and download a kubernetes client (kubectl) from official
site. The version is saved to KUBEVER environment (by default) and download client to file "kubectl". The command
relies on Kublr API authentication token available in KUBLR_TOKEN env var; you can use 'auth' command to get
or refresh it.
parameters:
kublr-space:
type: string
description: Kublr space name
default: 'default'
kublr-cluster:
type: string
description: Kublr cluster name
default: ''
kubever-env-var:
type: env_var_name
description: Env var for Kubernetes version
default: 'KUBEVER'
kubectl-file:
type: string
description: File for Kubernetes config
default: 'kubectl'
insecure:
type: boolean
description: Do not check ssl certificate for https requests to kublr API
default: false
steps:
- call:
call-path: '/api/spaces/<<parameters.kublr-space>>/cluster/<<parameters.kublr-cluster>>/proxy/version'
result-env-var: 'KUBEVER_RESP'
insecure: <<parameters.insecure>>
- run:
name: Download kubernetes client
command: |
if [ -n '<<parameters.kubever-env-var>>' ] ; then
export <<parameters.kubever-env-var>>="$(echo $KUBEVER_RESP | jq -r '.gitVersion')"
echo "Setting env var '<<parameters.kubever-env-var>>' to '${<<parameters.kubever-env-var>>:-}'"
echo "export <<parameters.kubever-env-var>>='${<<parameters.kubever-env-var>>:-}'" >> $BASH_ENV
fi
curl "https://storage.googleapis.com/kubernetes-release/release/${<<parameters.kubever-env-var>>}/bin/linux/amd64/kubectl" \
-o "<<parameters.kubectl-file>>"
if [ "$?" != '0' ] ; then
echo "Kublr client download failed"
exit 1
fi
chmod a+x "<<parameters.kubectl-file>>"
create-cluster:
description: >
Creates cluster by json spec using API.
parameters:
kublr-space:
type: string
description: Kublr space name
default: 'default'
kublr-cluster:
type: string
description: Kublr cluster name
default: ''
kubever-env-var:
type: env_var_name
description: Env var for Kubernetes version
default: 'KUBEVER'
kubectl-file:
type: string
description: File for Kubernetes config
default: 'kubectl'
insecure:
type: boolean
description: Do not check ssl certificate for https requests to kublr API
default: false
steps:
- call:
call-path: '/api/spaces/<<parameters.kublr-space>>/cluster/<<parameters.kublr-cluster>>/proxy/version'
result-env-var: 'KUBEVER_RESP'
insecure: <<parameters.insecure>>
- run:
name: Download kubernetes client
command: |
if [ -n '<<parameters.kubever-env-var>>' ] ; then
export <<parameters.kubever-env-var>>="$(echo $KUBEVER_RESP | jq -r '.gitVersion')"
echo "Setting env var '<<parameters.kubever-env-var>>' to '${<<parameters.kubever-env-var>>:-}'"
echo "export <<parameters.kubever-env-var>>='${<<parameters.kubever-env-var>>:-}'" >> $BASH_ENV
fi
curl "https://storage.googleapis.com/kubernetes-release/release/${<<parameters.kubever-env-var>>}/bin/linux/amd64/kubectl" \
-o "<<parameters.kubectl-file>>"
if [ "$?" != '0' ] ; then
echo "Kublr client download failed"
exit 1
fi
chmod a+x kubectl