diff --git a/roles/ensure-kubernetes/README.rst b/roles/ensure-kubernetes/README.rst index aaf75a16d..22348ac92 100644 --- a/roles/ensure-kubernetes/README.rst +++ b/roles/ensure-kubernetes/README.rst @@ -23,3 +23,8 @@ An ansible role to install kubernetes. Which kubernetes runtime to use; values are ``docker`` or ``cri-o``. + +.. zuul:rolevar:: ensure_kubernetes_minikube_addons + :default: [] + + List of addons to configure in k8s. Use this to enable the addons. \ No newline at end of file diff --git a/roles/ensure-kubernetes/defaults/main.yaml b/roles/ensure-kubernetes/defaults/main.yaml index d9cc6f4fb..1bc8767f9 100644 --- a/roles/ensure-kubernetes/defaults/main.yaml +++ b/roles/ensure-kubernetes/defaults/main.yaml @@ -1,4 +1,5 @@ install_kubernetes_with_cluster: True minikube_version: latest minikube_dns_resolvers: [] +ensure_kubernetes_minikube_addons: [] kubernetes_runtime: docker diff --git a/roles/ensure-kubernetes/tasks/minikube.yaml b/roles/ensure-kubernetes/tasks/minikube.yaml index 51e44274f..08361d61c 100644 --- a/roles/ensure-kubernetes/tasks/minikube.yaml +++ b/roles/ensure-kubernetes/tasks/minikube.yaml @@ -38,7 +38,7 @@ - name: Default args set_fact: - minikube_args: "" + extra_args: "" - name: Configure dns options if set block: @@ -49,12 +49,20 @@ mode: "0444" - name: Set extra kube setttings 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 - name: Start Minikube 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: MINIKUBE_WANTUPDATENOTIFICATION: false MINIKUBE_WANTREPORTERRORPROMPT: false