-
Notifications
You must be signed in to change notification settings - Fork 52
/
run.yaml
221 lines (190 loc) · 7.71 KB
/
run.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
- hosts: k8s-master
name: prepare configuration of kubeadm
become: yes
tasks:
- name: create /etc/kubernetes
file:
path: /etc/kubernetes
state: directory
- name: ship kubeadm.yaml
copy:
dest: /etc/kubernetes/kubeadm.yaml
content: |
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
networking:
podSubnet: 10.244.0.0/16
kubernetesVersion: {{ kubernetes_version | default('latest') }}
apiServer:
extraArgs:
"cloud-provider": "external"
controllerManager:
extraArgs:
"cloud-provider": "external"
- hosts: all
name: kubelet cloud-provider external
become: yes
roles:
- cloud-instance-hostname
tasks:
- name: ship /etc/default/kubelet
copy:
dest: /etc/default/kubelet
content: |
KUBELET_EXTRA_ARGS=--cloud-provider=external
- hosts: k8s-master
name: bootstrap kubernetes master
become: yes
roles:
- config-golang
- export-cloud-openrc
- role: create-multinodes-k8s-cluster-with-kubeadm
k8s_role_to_deploy: ["master"]
tasks:
- name: Prepare base alpine image
shell:
cmd: |
docker login -u ap-southeast-3@{{ swr.ak }} -p {{ swr.sk }} swr.ap-southeast-3.myhuaweicloud.com
docker pull swr.ap-southeast-3.myhuaweicloud.com/openlab/alpine:3.11
docker tag swr.ap-southeast-3.myhuaweicloud.com/openlab/alpine:3.11 alpine:3.11
docker logout swr.ap-southeast-3.myhuaweicloud.com
no_log: yes
- name: Build openstack-cloud-controller-manager image
environment: '{{ global_env }}'
shell:
executable: /bin/bash
chdir: '{{ k8s_os_provider_src_dir }}'
cmd: |
set -o pipefail
set -ex
export ARCH=amd64
export IMAGE_NAMES=openstack-cloud-controller-manager
export VERSION=latest
# To be compatible with old releases, using make image-controller-manager
make image-controller-manager
- name: Tag image
environment: '{{ global_env }}'
shell:
executable: /bin/bash
chdir: '{{ k8s_os_provider_src_dir }}'
cmd: |
set -o pipefail
set -ex
export ARCH=amd64
export IMAGE_NAMES=openstack-cloud-controller-manager
# The previous CPO makefile doesn't support arch
docker tag k8scloudprovider/${IMAGE_NAMES}-${ARCH}:latest k8scloudprovider/${IMAGE_NAMES}:latest
ignore_errors: yes
- name: create cloud-config
environment: '{{ global_env }}'
shell:
chdir: '{{ k8s_os_provider_src_dir }}'
executable: /bin/bash
cmd: |
set -o pipefail
set -ex
cat > /etc/kubernetes/cloud-config <<EOF
[Global]
domain-name = $OS_USER_DOMAIN_NAME
tenant-id = $OS_PROJECT_ID
auth-url = $OS_AUTH_URL
password = $OS_PASSWORD
username = $OS_USERNAME
region = $OS_REGION_NAME
[BlockStorage]
bs-version = v3
ignore-volume-az = yes
EOF
# Create cloud-config
kubectl -n kube-system create secret generic cloud-config --from-file=cloud.conf=/etc/kubernetes/cloud-config -oyaml
- name: depoy openstack cloud controller manager
shell:
chdir: '{{ k8s_os_provider_src_dir }}'
executable: /bin/bash
cmd: |
set -ex
kubectl apply -f manifests/controller-manager/cloud-controller-manager-roles.yaml
kubectl apply -f manifests/controller-manager/cloud-controller-manager-role-bindings.yaml
kubectl apply -f manifests/controller-manager/openstack-cloud-controller-manager-ds.yaml
- name: get kubeadm join command
shell: kubeadm token create --print-join-command 2>/dev/null
register: kubeadm_join_cmd
- hosts: k8s-node-1,k8s-node-2
name: join kubernetes nodes
become: yes
roles:
- role: create-multinodes-k8s-cluster-with-kubeadm
k8s_role_to_deploy:
- node
kubeadm_join_cmd: "{{ hostvars['k8s-master']['kubeadm_join_cmd']['stdout'] }}"
tasks:
- name: Prepare base alpine image
shell:
cmd: |
docker login -u ap-southeast-3@{{ swr.ak }} -p {{ swr.sk }} swr.ap-southeast-3.myhuaweicloud.com
docker pull swr.ap-southeast-3.myhuaweicloud.com/openlab/alpine:3.11
docker tag swr.ap-southeast-3.myhuaweicloud.com/openlab/alpine:3.11 alpine:3.11
docker logout swr.ap-southeast-3.myhuaweicloud.com
no_log: yes
- hosts: k8s-master
name: Run conformance test
become: yes
tasks:
- name: Wait for nodes ready
shell:
executable: /bin/bash
cmd: kubectl get nodes | grep Ready | wc -l
register: result
until: result.stdout | int == 3
retries: 30
delay: 10
- name: Install kubetest
environment: '{{ global_env }}'
shell:
executable: /bin/bash
cmd: |
set -o pipefail
set -ex
git clone https://github.com/kubernetes/test-infra --depth 1
cd test-infra
go install ./kubetest
- name: Run conformance test
environment: '{{ global_env }}'
shell:
executable: /bin/bash
cmd: |
set -ex
K8S_VERSION=$(kubectl version -o json | jq -r '.serverVersion.gitVersion')
export KUBERNETES_CONFORMANCE_TEST=y
mkdir -p '{{ k8s_log_dir }}'
export LOG_DIR='{{ k8s_log_dir }}'
sudo chmod 777 $LOG_DIR
export KUBE_MASTER_IP=$(ip route get 1.1.1.1 | awk '{print $7}')
export KUBE_MASTER=k8s-master
export MASTER_NAME=k8s-master
export DUMP_ONLY_MASTER_LOGS=true
kubetest --dump=$LOG_DIR \
--test \
--provider=skeleton \
--ginkgo-parallel=1 \
--test_args="--ginkgo.focus=\\[Conformance\\] --ginkgo.noColor=true --ginkgo.v=true --ginkgo.trace=true --disable-log-dump=true --ginkgo.skip=\\[sig\\-apps\\]\\sDaemon\\sset\\s\\[Serial\\]\\sshould\\srollback\\swithout\\sunnecessary\\srestarts\\s\\[Conformance\\]|\\[sig\\-network\\]\\sServices\\sshould\\sbe\\sable\\sto\\schange\\sthe\\stype\\sfrom\\sExternalName\\sto\\sNodePort\\s\\[Conformance\\]|\\[sig\\-network\\]\\sServices\\sshould\\sbe\\sable\\sto\\screate\\sa\\sfunctioning\\sNodePort\\sservice\\s\\[Conformance\\]|\\[sig\\-network\\]\\sServices\\sshould\\shave\\ssession\\saffinity\\swork\\sfor\\sNodePort\\sservice\\s\\[LinuxOnly\\]\\s\\[Conformance\\]|\\[sig\\-network\\]\\sServices\\sshould\\sbe\\sable\\sto\\sswitch\\ssession\\saffinity\\sfor\\sNodePort\\sservice\\s\\[LinuxOnly\\]\\s\\[Conformance\\]|\\[sig\\-network\\]\\sServices\\sshould\\shave\\ssession\\saffinity\\stimeout\\swork\\sfor\\sNodePort\\sservice\\s\\[LinuxOnly\\]\\s\\[Conformance\\]" \
--extract ${K8S_VERSION} \
--timeout=150m | tee $LOG_DIR/e2e.log
- name: Run image build and publish for cloud-provider-openstack
shell:
cmd: |
if [ '{{ zuul.pipeline }}' == 'periodic-14' ] && [ '{{ zuul.branch }}' == 'master' ]; then
set -ex
set -o pipefail
docker login -u ap-southeast-3@{{ swr.ak }} -p {{ swr.sk }} swr.ap-southeast-3.myhuaweicloud.com
export LOG_DIR='{{ k8s_log_dir }}'
export REGISTRY=${REGISTRY:-swr.ap-southeast-3.myhuaweicloud.com/openlab}
export ARCHS=${ARCHS:-amd64}
export VERSION=${VERSION:-latest}
make upload-images 2>&1 | tee $LOG_DIR/image-build-upload.log
else
exit 0;
fi
executable: /bin/bash
chdir: '{{ k8s_os_provider_src_dir }}'
environment: '{{ global_env }}'