Skip to content

Commit 12ff9e0

Browse files
authored
Merge pull request apache#121 from dims/ci-job-for-kubernetes-conformance-tests
harness to run kubernetes e2e tests
2 parents 33d5405 + 8f61da3 commit 12ff9e0

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- hosts: all
2+
become: yes
3+
tasks:
4+
- name: Clean up resources
5+
shell:
6+
cmd: |
7+
set -e
8+
set -x
9+
cd ${GOPATH}/src/k8s.io/kubernetes
10+
cluster/kubectl.sh config use-context local
11+
cluster/kubectl.sh delete -f '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/examples/persistent-volume-provisioning/cinder/cinder-in-tree-full.yaml'
12+
executable: /bin/bash
13+
environment: '{{ golang_env }}'
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
- hosts: all
2+
become: yes
3+
tasks:
4+
- shell:
5+
cmd: |
6+
# use echo to delete extra spaces
7+
export OS_AUTH_TYPE=$(echo '{{ vexxhost_credentials.auth_type }}')
8+
export OS_IDENTITY_API_VERSION=$(echo '{{ vexxhost_credentials.identity_api_version }}')
9+
export OS_VOLUME_API_VERSION=$(echo '{{ vexxhost_credentials.volume_api_version }}')
10+
export OS_INTERFACE=$(echo '{{ vexxhost_credentials.interface }}')
11+
export OS_AUTH_URL=$(echo '{{ vexxhost_credentials.auth_url }}')
12+
export OS_PROJECT_ID=$(echo '{{ vexxhost_credentials.project_id }}')
13+
export OS_PROJECT_NAME=$(echo '{{ vexxhost_credentials.project_name }}')
14+
export OS_USER_DOMAIN_NAME=$(echo '{{ vexxhost_credentials.user_domain_name }}')
15+
export OS_PROJECT_DOMAIN_ID=$(echo '{{ vexxhost_credentials.project_domain_id }}')
16+
export OS_USERNAME=$(echo '{{ vexxhost_credentials.username }}')
17+
export OS_PASSWORD=$(echo '{{ vexxhost_credentials.password }}')
18+
export OS_REGION_NAME=$(echo '{{ vexxhost_credentials.region_name }}')
19+
20+
set -x
21+
set -e
22+
set -o pipefail
23+
24+
# Create cloud-config
25+
mkdir -p /etc/kubernetes/
26+
cat << EOF >> /etc/kubernetes/cloud-config
27+
[Global]
28+
domain-name = $OS_USER_DOMAIN_NAME
29+
tenant-id = $OS_PROJECT_ID
30+
auth-url = $OS_AUTH_URL
31+
password = $OS_PASSWORD
32+
username = $OS_USERNAME
33+
region = $OS_REGION_NAME
34+
35+
[BlockStorage]
36+
bs-version = v2
37+
ignore-volume-az = yes
38+
EOF
39+
40+
# Go where we cloned kubernetes repository
41+
cd $GOPATH/src/k8s.io/kubernetes/
42+
export API_HOST_IP=$(ifconfig | awk '/^docker0/ {getline; print $2}' | awk -F ':' '{print $2}')
43+
export KUBELET_HOST="0.0.0.0"
44+
export ALLOW_SECURITY_CONTEXT=true
45+
export ENABLE_CRI=false
46+
export ENABLE_HOSTPATH_PROVISIONER=true
47+
export ENABLE_SINGLE_CA_SIGNER=true
48+
export KUBE_ENABLE_CLUSTER_DNS=false
49+
export LOG_LEVEL=4
50+
# We want to use the openstack cloud provider
51+
export CLOUD_PROVIDER=openstack
52+
# DO NOT change the location of the cloud-config file. It is important for the old cinder provider to work
53+
export CLOUD_CONFIG=/etc/kubernetes/cloud-config
54+
55+
# location of where the kubernetes processes log their output
56+
mkdir -p '{{ ansible_user_dir }}/workspace/logs/kubernetes'
57+
export LOG_DIR='{{ ansible_user_dir }}/workspace/logs/kubernetes'
58+
# We need this for one of the conformance tests
59+
export ALLOW_PRIVILEGED=true
60+
# Just kick off all the processes and drop down to the command line
61+
export ENABLE_DAEMON=true
62+
export HOSTNAME_OVERRIDE=$(curl http://169.254.169.254/openstack/latest/meta_data.json | python -c "import sys, json; print json.load(sys.stdin)['name']")
63+
export MAX_TIME_FOR_URL_API_SERVER=5
64+
65+
# -E preserves the current env vars, but we need to special case PATH
66+
sudo -E PATH=$PATH SHELLOPTS=$SHELLOPTS ./hack/local-up-cluster.sh -O
67+
68+
# set up the config we need for kubectl to work
69+
cluster/kubectl.sh config set-cluster local --server=https://localhost:6443 --certificate-authority=/var/run/kubernetes/server-ca.crt
70+
cluster/kubectl.sh config set-credentials myself --client-key=/var/run/kubernetes/client-admin.key --client-certificate=/var/run/kubernetes/client-admin.crt
71+
cluster/kubectl.sh config set-context local --cluster=local --user=myself
72+
cluster/kubectl.sh config use-context local
73+
74+
# Sleep to wait for creating serviceaccount default/default complete
75+
sleep 5
76+
# Remove node taint
77+
cluster/kubectl.sh taint nodes "$HOSTNAME_OVERRIDE" node.cloudprovider.kubernetes.io/uninitialized-
78+
79+
# Set admin kubeconfig for running e2e tests
80+
export KUBECONFIG=/var/run/kubernetes/admin.kubeconfig
81+
82+
# Build kubetest
83+
go get -u k8s.io/test-infra/kubetest
84+
# Build all binaries
85+
export KUBE_FASTBUILD=true
86+
87+
set -e
88+
89+
# Run e2e test using local deployment/provider
90+
kubetest --dump=$LOG_DIR \
91+
--test \
92+
--build=quick \
93+
--deployment=local \
94+
--provider=local \
95+
--ginkgo-parallel=1 \
96+
--test_args="--ginkgo.focus=[Conformance] -v=8" \
97+
--timeout=120m
98+
executable: /bin/bash
99+
chdir: '{{ zuul.project.src_dir }}'
100+
environment: '{{ golang_env }}'

zuul.d/jobs.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,16 @@
270270
secrets:
271271
- vexxhost_credentials
272272

273+
- job:
274+
name: cloud-provider-openstack-acceptance-test-e2e-conformance
275+
parent: cloud-provider-openstack-acceptance-test
276+
description: |
277+
Run Kubernetes Conformance tests
278+
run: playbooks/cloud-provider-openstack-acceptance-test-e2e-conformance/run.yaml
279+
post-run: playbooks/cloud-provider-openstack-acceptance-test-e2e-conformance/post.yaml
280+
secrets:
281+
- vexxhost_credentials
282+
273283
- job:
274284
name: cloud-provider-openstack-acceptance-test-standalone-cinder
275285
parent: cloud-provider-openstack-acceptance-test

0 commit comments

Comments
 (0)