Add addons args in ensure-kubernetes role

Minikube provides addons and we can enable specific addons by passing the --addons arg when using minikube cli

Change-Id: I8d10e3a3dde1070b5c79406285035dacb59dddc8
This commit is contained in:
okozachenko 2020-05-28 16:04:38 +03:00
parent 8d90e3d4cb
commit e664a0215e
3 changed files with 17 additions and 3 deletions

View File

@ -23,3 +23,8 @@ An ansible role to install kubernetes.
Which kubernetes runtime to use; values are ``docker`` or Which kubernetes runtime to use; values are ``docker`` or
``cri-o``. ``cri-o``.
.. zuul:rolevar:: ensure_kubernetes_minikube_addons
:default: []
List of addons to configure in k8s. Use this to enable the addons.

View File

@ -1,4 +1,5 @@
install_kubernetes_with_cluster: True install_kubernetes_with_cluster: True
minikube_version: latest minikube_version: latest
minikube_dns_resolvers: [] minikube_dns_resolvers: []
ensure_kubernetes_minikube_addons: []
kubernetes_runtime: docker kubernetes_runtime: docker

View File

@ -38,7 +38,7 @@
- name: Default args - name: Default args
set_fact: set_fact:
minikube_args: "" extra_args: ""
- name: Configure dns options if set - name: Configure dns options if set
block: block:
@ -49,12 +49,20 @@
mode: "0444" mode: "0444"
- name: Set extra kube setttings - name: Set extra kube setttings
set_fact: set_fact:
minikube_args: "--extra-config=kubelet.resolv-conf={{ ansible_user_dir }}/.minikube/k8s_resolv.conf" extra_args: "--extra-config=kubelet.resolv-conf={{ ansible_user_dir }}/.minikube/k8s_resolv.conf"
when: minikube_dns_resolvers|length>0 when: minikube_dns_resolvers|length>0
- name: Start Minikube - name: Start Minikube
become: yes become: yes
command: "/tmp/minikube start --v=7 --vm-driver=none --container-runtime={{ kubernetes_runtime }} {{ minikube_args }}" command: >-
/tmp/minikube start
--v=7
--vm-driver=none
--container-runtime={{ kubernetes_runtime }}
{{ extra_args }}
{% for _addon in ensure_kubernetes_minikube_addons %}
--addons={{ _addon }}
{% endfor %}
environment: environment:
MINIKUBE_WANTUPDATENOTIFICATION: false MINIKUBE_WANTUPDATENOTIFICATION: false
MINIKUBE_WANTREPORTERRORPROMPT: false MINIKUBE_WANTREPORTERRORPROMPT: false