Merge "Allow for overriding dns resolvers in install-kubernetes"

This commit is contained in:
Zuul 2019-10-16 19:30:17 +00:00 committed by Gerrit Code Review
commit 6d5826844a
6 changed files with 54 additions and 1 deletions

View File

@ -11,3 +11,9 @@ An ansible role to install kubernetes.
:default: latest
The version of Minikube to install.
.. zuul:rolevar:: minikube_dns_resolvers
:default: []
List of dns resolvers to configure in k8s. Use this to override the
resolvers that are found by default.

View File

@ -1,2 +1,3 @@
install_kubernetes_with_cluster: True
minikube_version: latest
minikube_dns_resolvers: []

View File

@ -32,9 +32,25 @@
state: directory
mode: 0755
- name: Default args
set_fact:
minikube_args: ""
- name: Configure dns options if set
block:
- name: Write resolv.conf
template:
src: resolv.conf.j2
dest: "{{ ansible_user_dir }}/.minikube/k8s_resolv.conf"
mode: "0444"
- name: Set extra kube setttings
set_fact:
minikube_args: "--extra-config=kubelet.resolv-conf={{ ansible_user_dir }}/.minikube/k8s_resolv.conf"
when: minikube_dns_resolvers
- name: Start Minikube
become: yes
command: /tmp/minikube --vm-driver=none start
command: "/tmp/minikube --vm-driver=none start {{ minikube_args }}"
environment:
MINIKUBE_WANTUPDATENOTIFICATION: false
MINIKUBE_WANTREPORTERRORPROMPT: false

View File

@ -0,0 +1,3 @@
{% for x in minikube_dns_resolvers %}
nameserver {{ x }}
{% endfor %}

View File

@ -0,0 +1,8 @@
- hosts: primary
name: Install kubernetes with minikube
roles:
- role: install-kubernetes
vars:
minikube_dns_resolvers:
- '1.1.1.1'
- '8.8.8.8'

View File

@ -25,11 +25,30 @@
- name: builder
label: ubuntu-bionic
- job:
name: zuul-jobs-test-install-kubernetes
description: |
Test the install-kubernetes role
This job tests changes to the install-kubernetes roles. It
is not meant to be used directly but rather run on changes to
roles in the zuul-jobs repo.
files:
- roles/install-docker/.*
- roles/install-kubernetes/.*
- test-playbooks/install-kubernetes.yaml
run: test-playbooks/install-kubernetes.yaml
nodeset:
nodes:
- name: primary
label: ubuntu-bionic
# List all the jobs in this file.
- project:
check:
jobs: &id001
- zuul-jobs-test-registry
- zuul-jobs-test-install-kubernetes
gate:
jobs: *id001