forked from openshift/release
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcluster-launch-installer-src.yaml
889 lines (823 loc) · 43.8 KB
/
cluster-launch-installer-src.yaml
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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
kind: Template
apiVersion: template.openshift.io/v1
parameters:
- name: JOB_NAME
required: true
- name: JOB_NAME_SAFE
required: true
- name: JOB_NAME_HASH
required: true
- name: NAMESPACE
required: true
- name: IMAGE_FORMAT
required: true
- name: IMAGE_INSTALLER
required: true
- name: LOCAL_IMAGE_SRC
required: true
- name: IMAGE_CLI
required: true
- name: IMAGE_TESTS
required: true
- name: CLUSTER_TYPE
required: true
# Ensures the release image is created and tested
- name: TEST_COMMAND
required: true
- name: RELEASE_IMAGE_LATEST
required: true
- name: BASE_DOMAIN
- name: CLUSTER_NETWORK_TYPE
- name: CLUSTER_VARIANT
- name: BUILD_ID
required: false
- name: USE_LEASE_CLIENT
objects:
# We want the cluster to be able to access these images
- kind: RoleBinding
apiVersion: authorization.openshift.io/v1
metadata:
name: ${JOB_NAME_SAFE}-image-puller
namespace: ${NAMESPACE}
roleRef:
name: system:image-puller
subjects:
- kind: SystemGroup
name: system:unauthenticated
- kind: SystemGroup
name: system:authenticated
# The e2e pod spins up a cluster, runs e2e tests, and then cleans up the cluster.
- kind: Pod
apiVersion: v1
metadata:
name: ${JOB_NAME_SAFE}
namespace: ${NAMESPACE}
annotations:
# we want to gather the teardown logs no matter what
ci-operator.openshift.io/wait-for-container-artifacts: teardown
ci-operator.openshift.io/save-container-logs: "true"
ci-operator.openshift.io/container-sub-tests: "setup,test,teardown"
spec:
restartPolicy: Never
activeDeadlineSeconds: 21600
terminationGracePeriodSeconds: 900
volumes:
- name: artifacts
emptyDir: {}
- name: shared-tmp
emptyDir: {}
- name: cluster-profile
secret:
secretName: ${JOB_NAME_SAFE}-cluster-profile
initContainers:
- name: cli
image: ${IMAGE_CLI}
volumeMounts:
- name: shared-tmp
mountPath: /tmp/shared
command:
- cp
- /usr/bin/oc
- /tmp/shared/oc
containers:
# Once the cluster is up, executes shared tests
- name: test
image: ${LOCAL_IMAGE_SRC}
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- name: shared-tmp
mountPath: /tmp/shared
- name: cluster-profile
mountPath: /tmp/cluster
- name: artifacts
mountPath: /tmp/artifacts
env:
- name: AWS_SHARED_CREDENTIALS_FILE
value: /tmp/cluster/.awscred
- name: AZURE_AUTH_LOCATION
value: /tmp/cluster/osServicePrincipal.json
- name: GCP_SHARED_CREDENTIALS_FILE
value: /tmp/cluster/gce.json
- name: ARTIFACT_DIR
value: /tmp/artifacts
- name: HOME
value: /tmp/home
- name: IMAGE_FORMAT
value: ${IMAGE_FORMAT}
- name: KUBECONFIG
value: /tmp/artifacts/installer/auth/kubeconfig
command:
- /bin/bash
- -c
- |
#!/bin/bash
set -euo pipefail
export PATH=/tmp/shared:$PATH
trap 'touch /tmp/shared/exit' EXIT
trap 'jobs -p | xargs -r kill || true; exit 0' TERM
mkdir -p "${HOME}"
# wait for the API to come up
while true; do
if [[ -f /tmp/shared/setup-failed ]]; then
echo "Setup reported a failure, do not report test failure" 2>&1
exit 0
fi
if [[ -f /tmp/shared/exit ]]; then
echo "Another process exited" 2>&1
exit 1
fi
if [[ ! -f /tmp/shared/setup-success ]]; then
sleep 15 & wait
continue
fi
# don't let clients impact the global kubeconfig
cp "${KUBECONFIG}" /tmp/admin.kubeconfig
export KUBECONFIG=/tmp/admin.kubeconfig
break
done
# if the cluster profile included an insights secret, install it to the cluster to
# report support data from the support-operator
if [[ -f /tmp/cluster/insights-live.yaml ]]; then
oc create -f /tmp/cluster/insights-live.yaml || true
fi
function setup-google-cloud-sdk() {
pushd /tmp
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-256.0.0-linux-x86_64.tar.gz
tar -xzf google-cloud-sdk-256.0.0-linux-x86_64.tar.gz
export PATH=$PATH:/tmp/google-cloud-sdk/bin
mkdir gcloudconfig
export CLOUDSDK_CONFIG=/tmp/gcloudconfig
gcloud auth activate-service-account --key-file="${GCP_SHARED_CREDENTIALS_FILE}"
gcloud config set project openshift-gce-devel-ci
popd
}
# set up cloud-provider-specific env vars
export KUBE_SSH_BASTION="$( oc --insecure-skip-tls-verify get node -l node-role.kubernetes.io/master -o 'jsonpath={.items[0].status.addresses[?(@.type=="ExternalIP")].address}' ):22"
export KUBE_SSH_KEY_PATH=/tmp/cluster/ssh-privatekey
if [[ "${CLUSTER_TYPE}" == "gcp" ]]; then
export GOOGLE_APPLICATION_CREDENTIALS="${GCP_SHARED_CREDENTIALS_FILE}"
export KUBE_SSH_USER=core
mkdir -p ~/.ssh
cp /tmp/cluster/ssh-privatekey ~/.ssh/google_compute_engine || true
export TEST_PROVIDER='{"type":"gce","region":"us-east1","multizone": true,"multimaster":true,"projectid":"openshift-gce-devel-ci"}'
elif [[ "${CLUSTER_TYPE}" == "aws" ]]; then
mkdir -p ~/.ssh
cp /tmp/cluster/ssh-privatekey ~/.ssh/kube_aws_rsa || true
export PROVIDER_ARGS="-provider=aws -gce-zone=us-east-1"
# TODO: make openshift-tests auto-discover this from cluster config
REGION="$(oc get -o jsonpath='{.status.platformStatus.aws.region}' infrastructure cluster)"
ZONE="$(oc get -o jsonpath='{.items[0].metadata.labels.failure-domain\.beta\.kubernetes\.io/zone}' nodes)"
export TEST_PROVIDER="{\"type\":\"aws\",\"region\":\"${REGION}\",\"zone\":\"${ZONE}\",\"multizone\":true,\"multimaster\":true}"
export KUBE_SSH_USER=core
elif [[ "${CLUSTER_TYPE}" == "azure4" ]]; then
export TEST_PROVIDER='azure'
elif [[ "${CLUSTER_TYPE}" == "openstack" ]]; then
mkdir -p ~/.ssh
cp /tmp/cluster/ssh-privatekey ~/.ssh/kube_openstack_rsa || true
fi
if [[ "${CLUSTER_TYPE}" == "gcp" ]]; then
setup-google-cloud-sdk
fi
${TEST_COMMAND}
- name: setup
image: ${IMAGE_INSTALLER}
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- name: shared-tmp
mountPath: /tmp
- name: cluster-profile
mountPath: /etc/openshift-installer
- name: artifacts
mountPath: /tmp/artifacts
env:
- name: AWS_SHARED_CREDENTIALS_FILE
value: /etc/openshift-installer/.awscred
- name: AZURE_AUTH_LOCATION
value: /etc/openshift-installer/osServicePrincipal.json
- name: GCP_REGION
value: us-east1
- name: GCP_PROJECT
value: openshift-gce-devel-ci
- name: GOOGLE_CLOUD_KEYFILE_JSON
value: /etc/openshift-installer/gce.json
- name: CLUSTER_NAME
value: ${NAMESPACE}-${JOB_NAME_HASH}
- name: CLUSTER_VARIANT
value: ${CLUSTER_VARIANT}
- name: BASE_DOMAIN
value: ${BASE_DOMAIN}
- name: SSH_PRIV_KEY_PATH
value: /etc/openshift-installer/ssh-privatekey
- name: SSH_PUB_KEY_PATH
value: /etc/openshift-installer/ssh-publickey
- name: PULL_SECRET_PATH
value: /etc/openshift-installer/pull-secret
- name: OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE
value: ${RELEASE_IMAGE_LATEST}
- name: OPENSHIFT_INSTALL_INVOKER
value: openshift-internal-ci/${JOB_NAME}/${BUILD_ID}
- name: USER
value: test
- name: HOME
value: /tmp
- name: MIRROR_BASE
value: registry.svc.ci.openshift.org/${NAMESPACE}/release
- name: INSTALL_INITIAL_RELEASE
- name: RELEASE_IMAGE_INITIAL
command:
- /bin/bash
- -c
- |
#!/bin/bash
set -euo pipefail
trap 'rc=$?; if test "${rc}" -eq 0; then touch /tmp/setup-success; else touch /tmp/exit /tmp/setup-failed; fi; exit "${rc}"' EXIT
trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM
cp "$(command -v openshift-install)" /tmp
mkdir /tmp/artifacts/installer
function has_variant() {
regex="(^|,)$1($|,)"
if [[ $CLUSTER_VARIANT =~ $regex ]]; then
return 0
fi
return 1
}
if [[ -n "${INSTALL_INITIAL_RELEASE}" && -n "${RELEASE_IMAGE_INITIAL}" ]]; then
echo "Installing from initial release ${RELEASE_IMAGE_INITIAL}"
OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE="${RELEASE_IMAGE_INITIAL}"
elif has_variant "mirror"; then
export PATH=$PATH:/tmp # gain access to oc
while [ ! command -V oc ]; do sleep 1; done # poll to make sure that the test container has dropped oc into the shared volume
# mirror the release image and override the release image to point to the mirrored one
mkdir /tmp/.docker && cp /etc/openshift-installer/pull-secret /tmp/.docker/config.json
oc registry login
oc adm release new --from-release ${RELEASE_IMAGE_LATEST} --to-image ${MIRROR_BASE}-scratch:release --mirror ${MIRROR_BASE}-scratch || echo 'ignore: the release could not be reproduced from its inputs'
oc adm release mirror --from ${MIRROR_BASE}-scratch:release --to ${MIRROR_BASE} --to-release-image ${MIRROR_BASE}:mirrored
RELEASE_PAYLOAD_IMAGE_SHA=$(oc get istag ${MIRROR_BASE##*/}:mirrored -o=jsonpath="{.image.metadata.name}")
oc delete imagestream "$(basename "${MIRROR_BASE}-scratch")"
RELEASE_IMAGE_MIRROR="${MIRROR_BASE}@${RELEASE_PAYLOAD_IMAGE_SHA}"
echo "Installing from mirror override release ${RELEASE_IMAGE_MIRROR}"
OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE="${RELEASE_IMAGE_MIRROR}"
else
echo "Installing from release ${RELEASE_IMAGE_LATEST}"
fi
export EXPIRATION_DATE=$(date -d '4 hours' --iso=minutes --utc)
export SSH_PUB_KEY=$(cat "${SSH_PUB_KEY_PATH}")
export PULL_SECRET=$(cat "${PULL_SECRET_PATH}")
## move private key to ~/.ssh/ so that installer can use it to gather logs on bootstrap failure
mkdir -p ~/.ssh
cp "${SSH_PRIV_KEY_PATH}" ~/.ssh/
workers=3
if has_variant "compact" || has_variant "multisocket"; then
workers=0
fi
if [[ "${CLUSTER_TYPE}" == "aws" ]]; then
master_type=null
if has_variant "multisocket"; then
master_type=c5n.metal
elif has_variant "xlarge"; then
master_type=m5.8xlarge
elif has_variant "large"; then
master_type=m5.4xlarge
elif has_variant "compact"; then
master_type=m5.2xlarge
fi
case $((RANDOM % 4)) in
0) AWS_REGION=us-east-1
ZONE_1=us-east-1b
ZONE_2=us-east-1c;;
1) AWS_REGION=us-east-2;;
2) AWS_REGION=us-west-1;;
3) AWS_REGION=us-west-2;;
*) echo >&2 "invalid AWS region index"; exit 1;;
esac
echo "AWS region: ${AWS_REGION} (zones: ${ZONE_1:-${AWS_REGION}a} ${ZONE_2:-${AWS_REGION}b})"
subnets="[]"
if has_variant "shared-vpc"; then
case "${AWS_REGION}_$((RANDOM % 4))" in
us-east-1_0) subnets="['subnet-030a88e6e97101ab2','subnet-0e07763243186cac5','subnet-02c5fea7482f804fb','subnet-0291499fd1718ee01','subnet-01c4667ad446c8337','subnet-025e9043c44114baa']";;
us-east-1_1) subnets="['subnet-0170ee5ccdd7e7823','subnet-0d50cac95bebb5a6e','subnet-0094864467fc2e737','subnet-0daa3919d85296eb6','subnet-0ab1e11d3ed63cc97','subnet-07681ad7ce2b6c281']";;
us-east-1_2) subnets="['subnet-00de9462cf29cd3d3','subnet-06595d2851257b4df','subnet-04bbfdd9ca1b67e74','subnet-096992ef7d807f6b4','subnet-0b3d7ba41fc6278b2','subnet-0b99293450e2edb13']";;
us-east-1_3) subnets="['subnet-047f6294332aa3c1c','subnet-0c3bce80bbc2c8f1c','subnet-038c38c7d96364d7f','subnet-027a025e9d9db95ce','subnet-04d9008469025b101','subnet-02f75024b00b20a75']";;
us-east-2_0) subnets="['subnet-0a568760cd74bf1d7','subnet-0320ee5b3bb78863e','subnet-015658a21d26e55b7','subnet-0c3ce64c4066f37c7','subnet-0d57b6b056e1ee8f6','subnet-0b118b86d1517483a']";;
us-east-2_1) subnets="['subnet-0f6c106c48187d0a9','subnet-0d543986b85c9f106','subnet-05ef94f36de5ac8c4','subnet-031cdc26c71c66e83','subnet-0f1e0d62680e8b883','subnet-00e92f507a7cbd8ac']";;
us-east-2_2) subnets="['subnet-0310771820ebb25c7','subnet-0396465c0cb089722','subnet-02e316495d39ce361','subnet-0c5bae9b575f1b9af','subnet-0b3de1f0336c54cfe','subnet-03f164174ccbc1c60']";;
us-east-2_3) subnets="['subnet-045c43b4de0092f74','subnet-0a78d4ddcc6434061','subnet-0ed28342940ef5902','subnet-02229d912f99fc84f','subnet-0c9b3aaa6a1ad2030','subnet-0c93fb4760f95dbe4']";;
us-west-1_0) subnets="['subnet-0919ede122e5d3e46','subnet-0cf9da97d102fff0d','subnet-000378d8042931770','subnet-0c8720acadbb099fc']";;
us-west-1_1) subnets="['subnet-0129b0f0405beca97','subnet-073caab166af2207e','subnet-0f07362330db0ac66','subnet-007d6444690f88b33']";;
us-west-1_2) subnets="['subnet-09affff50a1a3a9d0','subnet-0838fdfcbe4da6471','subnet-08b9c065aefd9b8de','subnet-027fcc48c429b9865']";;
us-west-1_3) subnets="['subnet-0cd3dde41e1d187fe','subnet-0e78f426f8938df2d','subnet-03edeaf52c46468fa','subnet-096fb5b3a7da814c2']";;
us-west-2_0) subnets="['subnet-04055d49cdf149e87','subnet-0b658a04c438ef43c','subnet-015f32caeff1bd736','subnet-0c96a7bb6ac78323c','subnet-0b7387e251953bdcf','subnet-0c19695d20ce05c60']";;
us-west-2_1) subnets="['subnet-0483607b3e3c2514f','subnet-01139c6c5e3c1e28e','subnet-0cc9500f56a1df779','subnet-001b2c8acd2bac389','subnet-093f66b9d6deffafc','subnet-095b373699fb51212']";;
us-west-2_2) subnets="['subnet-057c716b8953f834a','subnet-096f21593f10b44cb','subnet-0f281491881970222','subnet-0fec3730729e452d9','subnet-0381cfcc0183cb0ba','subnet-0f1189be41a2a2a2f']";;
us-west-2_3) subnets="['subnet-072d00dcf02ad90a6','subnet-0ad913e4bd6ff53fa','subnet-09f90e069238e4105','subnet-064ecb1b01098ff35','subnet-068d9cdd93c0c66e6','subnet-0b7d1a5a6ae1d9adf']";;
*) echo >&2 "invalid subnets index"; exit 1;;
esac
echo "Subnets : ${subnets}"
fi
cat > /tmp/artifacts/installer/install-config.yaml << EOF
apiVersion: v1
baseDomain: ${BASE_DOMAIN:-origin-ci-int-aws.dev.rhcloud.com}
metadata:
name: ${CLUSTER_NAME}
controlPlane:
name: master
replicas: 3
platform:
aws:
type: ${master_type}
zones:
- ${ZONE_1:-${AWS_REGION}a}
- ${ZONE_2:-${AWS_REGION}b}
compute:
- name: worker
replicas: ${workers}
platform:
aws:
type: m4.xlarge
zones:
- ${ZONE_1:-${AWS_REGION}a}
- ${ZONE_2:-${AWS_REGION}b}
platform:
aws:
region: ${AWS_REGION}
userTags:
expirationDate: ${EXPIRATION_DATE}
subnets: ${subnets}
pullSecret: >
${PULL_SECRET}
sshKey: |
${SSH_PUB_KEY}
EOF
elif [[ "${CLUSTER_TYPE}" == "azure4" ]]; then
case $((RANDOM % 8)) in
0) AZURE_REGION=centralus;;
1) AZURE_REGION=centralus;;
2) AZURE_REGION=centralus;;
3) AZURE_REGION=centralus;;
4) AZURE_REGION=centralus;;
5) AZURE_REGION=centralus;;
6) AZURE_REGION=eastus2;;
7) AZURE_REGION=westus;;
*) echo >&2 "invalid Azure region index"; exit 1;;
esac
echo "Azure region: ${AZURE_REGION}"
vnetrg=""
vnetname=""
ctrlsubnet=""
computesubnet=""
if has_variant "shared-vpc"; then
vnetrg="os4-common"
vnetname="do-not-delete-shared-vnet-${AZURE_REGION}"
ctrlsubnet="subnet-1"
computesubnet="subnet-2"
fi
cat > /tmp/artifacts/installer/install-config.yaml << EOF
apiVersion: v1
baseDomain: ${BASE_DOMAIN:-ci.azure.devcluster.openshift.com}
metadata:
name: ${CLUSTER_NAME}
controlPlane:
name: master
replicas: 3
compute:
- name: worker
replicas: ${workers}
platform:
azure:
type: Standard_D4s_v3
platform:
azure:
baseDomainResourceGroupName: os4-common
region: ${AZURE_REGION}
networkResourceGroupName: ${vnetrg}
virtualNetwork: ${vnetname}
controlPlaneSubnet: ${ctrlsubnet}
computeSubnet: ${computesubnet}
pullSecret: >
${PULL_SECRET}
sshKey: |
${SSH_PUB_KEY}
EOF
elif [[ "${CLUSTER_TYPE}" == "gcp" ]]; then
master_type=null
if has_variant "xlarge"; then
master_type=n1-standard-32
elif has_variant "large"; then
master_type=n1-standard-16
elif has_variant "compact"; then
master_type=n1-standard-8
fi
# HACK: try to "poke" the token endpoint before the test starts
for i in $(seq 1 30); do
code="$( curl -s -o /dev/null -w "%{http_code}" https://oauth2.googleapis.com/token -X POST -d '' || echo "Failed to POST https://oauth2.googleapis.com/token with $?" 1>&2)"
if [[ "${code}" == "400" ]]; then
break
fi
echo "error: Unable to resolve https://oauth2.googleapis.com/token: $code" 1>&2
if [[ "${i}" == "30" ]]; then
echo "error: Unable to resolve https://oauth2.googleapis.com/token within timeout, exiting" 1>&2
exit 1
fi
sleep 1
done
network=""
ctrlsubnet=""
computesubnet=""
if has_variant "shared-vpc"; then
network="do-not-delete-shared-network"
ctrlsubnet="do-not-delete-shared-master-subnet"
computesubnet="do-not-delete-shared-worker-subnet"
fi
cat > /tmp/artifacts/installer/install-config.yaml << EOF
apiVersion: v1
baseDomain: ${BASE_DOMAIN:-origin-ci-int-gce.dev.openshift.com}
metadata:
name: ${CLUSTER_NAME}
controlPlane:
name: master
replicas: 3
platform:
gcp:
type: ${master_type}
compute:
- name: worker
replicas: ${workers}
platform:
gcp:
projectID: ${GCP_PROJECT}
region: ${GCP_REGION}
network: ${network}
controlPlaneSubnet: ${ctrlsubnet}
computeSubnet: ${computesubnet}
pullSecret: >
${PULL_SECRET}
sshKey: |
${SSH_PUB_KEY}
EOF
else
echo "Unsupported cluster type '${CLUSTER_TYPE}'"
exit 1
fi
# as a current stop gap -- this is pointing to a proxy hosted in
# the namespace "ci-test-ewolinet" on the ci cluster
if has_variant "proxy"; then
# FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1750650 we need to
# use a http endpoint for the httpsProxy value
# TODO: revert back to using https://ewolinet:[email protected]:3128/
cat >> /tmp/artifacts/installer/install-config.yaml << EOF
proxy:
httpsProxy: http://ewolinet:[email protected]:3128/
httpProxy: http://ewolinet:[email protected]:3128/
additionalTrustBundle: |
-----BEGIN CERTIFICATE-----
MIIF2DCCA8CgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgYYxEjAQBgoJkiaJk/Is
ZAEZFgJpbzEZMBcGCgmSJomT8ixkARkWCW9wZW5zaGlmdDEZMBcGA1UECgwQT3Bl
blNoaWZ0IE9yaWdpbjEcMBoGA1UECwwTUHJveHkgQ0kgU2lnbmluZyBDQTEcMBoG
A1UEAwwTUHJveHkgQ0kgU2lnbmluZyBDQTAeFw0xOTA5MTYxODU1MTNaFw0yOTA5
MTMxODU1MTNa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s44SidIycnRU
XmQ4fKPqwxYO2nFiazvUkx2i+K5haIwB5yhOvtzsNX+FxQ3SS0HiTDcE5bKPHN6J
p4SKDdTSzHZZM1cGo23FfWBCC5MKsNN9z5RGz2Zb2WiknUa4ldhEynOulDYLUJYy
e6Bsa1Ofbh+HSR35Ukp2s+6bi1t4eNK6Dm5RYckGLNW1oEEBf6dwLzqLk1Jn/KCX
LOWppccX2IEiK3+SlMf1tyaFen5wjBZUODAl+7xez3xGy3VGDcGZ0vTqAb50yETP
hNb0oedIX6w0e+XCCVDJfQSUn+jkFQ/mSpQ8weRAYKS2bYIzDglT0Z0OlQFVxWon
/5NdicbX0FIlFcEgAxaKTF8NBmXcGNUXy97VnAJPAThlsCKP8Wg07ZbIKJ6lVkch
9j1VeY2dkqCFm+yETyEkRr9J18Z+10U3N/syfPFq70p05F2sn59gAJWelrcuJAYt
+KDgJMYks41qwZTRs/LigMO1pinWwSjQ6v9wf2K9/qPfHanQSemLevc9qqxu4YB0
AYr95LgRPD0YmHgcoV71xNOvS6oFXzt9tpMxqvSwmNAVLHLx0agj6CQfYYIEzdbG
yuou5tUsxnXldxSFjB5u8eYX+wLhMtqTLWxM81kL4nwHvwfEfjV/Z5L8ZcfBQzgX
Q/6M
-----END CERTIFICATE-----
EOF
fi
network_type="${CLUSTER_NETWORK_TYPE-}"
if has_variant "ovn"; then
network_type=OVNKubernetes
elif has_variant "calico"; then
network_type=Calico
fi
cidr_size=16
host_prefix=23
if has_variant "xlarge" || has_variant "large"; then
cidr_size=12
host_prefix=22
if [[ -z "${network_type}" ]]; then
network_type=OpenShiftSDN
fi
fi
if has_variant "ipv6"; then
export OPENSHIFT_INSTALL_AZURE_EMULATE_SINGLESTACK_IPV6=true
cat >> /tmp/artifacts/installer/install-config.yaml << EOF
networking:
networkType: OVNKubernetes
machineNetwork:
- cidr: 10.0.0.0/16
- cidr: fd00::/48
clusterNetwork:
- cidr: fd01::/48
hostPrefix: 64
serviceNetwork:
- fd02::/112
EOF
elif [[ -n "${network_type}" ]]; then
cat >> /tmp/artifacts/installer/install-config.yaml << EOF
networking:
networkType: ${network_type}
machineNetwork:
- cidr: 10.0.0.0/16
clusterNetwork:
- cidr: 10.128.0.0/${cidr_size}
hostPrefix: ${host_prefix}
EOF
fi
if has_variant "mirror"; then
cat >> /tmp/artifacts/installer/install-config.yaml << EOF
imageContentSources:
- source: "${MIRROR_BASE}-scratch"
mirrors:
- "${MIRROR_BASE}"
EOF
fi
if has_variant "fips"; then
cat >> /tmp/artifacts/installer/install-config.yaml << EOF
fips: true
EOF
fi
if has_variant "preserve-bootstrap"; then
export OPENSHIFT_INSTALL_PRESERVE_BOOTSTRAP=true
fi
openshift-install --dir=/tmp/artifacts/installer/ create manifests &
wait "$!"
manifests=/tmp/artifacts/installer/manifests/
sed -i '/^ channel:/d' ${manifests}/cvo-overrides.yaml
if [[ -n "${CLUSTER_NETWORK_MANIFEST:-}" ]]; then
echo "${CLUSTER_NETWORK_MANIFEST}" > ${manifests}/cluster-network-03-config.yml
fi
if [[ "${network_type}" == "Calico" ]]; then
pushd ${manifests}/..
# Copied exactly from https://docs.projectcalico.org/getting-started/openshift/installation
curl https://docs.projectcalico.org/manifests/ocp/crds/01-crd-installation.yaml -o manifests/01-crd-installation.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/01-crd-tigerastatus.yaml -o manifests/01-crd-tigerastatus.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-bgpconfiguration.yaml -o manifests/02-crd-bgpconfiguration.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-bgppeer.yaml -o manifests/02-crd-bgppeer.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-blockaffinity.yaml -o manifests/02-crd-blockaffinity.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-clusterinformation.yaml -o manifests/02-crd-clusterinformation.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-felixconfiguration.yaml -o manifests/02-crd-felixconfiguration.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-globalnetworkpolicy.yaml -o manifests/02-crd-globalnetworkpolicy.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-globalnetworkset.yaml -o manifests/02-crd-globalnetworkset.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-hostendpoint.yaml -o manifests/02-crd-hostendpoint.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-ipamblock.yaml -o manifests/02-crd-ipamblock.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-ipamconfig.yaml -o manifests/02-crd-ipamconfig.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-ipamhandle.yaml -o manifests/02-crd-ipamhandle.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-ippool.yaml -o manifests/02-crd-ippool.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-kubecontrollersconfiguration.yaml -o manifests/02-crd-kubecontrollersconfiguration.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-networkpolicy.yaml -o manifests/02-crd-networkpolicy.yaml
curl https://docs.projectcalico.org/manifests/ocp/crds/calico/kdd/02-crd-networkset.yaml -o manifests/02-crd-networkset.yaml
curl https://docs.projectcalico.org/manifests/ocp/tigera-operator/00-namespace-tigera-operator.yaml -o manifests/00-namespace-tigera-operator.yaml
curl https://docs.projectcalico.org/manifests/ocp/tigera-operator/02-rolebinding-tigera-operator.yaml -o manifests/02-rolebinding-tigera-operator.yaml
curl https://docs.projectcalico.org/manifests/ocp/tigera-operator/02-role-tigera-operator.yaml -o manifests/02-role-tigera-operator.yaml
curl https://docs.projectcalico.org/manifests/ocp/tigera-operator/02-serviceaccount-tigera-operator.yaml -o manifests/02-serviceaccount-tigera-operator.yaml
curl https://docs.projectcalico.org/manifests/ocp/tigera-operator/02-configmap-calico-resources.yaml -o manifests/02-configmap-calico-resources.yaml
curl https://docs.projectcalico.org/manifests/ocp/tigera-operator/02-configmap-tigera-install-script.yaml -o manifests/02-configmap-tigera-install-script.yaml
curl https://docs.projectcalico.org/manifests/ocp/tigera-operator/02-tigera-operator.yaml -o manifests/02-tigera-operator.yaml
curl https://docs.projectcalico.org/manifests/ocp/01-cr-installation.yaml -o manifests/01-cr-installation.yaml
# end copied
popd
fi
if has_variant "rt"; then
cat > ${manifests}/realtime-worker-machine-config.yml << EOF
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: worker
name: realtime-worker
spec:
kernelType: realtime
EOF
fi
if has_variant "multisocket"; then
# TODO: waiting for https://issues.redhat.com/browse/GRPA-1895
cat > ${manifests}/multisocket-machine-config.yml << EOF
---
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
labels:
topology-manager: enabled
name: master
---
apiVersion: machineconfiguration.openshift.io/v1
kind: KubeletConfig
metadata:
name: enable-topology-manager
spec:
machineConfigPoolSelector:
matchLabels:
topology-manager: enabled
kubeletConfig:
cpuManagerPolicy: "static"
cpuManagerReconcilePeriod: "10s"
topologyManagerPolicy: "single-numa-node"
reservedSystemCPUs: 1,3,5,7
EOF
fi
TF_LOG=debug openshift-install --dir=/tmp/artifacts/installer create cluster 2>&1 | grep --line-buffered -v password &
wait "$!"
# Password for the cluster gets leaked in the installer logs and hence removing them.
sed -i 's/password: .*/password: REDACTED"/g' /tmp/artifacts/installer/.openshift_install.log
# Performs cleanup of all created resources
- name: teardown
image: ${IMAGE_TESTS}
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- name: shared-tmp
mountPath: /tmp/shared
- name: cluster-profile
mountPath: /etc/openshift-installer
- name: artifacts
mountPath: /tmp/artifacts
env:
- name: INSTANCE_PREFIX
value: ${NAMESPACE}-${JOB_NAME_HASH}
- name: TYPE
value: ${CLUSTER_TYPE}
- name: AWS_SHARED_CREDENTIALS_FILE
value: /etc/openshift-installer/.awscred
- name: AZURE_AUTH_LOCATION
value: /etc/openshift-installer/osServicePrincipal.json
- name: GOOGLE_CLOUD_KEYFILE_JSON
value: /etc/openshift-installer/gce.json
- name: KUBECONFIG
value: /tmp/artifacts/installer/auth/kubeconfig
command:
- /bin/bash
- -c
- |
#!/bin/bash
set -eo pipefail
function queue() {
local TARGET="${1}"
shift
local LIVE="$(jobs | wc -l)"
while [[ "${LIVE}" -ge 45 ]]; do
sleep 1
LIVE="$(jobs | wc -l)"
done
echo "${@}"
if [[ -n "${FILTER}" ]]; then
"${@}" | "${FILTER}" >"${TARGET}" &
else
"${@}" >"${TARGET}" &
fi
}
function teardown() {
set +e
touch /tmp/shared/exit
export PATH=$PATH:/tmp/shared
echo "Gathering artifacts ..."
mkdir -p /tmp/artifacts/pods /tmp/artifacts/nodes /tmp/artifacts/metrics /tmp/artifacts/bootstrap /tmp/artifacts/network
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.metadata.name}{"\n"}{end}' > /tmp/nodes
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' > /tmp/node-provider-IDs
oc --insecure-skip-tls-verify --request-timeout=5s -n openshift-machine-api get machines -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' >> /tmp/node-provider-IDs
oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces --template '{{ range .items }}{{ $name := .metadata.name }}{{ $ns := .metadata.namespace }}{{ range .spec.containers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ range .spec.initContainers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ end }}' > /tmp/containers
oc --insecure-skip-tls-verify --request-timeout=5s get pods -l openshift.io/component=api --all-namespaces --template '{{ range .items }}-n {{ .metadata.namespace }} {{ .metadata.name }}{{ "\n" }}{{ end }}' > /tmp/pods-api
queue /tmp/artifacts/config-resources.json oc --insecure-skip-tls-verify --request-timeout=5s get apiserver.config.openshift.io authentication.config.openshift.io build.config.openshift.io console.config.openshift.io dns.config.openshift.io featuregate.config.openshift.io image.config.openshift.io infrastructure.config.openshift.io ingress.config.openshift.io network.config.openshift.io oauth.config.openshift.io project.config.openshift.io scheduler.config.openshift.io -o json
queue /tmp/artifacts/apiservices.json oc --insecure-skip-tls-verify --request-timeout=5s get apiservices -o json
queue /tmp/artifacts/clusteroperators.json oc --insecure-skip-tls-verify --request-timeout=5s get clusteroperators -o json
queue /tmp/artifacts/clusterversion.json oc --insecure-skip-tls-verify --request-timeout=5s get clusterversion -o json
queue /tmp/artifacts/configmaps.json oc --insecure-skip-tls-verify --request-timeout=5s get configmaps --all-namespaces -o json
queue /tmp/artifacts/credentialsrequests.json oc --insecure-skip-tls-verify --request-timeout=5s get credentialsrequests --all-namespaces -o json
queue /tmp/artifacts/csr.json oc --insecure-skip-tls-verify --request-timeout=5s get csr -o json
queue /tmp/artifacts/endpoints.json oc --insecure-skip-tls-verify --request-timeout=5s get endpoints --all-namespaces -o json
FILTER=gzip queue /tmp/artifacts/deployments.json.gz oc --insecure-skip-tls-verify --request-timeout=5s get deployments --all-namespaces -o json
FILTER=gzip queue /tmp/artifacts/daemonsets.json.gz oc --insecure-skip-tls-verify --request-timeout=5s get daemonsets --all-namespaces -o json
queue /tmp/artifacts/events.json oc --insecure-skip-tls-verify --request-timeout=5s get events --all-namespaces -o json
queue /tmp/artifacts/kubeapiserver.json oc --insecure-skip-tls-verify --request-timeout=5s get kubeapiserver -o json
queue /tmp/artifacts/kubecontrollermanager.json oc --insecure-skip-tls-verify --request-timeout=5s get kubecontrollermanager -o json
queue /tmp/artifacts/machineconfigpools.json oc --insecure-skip-tls-verify --request-timeout=5s get machineconfigpools -o json
queue /tmp/artifacts/machineconfigs.json oc --insecure-skip-tls-verify --request-timeout=5s get machineconfigs -o json
queue /tmp/artifacts/machinesets.json oc --insecure-skip-tls-verify --request-timeout=5s get machinesets -A -o json
queue /tmp/artifacts/machines.json oc --insecure-skip-tls-verify --request-timeout=5s get machines -A -o json
queue /tmp/artifacts/namespaces.json oc --insecure-skip-tls-verify --request-timeout=5s get namespaces -o json
queue /tmp/artifacts/nodes.json oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o json
queue /tmp/artifacts/openshiftapiserver.json oc --insecure-skip-tls-verify --request-timeout=5s get openshiftapiserver -o json
queue /tmp/artifacts/pods.json oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces -o json
queue /tmp/artifacts/persistentvolumes.json oc --insecure-skip-tls-verify --request-timeout=5s get persistentvolumes --all-namespaces -o json
queue /tmp/artifacts/persistentvolumeclaims.json oc --insecure-skip-tls-verify --request-timeout=5s get persistentvolumeclaims --all-namespaces -o json
FILTER=gzip queue /tmp/artifacts/replicasets.json.gz oc --insecure-skip-tls-verify --request-timeout=5s get replicasets --all-namespaces -o json
queue /tmp/artifacts/rolebindings.json oc --insecure-skip-tls-verify --request-timeout=5s get rolebindings --all-namespaces -o json
queue /tmp/artifacts/roles.json oc --insecure-skip-tls-verify --request-timeout=5s get roles --all-namespaces -o json
queue /tmp/artifacts/services.json oc --insecure-skip-tls-verify --request-timeout=5s get services --all-namespaces -o json
FILTER=gzip queue /tmp/artifacts/statefulsets.json.gz oc --insecure-skip-tls-verify --request-timeout=5s get statefulsets --all-namespaces -o json
FILTER=gzip queue /tmp/artifacts/openapi.json.gz oc --insecure-skip-tls-verify --request-timeout=5s get --raw /openapi/v2
# gather nodes first in parallel since they may contain the most relevant debugging info
while IFS= read -r i; do
mkdir -p /tmp/artifacts/nodes/$i
queue /tmp/artifacts/nodes/$i/heap oc --insecure-skip-tls-verify get --request-timeout=20s --raw /api/v1/nodes/$i/proxy/debug/pprof/heap
done < /tmp/nodes
if [[ "${CLUSTER_TYPE}" == "aws" ]]; then
# FIXME: get epel-release or otherwise add awscli to our teardown image
export PATH="${HOME}/.local/bin:${PATH}"
easy_install --user pip # our Python 2.7.5 is even too old for ensurepip
pip install --user awscli
export AWS_DEFAULT_REGION="$(python -c 'import json; data = json.load(open("/tmp/artifacts/installer/metadata.json")); print(data["aws"]["region"])')"
echo "gathering node console output from ${AWS_DEFAULT_REGION}"
fi
while IFS= read -r i; do
mkdir -p "/tmp/artifacts/nodes/${i}"
if [[ "${CLUSTER_TYPE}" == "aws" ]]; then
queue /tmp/artifacts/nodes/$i/console aws ec2 get-console-output --instance-id "${i}" --output text
fi
done < <(sort /tmp/node-provider-IDs | uniq)
FILTER=gzip queue /tmp/artifacts/nodes/masters-journal.gz oc --insecure-skip-tls-verify adm node-logs --role=master --unify=false
FILTER=gzip queue /tmp/artifacts/nodes/workers-journal.gz oc --insecure-skip-tls-verify adm node-logs --role=worker --unify=false
# Snapshot iptables-save on each node for debugging possible kube-proxy issues
oc --insecure-skip-tls-verify get --request-timeout=20s -n openshift-sdn -l app=sdn pods --template '{{ range .items }}{{ .metadata.name }}{{ "\n" }}{{ end }}' > /tmp/sdn-pods
while IFS= read -r i; do
queue /tmp/artifacts/network/iptables-save-$i oc --insecure-skip-tls-verify rsh --timeout=20 -n openshift-sdn -c sdn $i iptables-save -c
done < /tmp/sdn-pods
while IFS= read -r i; do
file="$( echo "$i" | cut -d ' ' -f 3 | tr -s ' ' '_' )"
queue /tmp/artifacts/metrics/${file}-heap oc --insecure-skip-tls-verify exec $i -- /bin/bash -c 'oc --insecure-skip-tls-verify get --raw /debug/pprof/heap --server "https://$( hostname ):8443" --config /etc/origin/master/admin.kubeconfig'
queue /tmp/artifacts/metrics/${file}-controllers-heap oc --insecure-skip-tls-verify exec $i -- /bin/bash -c 'oc --insecure-skip-tls-verify get --raw /debug/pprof/heap --server "https://$( hostname ):8444" --config /etc/origin/master/admin.kubeconfig'
done < /tmp/pods-api
while IFS= read -r i; do
file="$( echo "$i" | cut -d ' ' -f 2,3,5 | tr -s ' ' '_' )"
FILTER=gzip queue /tmp/artifacts/pods/${file}.log.gz oc --insecure-skip-tls-verify logs --request-timeout=20s $i
FILTER=gzip queue /tmp/artifacts/pods/${file}_previous.log.gz oc --insecure-skip-tls-verify logs --request-timeout=20s -p $i
done < /tmp/containers
echo "Snapshotting prometheus (may take 15s) ..."
queue /tmp/artifacts/metrics/prometheus.tar.gz oc --insecure-skip-tls-verify exec -n openshift-monitoring prometheus-k8s-0 -- tar cvzf - -C /prometheus .
FILTER=gzip queue /tmp/artifacts/metrics/prometheus-target-metadata.json.gz oc --insecure-skip-tls-verify exec -n openshift-monitoring prometheus-k8s-0 -- /bin/bash -c "curl -G http://localhost:9090/api/v1/targets/metadata --data-urlencode 'match_target={instance!=\"\"}'"
echo "Running must-gather..."
mkdir -p /tmp/artifacts/must-gather
queue /tmp/artifacts/must-gather/must-gather.log oc --insecure-skip-tls-verify adm must-gather --dest-dir /tmp/artifacts/must-gather
echo "Waiting for logs ..."
wait
# This is an experimental wiring of autogenerated failure detection.
echo "Detect known failures from symptoms (experimental) ..."
curl -f https://gist.githubusercontent.com/smarterclayton/03b50c8f9b6351b2d9903d7fb35b342f/raw/symptom.sh 2>/dev/null | bash -s /tmp/artifacts > /tmp/artifacts/junit/junit_symptoms.xml
tar -czC /tmp/artifacts/must-gather -f /tmp/artifacts/must-gather.tar.gz . &&
rm -rf /tmp/artifacts/must-gather
echo "Deprovisioning cluster ..."
openshift-install --dir /tmp/artifacts/installer destroy cluster
}
trap 'teardown' EXIT
trap 'jobs -p | xargs -r kill || true; exit 0' TERM
for i in $(seq 1 220); do
if [[ -f /tmp/shared/exit ]]; then
exit 0
fi
sleep 60 & wait
done