Merge "Add Kubernetes job"
This commit is contained in:
37
.zuul.yaml
37
.zuul.yaml
@@ -15,10 +15,47 @@
|
|||||||
devstack_plugins:
|
devstack_plugins:
|
||||||
devstack-plugin-container: https://opendev.org/openstack/devstack-plugin-container
|
devstack-plugin-container: https://opendev.org/openstack/devstack-plugin-container
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: devstack-plugin-container-k8s
|
||||||
|
parent: devstack-minimal
|
||||||
|
nodeset: openstack-two-node-bionic
|
||||||
|
pre-run: playbooks/devstack-plugin-container-k8s/pre.yaml
|
||||||
|
run: playbooks/devstack-plugin-container-k8s/run.yaml
|
||||||
|
post-run: playbooks/devstack-plugin-container-k8s/post.yaml
|
||||||
|
timeout: 7200
|
||||||
|
required-projects:
|
||||||
|
- openstack/devstack
|
||||||
|
- openstack/devstack-gate
|
||||||
|
- openstack/devstack-plugin-container
|
||||||
|
vars:
|
||||||
|
devstack_services:
|
||||||
|
# Ignore any default set by devstack. Emit a "disable_all_services".
|
||||||
|
base: false
|
||||||
|
etcd3: true
|
||||||
|
container: true
|
||||||
|
k8s-master: true
|
||||||
|
devstack_localrc:
|
||||||
|
K8S_TOKEN: "9agf12.zsu5uh2m4pzt3qba"
|
||||||
|
USE_PYTHON3: true
|
||||||
|
devstack_plugins:
|
||||||
|
devstack-plugin-container: https://opendev.org/openstack/devstack-plugin-container
|
||||||
|
group-vars:
|
||||||
|
subnode:
|
||||||
|
devstack_services:
|
||||||
|
# Ignore any default set by devstack. Emit a "disable_all_services".
|
||||||
|
base: false
|
||||||
|
container: true
|
||||||
|
k8s-node: true
|
||||||
|
devstack_localrc:
|
||||||
|
K8S_TOKEN: "9agf12.zsu5uh2m4pzt3qba"
|
||||||
|
USE_PYTHON3: true
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- devstack-plugin-container-dsvm
|
- devstack-plugin-container-dsvm
|
||||||
|
- devstack-plugin-container-k8s:
|
||||||
|
voting: false
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- devstack-plugin-container-dsvm
|
- devstack-plugin-container-dsvm
|
||||||
|
@@ -7,6 +7,7 @@ ENABLE_CLEAR_CONTAINER=${ENABLE_CLEAR_CONTAINER:-false}
|
|||||||
ENABLE_KATA_CONTAINERS=${ENABLE_KATA_CONTAINERS:-false}
|
ENABLE_KATA_CONTAINERS=${ENABLE_KATA_CONTAINERS:-false}
|
||||||
ENABLE_LIVE_RESTORE=${ENABLE_LIVE_RESTORE:-false}
|
ENABLE_LIVE_RESTORE=${ENABLE_LIVE_RESTORE:-false}
|
||||||
ENABLE_IPV6=${ENABLE_IPV6:-false}
|
ENABLE_IPV6=${ENABLE_IPV6:-false}
|
||||||
|
K8S_NETWORK_ADDON=${K8S_NETWORK_ADDON:-flannel}
|
||||||
|
|
||||||
# Enable container services
|
# Enable container services
|
||||||
enable_service container
|
enable_service container
|
||||||
|
4
playbooks/devstack-plugin-container-k8s/post.yaml
Normal file
4
playbooks/devstack-plugin-container-k8s/post.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
- hosts: all
|
||||||
|
roles:
|
||||||
|
- fetch_docker_log
|
||||||
|
- fetch_kubelet_log
|
3
playbooks/devstack-plugin-container-k8s/pre.yaml
Normal file
3
playbooks/devstack-plugin-container-k8s/pre.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
- hosts: all
|
||||||
|
roles:
|
||||||
|
- orchestrate-devstack
|
29
playbooks/devstack-plugin-container-k8s/run.yaml
Normal file
29
playbooks/devstack-plugin-container-k8s/run.yaml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
- hosts: controller
|
||||||
|
name: Verify that k8s is installed correctly by running a pod
|
||||||
|
tasks:
|
||||||
|
- shell:
|
||||||
|
cmd: |
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
kubectl get nodes
|
||||||
|
kubectl get pods --namespace kube-system
|
||||||
|
|
||||||
|
tmpfile=$(mktemp)
|
||||||
|
cat <<EOT > $tmpfile
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: myapp-pod
|
||||||
|
labels:
|
||||||
|
app: myapp
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: myapp-container
|
||||||
|
image: busybox
|
||||||
|
command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']
|
||||||
|
EOT
|
||||||
|
kubectl create -f $tmpfile
|
||||||
|
kubectl wait --for=condition=Ready pod myapp-pod
|
||||||
|
become: true
|
||||||
|
become_user: stack
|
1
roles/fetch_kubelet_log/README.rst
Normal file
1
roles/fetch_kubelet_log/README.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Collect kubelet log from test run
|
22
roles/fetch_kubelet_log/tasks/main.yaml
Normal file
22
roles/fetch_kubelet_log/tasks/main.yaml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
- name: Ensure log path exists
|
||||||
|
become: yes
|
||||||
|
file:
|
||||||
|
path: "{{ ansible_user_dir }}/logs"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ ansible_user }}"
|
||||||
|
group: "{{ ansible_user }}"
|
||||||
|
mode: 0775
|
||||||
|
|
||||||
|
- name: Store kubelet log in {{ ansible_user_dir }}/logs
|
||||||
|
become: yes
|
||||||
|
shell:
|
||||||
|
cmd: |
|
||||||
|
sudo journalctl -o short-precise --unit kubelet | sudo tee {{ ansible_user_dir }}/logs/kubelet.log > /dev/null
|
||||||
|
|
||||||
|
- name: Set kubelet.log file permissions
|
||||||
|
become: yes
|
||||||
|
file:
|
||||||
|
path: '{{ ansible_user_dir }}/logs/kubelet.log'
|
||||||
|
owner: '{{ ansible_user }}'
|
||||||
|
group: '{{ ansible_user }}'
|
||||||
|
mode: 0644
|
Reference in New Issue
Block a user