2 # ============LICENSE_START=======================================================
3 # Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
20 - name: Make sure "{{ istio_work_dir }}" exists
22 path: "{{ istio_work_dir }}"
25 # TODO: validate download checksum
26 - name: Download the installation files
28 src: "{{ istio_download_url }}"
29 dest: "{{ istio_work_dir }}"
32 http_proxy: "{{ lookup('env','http_proxy') }}"
33 https_proxy: "{{ lookup('env','https_proxy') }}"
34 no_proxy: "{{ lookup('env','no_proxy') }}"
36 - name: List existing installation of Istio
37 shell: helm list | awk '{print $1}' | grep istio
38 register: installed_istio_charts
43 - name: Delete existing installation of Istio
44 command: helm delete --purge "{{ item }}"
45 loop: "{{ installed_istio_charts.stdout_lines }}"
50 # This solves this bug: https://github.com/ansible/ansible/issues/47081 with the k8s module which is caused
51 # due to the presence of --- at the end of the yaml file.
52 - name: Fix upstream Istio CRDs
60 - "{{ istio_work_dir }}/istio-{{ istio_version }}/install/kubernetes/helm/istio-init/files/*"
64 - name: Delete existing Istio CRDs
66 api_version: apiextensions.k8s.io/v1beta1
67 kind: CustomResourceDefinition
71 - "{{ istio_work_dir }}/istio-{{ istio_version }}/install/kubernetes/helm/istio-init/files/*"
75 - name: Delete Istio init namespace
77 name: "{{ istio_init_namespace }}"
84 # This can be avoided when we update Ansible to 2.8 version as is included in k8s module
85 - name: Verify Istio init namespace deletion
88 name: "{{ istio_init_namespace }}"
89 register: namespace_status
90 until: not namespace_status.resources
96 - name: Delete Istio namespace
98 name: "{{ istio_namespace }}"
105 # This can be avoided when we update Ansible to 2.8 version as is included in k8s module
106 - name: Verify Istio init namespace deletion
109 name: "{{ istio_namespace }}"
110 register: namespace_status
111 until: not namespace_status.resources
117 - name: Install and bootstrap Istio CRDs
119 helm install "{{ istio_work_dir }}"/istio-"{{ istio_version }}"/install/kubernetes/helm/istio-init
120 --name "{{ istio_init_release_name }}"
121 --namespace "{{ istio_init_namespace }}"
124 - name: Verify the commitment of all Istio CRDs
126 kind: CustomResourceDefinition
127 api: apiextensions.k8s.io/v1beta1
131 until: crd_status.resources|length >= 23
135 - name: Install Istio configuration profile
137 helm install "{{ istio_work_dir }}"/istio-"{{ istio_version }}"/install/kubernetes/helm/istio
138 --name "{{ istio_release_name }}"
139 --namespace "{{ istio_namespace }}"
142 - name: Verify Istio service existence
145 namespace: "{{ istio_namespace }}"
148 register: istio_service_status
149 until: istio_service_status.resources is defined
153 - name: Wait until Istio pods are ready
156 namespace: "{{ istio_namespace }}"
160 - status.phase=Running
161 register: istio_pod_status
163 - istio_pod_status.resources is defined
164 - istio_pod_status.resources
168 - name: Add istioctl CLI bin to path
171 src: '{{ istio_work_dir }}/istio-{{ istio_version }}/bin/istioctl'
172 dest: '/usr/local/bin/istioctl'
176 # vim: set ts=2 sw=2 expandtab: