Merge "Allow for overriding dns resolvers in install-kubernetes"
This commit is contained in:
commit
6d5826844a
@ -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.
|
||||
|
@ -1,2 +1,3 @@
|
||||
install_kubernetes_with_cluster: True
|
||||
minikube_version: latest
|
||||
minikube_dns_resolvers: []
|
||||
|
@ -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
|
||||
|
3
roles/install-kubernetes/templates/resolv.conf.j2
Normal file
3
roles/install-kubernetes/templates/resolv.conf.j2
Normal file
@ -0,0 +1,3 @@
|
||||
{% for x in minikube_dns_resolvers %}
|
||||
nameserver {{ x }}
|
||||
{% endfor %}
|
8
test-playbooks/install-kubernetes.yaml
Normal file
8
test-playbooks/install-kubernetes.yaml
Normal 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'
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user