@@ -29,7 +29,7 @@ async function time(fn) {
29
29
await fn ( ) ;
30
30
const end = Date . now ( ) ;
31
31
green ( `
32
- Done in ${ ( end - start ) / 1000 } s
32
+ Done in ${ ( end - start ) / 1000 } s
33
33
` ) ;
34
34
}
35
35
@@ -70,9 +70,9 @@ green("Starting k3d cluster with APIM dependencies...");
70
70
71
71
blue ( `
72
72
73
- Installing the latest version of k3d (if not present) ...
73
+ ☸ Installing the latest version of k3d (if not present) ...
74
74
75
- See https://k3d.io/
75
+ See https://k3d.io/
76
76
` ) ;
77
77
78
78
await time ( installK3d ) ;
@@ -87,7 +87,7 @@ async function installK3d() {
87
87
88
88
blue ( `
89
89
90
- Initializing a local docker images registry for k3d images (if not present) ...
90
+ 🐳 Initializing a local docker images registry for k3d images (if not present) ...
91
91
` ) ;
92
92
93
93
await time ( initRegistry ) ;
@@ -98,13 +98,13 @@ async function initRegistry() {
98
98
99
99
magenta ( `
100
100
101
- K3d images registry ${ K3D_IMAGES_REGISTRY_NAME } already exists, skipping.
102
- ` ) ;
101
+ K3d images registry ${ K3D_IMAGES_REGISTRY_NAME } already exists, skipping.
102
+ ` ) ;
103
103
} catch ( error ) {
104
104
magenta ( `
105
105
106
- Initializing registry ${ K3D_IMAGES_REGISTRY_NAME }
107
- ` ) ;
106
+ Initializing registry ${ K3D_IMAGES_REGISTRY_NAME }
107
+ ` ) ;
108
108
109
109
await $ `k3d registry create ${ K3D_IMAGES_REGISTRY_NAME } --port ${ K3D_IMAGES_REGISTRY_PORT } ` ;
110
110
}
@@ -114,54 +114,34 @@ async function initRegistry() {
114
114
115
115
yellow ( `
116
116
117
- /!\ Warning /!\
117
+ ⚠️ WARNING ⚠️
118
118
119
- Assuming that host "${ K3D_IMAGES_REGISTRY_NAME } " points to 127.0.0.1
119
+ Assuming that host "${ K3D_IMAGES_REGISTRY_NAME } " points to 127.0.0.1
120
120
121
- You might need to edit your /etc/hosts file before going further.
121
+ You might need to edit your /etc/hosts file before going further.
122
122
` ) ;
123
123
124
124
await time ( initCluster ) ;
125
125
126
126
async function initCluster ( ) {
127
127
blue ( `
128
128
129
- Deleting K3d cluster ${ K3D_CLUSTER_NAME } (if present) ...
129
+ ☸ Deleting K3d cluster ${ K3D_CLUSTER_NAME } (if present) ...
130
130
` ) ;
131
131
132
- try {
133
- magenta ( `
134
-
135
- K3d images registry ${ K3D_IMAGES_REGISTRY_NAME } already exists, skipping.
136
- ` ) ;
137
-
138
- await $ `k3d registry list | grep -q "${ K3D_IMAGES_REGISTRY_NAME } "` ;
139
- } catch ( error ) {
140
- magenta ( `
141
-
142
- Initializing registry ${ K3D_IMAGES_REGISTRY_NAME }
143
- ` ) ;
144
-
145
- await $ `k3d registry create ${ K3D_IMAGES_REGISTRY_NAME } --port ${ K3D_IMAGES_REGISTRY_PORT } ` ;
146
- }
147
-
148
132
try {
149
133
await $ `k3d cluster list| grep -q "${ K3D_CLUSTER_NAME } "` ;
150
134
await $ `k3d cluster delete ${ K3D_CLUSTER_NAME } ` ;
151
- magenta ( `
152
-
153
- Cluster ${ K3D_CLUSTER_NAME } has been deleted
154
- ` ) ;
155
135
} catch ( error ) {
156
136
magenta ( `
157
137
158
- no K3d cluster with name ${ K3D_CLUSTER_NAME }
138
+ No K3d cluster with name ${ K3D_CLUSTER_NAME }
159
139
` ) ;
160
140
}
161
141
162
142
blue ( `
163
143
164
- Creating a K3d cluster with name ${ K3D_CLUSTER_NAME }
144
+ ☸ Creating a K3d cluster with name ${ K3D_CLUSTER_NAME }
165
145
` ) ;
166
146
167
147
await $ `k3d cluster create --wait \
@@ -177,7 +157,7 @@ async function initCluster() {
177
157
if ( pullMode !== "none" ) {
178
158
blue ( `
179
159
180
- Registering docker images to ${ K3D_IMAGES_REGISTRY } ...
160
+ 🐳 Registering docker images to ${ K3D_IMAGES_REGISTRY } ...
181
161
` ) ;
182
162
183
163
await time ( registerImages ) ;
@@ -222,22 +202,22 @@ async function registerImages() {
222
202
223
203
const images = pullMode === "all" ? allImages : apimImages ;
224
204
205
+ $ . quote = $NoQuote ;
206
+
225
207
magenta ( `
226
208
227
- Pulling docker images ...
209
+ Pulling docker images ...
228
210
` ) ;
229
211
230
212
await Promise . all (
231
- Array . from ( images . keys ( ) ) . map ( ( image ) => $ `docker pull ${ image } ` )
213
+ Array . from ( images . keys ( ) ) . map ( ( image ) => $ `docker pull ${ image } > /dev/null ` )
232
214
) ;
233
215
234
216
magenta ( `
235
217
236
- Tagging docker images ...
218
+ Tagging docker images ...
237
219
` ) ;
238
220
239
- $ . quote = $NoQuote ;
240
-
241
221
await Promise . all (
242
222
Array . from ( images . entries ( ) ) . map (
243
223
( [ image , tag ] ) => $ `docker tag ${ image } ${ tag } `
@@ -246,19 +226,19 @@ async function registerImages() {
246
226
247
227
magenta ( `
248
228
249
- Pushing docker images to ${ K3D_IMAGES_REGISTRY }
229
+ Pushing docker images to ${ K3D_IMAGES_REGISTRY }
250
230
` ) ;
251
231
252
232
await Promise . all (
253
- Array . from ( images . values ( ) ) . map ( ( tag ) => $ `docker push ${ tag } ` )
233
+ Array . from ( images . values ( ) ) . map ( ( tag ) => $ `docker push ${ tag } > /dev/null ` )
254
234
) ;
255
235
256
236
$ . quote = $Quote ;
257
237
}
258
238
259
239
blue ( `
260
240
261
- Creating Kubernetes namespace ${ K3D_NAMESPACE_NAME } ...
241
+ ☸ Creating Kubernetes namespace ${ K3D_NAMESPACE_NAME } ...
262
242
` ) ;
263
243
264
244
await time ( createNamespace ) ;
@@ -270,13 +250,13 @@ async function createNamespace() {
270
250
271
251
blue ( `
272
252
273
- Storing APIM context credentials as a secret ...
253
+ ☸ Storing APIM context credentials as a secret ...
274
254
275
- The following declaration can be used in your management context to reference this secret:
255
+ The following declaration can be used in your management context to reference this secret:
276
256
277
- secretRef:
278
- name: ${ APIM_CONTEXT_SECRET_NAME }
279
- namespace: ${ K3D_NAMESPACE_NAME }
257
+ secretRef:
258
+ name: ${ APIM_CONTEXT_SECRET_NAME }
259
+ namespace: ${ K3D_NAMESPACE_NAME }
280
260
` ) ;
281
261
282
262
await time ( createSecret ) ;
@@ -291,7 +271,7 @@ async function createSecret() {
291
271
292
272
blue ( `
293
273
294
- Adding Helm repositories (if not presents) ...
274
+ ⎈ Adding Helm repositories (if not presents) ...
295
275
` ) ;
296
276
297
277
await time ( addHelmRepos ) ;
@@ -303,13 +283,13 @@ async function addHelmRepos() {
303
283
}
304
284
305
285
blue ( `
306
- Installing components in namespace ${ K3D_NAMESPACE_NAME }
286
+ ⎈ Installing components in namespace ${ K3D_NAMESPACE_NAME }
307
287
308
- Mongodb ${ MONGO_IMAGE_TAG }
309
- Elasticsearch ${ ELASTIC_IMAGE_TAG }
310
- Nginx ingress ${ NGINX_CONTROLLER_IMAGE_TAG }
311
- Nginx backend ${ NGINX_BACKEND_IMAGE_TAG }
312
- Gravitee APIM ${ APIM_IMAGE_TAG }
288
+ Mongodb ${ MONGO_IMAGE_TAG }
289
+ Elasticsearch ${ ELASTIC_IMAGE_TAG }
290
+ Nginx ingress ${ NGINX_CONTROLLER_IMAGE_TAG }
291
+ Nginx backend ${ NGINX_BACKEND_IMAGE_TAG }
292
+ Gravitee APIM ${ APIM_IMAGE_TAG }
313
293
314
294
` ) ;
315
295
@@ -361,7 +341,7 @@ helm install \
361
341
--set "mongo.dbhost=mongodb" \
362
342
--set "mongodb-replicaset=false" \
363
343
--set "mongo.rsEnabled=false" \
364
- apim graviteeio/apim3
344
+ apim graviteeio/apim3 > /dev/null
365
345
` ;
366
346
367
347
const helmInstallMongo = $ `
@@ -378,7 +358,7 @@ helm install \
378
358
--set resources.requests.memory=2048Mi \
379
359
--set resources.limits.cpu=2000m \
380
360
--set resources.requests.cpu=2000m \
381
- mongodb bitnami/mongodb
361
+ mongodb bitnami/mongodb > /dev/null
382
362
` ;
383
363
384
364
const helmInstallElastic = $ `
@@ -387,7 +367,7 @@ helm install \
387
367
--set replicas=1 \
388
368
--set "image=${ K3D_IMAGES_REGISTRY } /elasticsearch" \
389
369
--set "imageTag=${ ELASTIC_IMAGE_TAG } " \
390
- elastic elastic/elasticsearch
370
+ elastic elastic/elasticsearch > /dev/null
391
371
` ;
392
372
393
373
const helmInstallNginxIngress = $ `
@@ -399,7 +379,7 @@ helm install \
399
379
--set "defaultBackend.image.repository=nginx" \
400
380
--set "image.tag=${ NGINX_CONTROLLER_IMAGE_TAG } " \
401
381
--set "defaultBackend.image.tag=${ NGINX_BACKEND_IMAGE_TAG } " \
402
- nginx-ingress bitnami/nginx-ingress-controller
382
+ nginx-ingress bitnami/nginx-ingress-controller > /dev/null
403
383
` ;
404
384
405
385
await time ( helmInstall ) ;
@@ -448,5 +428,5 @@ async function waitForApim() {
448
428
449
429
green ( `
450
430
451
- Cluster is ready!
431
+ 🚀 Cluster is ready!
452
432
` ) ;
0 commit comments