From fcf3202ba4c763dcf8bcb08fb519e295cd1e7616 Mon Sep 17 00:00:00 2001 From: vass Date: Wed, 1 Apr 2020 18:52:34 +0200 Subject: [PATCH] Rename install-kubernetes to ensure-kubernetes for consistency The old role will be kept and include ensure-kubernetes for backwards compatability. Change-Id: Ic0c18a833f4a07e123f8313673bd9c864d7d2919 --- doc/source/container-roles.rst | 1 + playbooks/helm/pre.yaml | 2 +- roles/ensure-kubernetes/README.rst | 25 ++++++++++++ .../defaults/main.yaml | 0 .../tasks/crio.yaml | 0 roles/ensure-kubernetes/tasks/main.yaml | 24 ++++++++++++ .../tasks/minikube.yaml | 0 .../templates/resolv.conf.j2 | 0 roles/install-kubernetes/README.rst | 26 +------------ roles/install-kubernetes/tasks/main.yaml | 27 ++----------- .../crio.yaml | 0 .../docker.yaml | 0 .../post.yaml | 0 .../registry/buildset-registry-k8s-crio.yaml | 2 +- .../buildset-registry-k8s-docker.yaml | 2 +- zuul-tests.d/container-roles-jobs.yaml | 38 +++++++++---------- 16 files changed, 76 insertions(+), 71 deletions(-) create mode 100644 roles/ensure-kubernetes/README.rst rename roles/{install-kubernetes => ensure-kubernetes}/defaults/main.yaml (100%) rename roles/{install-kubernetes => ensure-kubernetes}/tasks/crio.yaml (100%) create mode 100644 roles/ensure-kubernetes/tasks/main.yaml rename roles/{install-kubernetes => ensure-kubernetes}/tasks/minikube.yaml (100%) rename roles/{install-kubernetes => ensure-kubernetes}/templates/resolv.conf.j2 (100%) rename test-playbooks/{install-kubernetes => ensure-kubernetes}/crio.yaml (100%) rename test-playbooks/{install-kubernetes => ensure-kubernetes}/docker.yaml (100%) rename test-playbooks/{install-kubernetes => ensure-kubernetes}/post.yaml (100%) diff --git a/doc/source/container-roles.rst b/doc/source/container-roles.rst index 6c8f96ba9..3a32e1773 100644 --- a/doc/source/container-roles.rst +++ b/doc/source/container-roles.rst @@ -6,6 +6,7 @@ Container Roles .. zuul:autorole:: collect-container-logs .. zuul:autorole:: deploy-openshift .. zuul:autorole:: ensure-docker +.. zuul:autorole:: ensure-kubernetes .. zuul:autorole:: install-docker .. zuul:autorole:: install-kubernetes .. zuul:autorole:: install-openshift diff --git a/playbooks/helm/pre.yaml b/playbooks/helm/pre.yaml index 4394152a1..1bc701831 100644 --- a/playbooks/helm/pre.yaml +++ b/playbooks/helm/pre.yaml @@ -1,5 +1,5 @@ - hosts: all roles: - role: clear-firewall - - role: install-kubernetes + - role: ensure-kubernetes - role: ensure-helm diff --git a/roles/ensure-kubernetes/README.rst b/roles/ensure-kubernetes/README.rst new file mode 100644 index 000000000..aaf75a16d --- /dev/null +++ b/roles/ensure-kubernetes/README.rst @@ -0,0 +1,25 @@ +An ansible role to install kubernetes. + +**Role Variables** + +.. zuul:rolevar:: install_kubernetes_with_cluster + :default: True + + If true, installs a Minikube cluster. + +.. zuul:rolevar:: minikube_version + :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. + +.. zuul:rolevar:: kubernetes_runtime + :default: docker + + Which kubernetes runtime to use; values are ``docker`` or + ``cri-o``. diff --git a/roles/install-kubernetes/defaults/main.yaml b/roles/ensure-kubernetes/defaults/main.yaml similarity index 100% rename from roles/install-kubernetes/defaults/main.yaml rename to roles/ensure-kubernetes/defaults/main.yaml diff --git a/roles/install-kubernetes/tasks/crio.yaml b/roles/ensure-kubernetes/tasks/crio.yaml similarity index 100% rename from roles/install-kubernetes/tasks/crio.yaml rename to roles/ensure-kubernetes/tasks/crio.yaml diff --git a/roles/ensure-kubernetes/tasks/main.yaml b/roles/ensure-kubernetes/tasks/main.yaml new file mode 100644 index 000000000..fa350eb75 --- /dev/null +++ b/roles/ensure-kubernetes/tasks/main.yaml @@ -0,0 +1,24 @@ +- name: Install apt key + become: yes + apt_key: + url: "https://packages.cloud.google.com/apt/doc/apt-key.gpg" + state: present + +- name: Add kubernetes repo + become: yes + apt_repository: + repo: deb http://apt.kubernetes.io/ kubernetes-xenial main + state: present + +- name: Install kubernetes packages and dependencies + become: yes + apt: + name: + - conntrack + - kubectl + - liblz4-tool + update_cache: yes + +- name: Run cluster tasks + include_tasks: minikube.yaml + when: install_kubernetes_with_cluster diff --git a/roles/install-kubernetes/tasks/minikube.yaml b/roles/ensure-kubernetes/tasks/minikube.yaml similarity index 100% rename from roles/install-kubernetes/tasks/minikube.yaml rename to roles/ensure-kubernetes/tasks/minikube.yaml diff --git a/roles/install-kubernetes/templates/resolv.conf.j2 b/roles/ensure-kubernetes/templates/resolv.conf.j2 similarity index 100% rename from roles/install-kubernetes/templates/resolv.conf.j2 rename to roles/ensure-kubernetes/templates/resolv.conf.j2 diff --git a/roles/install-kubernetes/README.rst b/roles/install-kubernetes/README.rst index aaf75a16d..731606309 100644 --- a/roles/install-kubernetes/README.rst +++ b/roles/install-kubernetes/README.rst @@ -1,25 +1 @@ -An ansible role to install kubernetes. - -**Role Variables** - -.. zuul:rolevar:: install_kubernetes_with_cluster - :default: True - - If true, installs a Minikube cluster. - -.. zuul:rolevar:: minikube_version - :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. - -.. zuul:rolevar:: kubernetes_runtime - :default: docker - - Which kubernetes runtime to use; values are ``docker`` or - ``cri-o``. +.. warning:: Deprecated, use ensure-kubernetes instead. diff --git a/roles/install-kubernetes/tasks/main.yaml b/roles/install-kubernetes/tasks/main.yaml index fa350eb75..9008f4f0b 100644 --- a/roles/install-kubernetes/tasks/main.yaml +++ b/roles/install-kubernetes/tasks/main.yaml @@ -1,24 +1,3 @@ -- name: Install apt key - become: yes - apt_key: - url: "https://packages.cloud.google.com/apt/doc/apt-key.gpg" - state: present - -- name: Add kubernetes repo - become: yes - apt_repository: - repo: deb http://apt.kubernetes.io/ kubernetes-xenial main - state: present - -- name: Install kubernetes packages and dependencies - become: yes - apt: - name: - - conntrack - - kubectl - - liblz4-tool - update_cache: yes - -- name: Run cluster tasks - include_tasks: minikube.yaml - when: install_kubernetes_with_cluster +- name: Include ensure-kubernetes + include_role: + name: ensure-kubernetes diff --git a/test-playbooks/install-kubernetes/crio.yaml b/test-playbooks/ensure-kubernetes/crio.yaml similarity index 100% rename from test-playbooks/install-kubernetes/crio.yaml rename to test-playbooks/ensure-kubernetes/crio.yaml diff --git a/test-playbooks/install-kubernetes/docker.yaml b/test-playbooks/ensure-kubernetes/docker.yaml similarity index 100% rename from test-playbooks/install-kubernetes/docker.yaml rename to test-playbooks/ensure-kubernetes/docker.yaml diff --git a/test-playbooks/install-kubernetes/post.yaml b/test-playbooks/ensure-kubernetes/post.yaml similarity index 100% rename from test-playbooks/install-kubernetes/post.yaml rename to test-playbooks/ensure-kubernetes/post.yaml diff --git a/test-playbooks/registry/buildset-registry-k8s-crio.yaml b/test-playbooks/registry/buildset-registry-k8s-crio.yaml index 7bfabf644..840bd97d3 100644 --- a/test-playbooks/registry/buildset-registry-k8s-crio.yaml +++ b/test-playbooks/registry/buildset-registry-k8s-crio.yaml @@ -1,7 +1,7 @@ - hosts: all roles: - role: clear-firewall - - role: install-kubernetes + - role: ensure-kubernetes vars: minikube_dns_resolvers: - '1.1.1.1' diff --git a/test-playbooks/registry/buildset-registry-k8s-docker.yaml b/test-playbooks/registry/buildset-registry-k8s-docker.yaml index 5d78178ce..5724f131b 100644 --- a/test-playbooks/registry/buildset-registry-k8s-docker.yaml +++ b/test-playbooks/registry/buildset-registry-k8s-docker.yaml @@ -1,7 +1,7 @@ - hosts: all roles: - role: clear-firewall - - role: install-kubernetes + - role: ensure-kubernetes docker_use_buildset_registry: true tasks: - name: Wait for cluster to come up diff --git a/zuul-tests.d/container-roles-jobs.yaml b/zuul-tests.d/container-roles-jobs.yaml index b6fbdf0d7..98795329d 100644 --- a/zuul-tests.d/container-roles-jobs.yaml +++ b/zuul-tests.d/container-roles-jobs.yaml @@ -139,7 +139,7 @@ - roles/pull-from-intermediate-registry/.* - roles/push-to-intermediate-registry/.* - roles/ensure-docker/.* - - roles/install-kubernetes/.* + - roles/ensure-kubernetes/.* - roles/build-docker-image/.* - roles/run-buildset-registry/.* - roles/use-buildset-registry/.* @@ -162,7 +162,7 @@ - roles/pull-from-intermediate-registry/.* - roles/push-to-intermediate-registry/.* - roles/ensure-docker/.* - - roles/install-kubernetes/.* + - roles/ensure-kubernetes/.* - roles/build-docker-image/.* - roles/run-buildset-registry/.* - roles/use-buildset-registry/.* @@ -186,7 +186,7 @@ - roles/pull-from-intermediate-registry/.* - roles/push-to-intermediate-registry/.* - roles/ensure-docker/.* - - roles/install-kubernetes/.* + - roles/ensure-kubernetes/.* - roles/build-docker-image/.* - roles/run-buildset-registry/.* - roles/use-buildset-registry/.* @@ -226,34 +226,34 @@ label: centos-7 - job: - name: zuul-jobs-test-install-kubernetes-docker + name: zuul-jobs-test-ensure-kubernetes-docker description: | - Test the install-kubernetes role with docker + Test the ensure-kubernetes role with docker - This job tests changes to the install-kubernetes roles. It + This job tests changes to the ensure-kubernetes roles. It is not meant to be used directly but rather run on changes to roles in the zuul-jobs repo. files: - roles/ensure-docker/.* - - roles/install-kubernetes/.* - - test-playbooks/install-kubernetes/.* - run: test-playbooks/install-kubernetes/docker.yaml - post-run: test-playbooks/install-kubernetes/post.yaml + - roles/ensure-kubernetes/.* + - test-playbooks/ensure-kubernetes/.* + run: test-playbooks/ensure-kubernetes/docker.yaml + post-run: test-playbooks/ensure-kubernetes/post.yaml - job: - name: zuul-jobs-test-install-kubernetes-crio + name: zuul-jobs-test-ensure-kubernetes-crio description: | - Test the install-kubernetes role with crio-o + Test the ensure-kubernetes role with crio-o - This job tests changes to the install-kubernetes roles. It + This job tests changes to the ensure-kubernetes roles. It is not meant to be used directly but rather run on changes to roles in the zuul-jobs repo. files: - roles/ensure-docker/.* - - roles/install-kubernetes/.* - - test-playbooks/install-kubernetes/.* - run: test-playbooks/install-kubernetes/crio.yaml - post-run: test-playbooks/install-kubernetes/post.yaml + - roles/ensure-kubernetes/.* + - test-playbooks/ensure-kubernetes/.* + run: test-playbooks/ensure-kubernetes/crio.yaml + post-run: test-playbooks/ensure-kubernetes/post.yaml - job: name: zuul-jobs-test-install-podman @@ -288,8 +288,8 @@ - zuul-jobs-test-registry-buildset-registry-k8s-docker - zuul-jobs-test-registry-buildset-registry-k8s-crio - zuul-jobs-test-registry-buildset-registry-openshift-docker - - zuul-jobs-test-install-kubernetes-docker - - zuul-jobs-test-install-kubernetes-crio + - zuul-jobs-test-ensure-kubernetes-docker + - zuul-jobs-test-ensure-kubernetes-crio - zuul-jobs-test-install-podman gate: jobs: *id001