
This change enables using real kubernetes pod label for the integration tests. Depends-On: https://review.opendev.org/715308 Change-Id: I24448bf1edb6c546475796a06cf8cbe456716c32
145 lines
4.3 KiB
YAML
145 lines
4.3 KiB
YAML
- name: install and start zuul operator
|
|
hosts: all
|
|
tasks:
|
|
- name: Setup CRD
|
|
command: make install
|
|
args:
|
|
chdir: "{{ zuul.projects['opendev.org/zuul/zuul-operator'].src_dir }}"
|
|
|
|
- name: Generate executor ssh key
|
|
command: ssh-keygen -t rsa -m PEM -N '' -f 'id_rsa' -q -C 'zuul-executor'
|
|
args:
|
|
creates: id_rsa
|
|
|
|
# Note: Using lookup(file) is somehow failing with 'NoneType' object has no attribute 'startswith'
|
|
- name: Read generated ssh key
|
|
command: cat id_rsa
|
|
register: _ssh_key
|
|
|
|
- name: Read generated kubectl configuration
|
|
command: |
|
|
sed -e 's#/home/zuul/.minikube/profiles/minikube/#/etc/nodepool-kubernetes/#g'
|
|
-e 's#/home/zuul/.minikube/#/etc/nodepool-kubernetes/#g'
|
|
~/.kube/config
|
|
register: _kube_config
|
|
|
|
- name: Read client cert
|
|
command: cat ~/.minikube/profiles/minikube/client.crt
|
|
register: _kube_cert
|
|
|
|
- name: Read client key
|
|
command: cat ~/.minikube/profiles/minikube/client.key
|
|
register: _kube_key
|
|
|
|
- name: Read ca cert
|
|
command: cat ~/.minikube/ca.crt
|
|
register: _kube_ca
|
|
|
|
- name: Read current context name
|
|
command: kubectl config current-context
|
|
register: _kube_context
|
|
|
|
- name: Setup user provided secrets
|
|
k8s:
|
|
namespace: "{{ namespace }}"
|
|
definition:
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: "{{ item.name }}"
|
|
stringData: "{{ item.data }}"
|
|
loop:
|
|
- name: executor-ssh-key
|
|
data:
|
|
id_rsa: "{{ _ssh_key.stdout }}"
|
|
|
|
- name: zuul-yaml-conf
|
|
data:
|
|
main.yaml: |
|
|
- tenant:
|
|
name: local
|
|
source:
|
|
opendev.org:
|
|
config-projects:
|
|
- zuul/zuul-base-jobs
|
|
untrusted-projects:
|
|
- zuul/zuul-jobs
|
|
|
|
- name: nodepool-yaml-conf
|
|
data:
|
|
nodepool.yaml: |
|
|
labels:
|
|
- name: pod-fedora-31
|
|
min-ready: 1
|
|
providers:
|
|
- name: kube-cluster
|
|
driver: kubernetes
|
|
context: {{ _kube_context.stdout }}
|
|
max-pods: 15
|
|
pools:
|
|
- name: default
|
|
labels:
|
|
- name: pod-fedora-31
|
|
type: pod
|
|
image: docker.io/fedora:31
|
|
python-path: /bin/python3
|
|
|
|
- name: nodepool-kube-config
|
|
data:
|
|
kube.config: "{{ _kube_config.stdout }}"
|
|
client.crt: "{{ _kube_cert.stdout }}"
|
|
client.key: "{{ _kube_key.stdout }}"
|
|
ca.crt: "{{ _kube_ca.stdout }}"
|
|
|
|
- name: Deploy CR
|
|
include_tasks: tasks/apply_cr.yaml
|
|
vars:
|
|
spec:
|
|
executor:
|
|
count: 1
|
|
ssh_key:
|
|
secretName: executor-ssh-key
|
|
merger:
|
|
count: 1
|
|
scheduler:
|
|
config:
|
|
secretName: zuul-yaml-conf
|
|
launcher:
|
|
config:
|
|
secretName: nodepool-yaml-conf
|
|
connections:
|
|
gits:
|
|
- baseurl: https://opendev.org
|
|
name: opendev.org
|
|
external_config:
|
|
kubernetes:
|
|
secretName: nodepool-kube-config
|
|
key: kube.config
|
|
|
|
|
|
- name: Wait maximum 4 minutes for the scheduler pod
|
|
shell: |
|
|
for idx in $(seq 24); do
|
|
date;
|
|
for res in statefulsets deployments pods; do echo == $res ==; kubectl get $res; done
|
|
kubectl get pod zuul-scheduler-0 2> /dev/null && break || :
|
|
sleep 10;
|
|
done
|
|
|
|
- name: Wait 2 minutes for the scheduler pod to be ready
|
|
command: kubectl wait --for=condition=Ready --timeout=120s pod/zuul-scheduler-0
|
|
|
|
- name: Wait 4 minutes for scheduler to settle
|
|
command: kubectl logs pod/zuul-scheduler-0
|
|
register: _scheduler_log
|
|
until: "'Full reconfiguration complete' in _scheduler_log.stdout"
|
|
delay: 10
|
|
retries: 24
|
|
|
|
- name: Wait 2 minutes for the executor pod to be ready
|
|
command: kubectl wait --for=condition=Ready --timeout=120s pod/zuul-executor-0
|
|
|
|
- name: Wait an extra 2 minutes for the services to settle
|
|
pause:
|
|
minutes: 2
|