[ANSIBLE][BUILD] Provision strimzi-kafka-operator
Jakarta requires Strimzi Kafka Operator to be installed in the k8s cluster
Change-Id: Id648c7f1e060923df5a5761daf3f2d20f4a49e39
Issue-ID: OOM-2948
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
diff --git a/ansible/group_vars/infrastructure.yml b/ansible/group_vars/infrastructure.yml
index 0861be1..7fb8e18 100755
--- a/ansible/group_vars/infrastructure.yml
+++ b/ansible/group_vars/infrastructure.yml
@@ -30,3 +30,4 @@
kube_prometheus_stack_enabled: false
kube_prometheus_stack_version: 32.2.1
cert_manager_version: 1.5.4
+strimzi_kafka_version: 0.28.0
diff --git a/ansible/roles/strimzi-kafka-operator/defaults/main.yml b/ansible/roles/strimzi-kafka-operator/defaults/main.yml
new file mode 100644
index 0000000..e543a58
--- /dev/null
+++ b/ansible/roles/strimzi-kafka-operator/defaults/main.yml
@@ -0,0 +1,8 @@
+---
+strimzi_kafka:
+ k8s_namespace: strimzi-system
+ helm_release_name: strimzi-kafka-operator
+ helm_timeout: "240s"
+ helm_values_file: "{{ app_data_path }}/strimzi_kafka.yaml"
+ helm_values:
+ watchAnyNamespace: true
diff --git a/ansible/roles/strimzi-kafka-operator/tasks/main.yml b/ansible/roles/strimzi-kafka-operator/tasks/main.yml
new file mode 100644
index 0000000..d632516
--- /dev/null
+++ b/ansible/roles/strimzi-kafka-operator/tasks/main.yml
@@ -0,0 +1,22 @@
+---
+- name: Check {{ strimzi_kafka.helm_release_name }} helm package exists
+ stat:
+ path: "{{ app_data_path }}/downloads/strimzi-kafka-operator-helm-3-chart-{{ strimzi_kafka_version }}.tgz"
+ register: strimzi_kafka_package_stat
+ failed_when: not strimzi_kafka_package_stat.stat.exists
+
+- name: Generate helm values file
+ copy:
+ dest: "{{ strimzi_kafka.helm_values_file }}"
+ content: "{{ strimzi_kafka.helm_values | to_nice_yaml }}"
+
+- name: "Install Helm release {{ strimzi_kafka.helm_release_name }}"
+ community.kubernetes.helm:
+ release_name: "{{ strimzi_kafka.helm_release_name }}"
+ release_namespace: "{{ strimzi_kafka.k8s_namespace }}"
+ create_namespace: True
+ chart_ref: "{{ app_data_path }}/downloads/strimzi-kafka-operator-helm-3-chart-{{ strimzi_kafka_version }}.tgz"
+ values_files: "{{ strimzi_kafka.helm_values_file }}"
+ wait: True
+ wait_timeout: "{{ strimzi_kafka.helm_timeout }}"
+ tags: molecule-notest
diff --git a/ansible/site.yml b/ansible/site.yml
index 5308abf..44a3ce0 100644
--- a/ansible/site.yml
+++ b/ansible/site.yml
@@ -20,4 +20,5 @@
- import_playbook: kube_prometheus.yml
when: kube_prometheus_stack_enabled
- import_playbook: cert_manager.yml
+- import_playbook: strimzi_kafka.yml
- import_playbook: application.yml
diff --git a/ansible/strimzi_kafka.yml b/ansible/strimzi_kafka.yml
new file mode 100644
index 0000000..05eba18
--- /dev/null
+++ b/ansible/strimzi_kafka.yml
@@ -0,0 +1,5 @@
+---
+- name: Provision strimzi-kafka-operator into Kubernetes cluster
+ hosts: infrastructure
+ roles:
+ - strimzi-kafka-operator
diff --git a/build/data_lists/strimzi_kafka_docker_images.list b/build/data_lists/strimzi_kafka_docker_images.list
new file mode 100644
index 0000000..b426de0
--- /dev/null
+++ b/build/data_lists/strimzi_kafka_docker_images.list
@@ -0,0 +1 @@
+quay.io/strimzi/operator:0.28.0
diff --git a/build/data_lists/strimzi_kafka_http.list b/build/data_lists/strimzi_kafka_http.list
new file mode 100644
index 0000000..c8d0ebe
--- /dev/null
+++ b/build/data_lists/strimzi_kafka_http.list
@@ -0,0 +1 @@
+https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.28.0/strimzi-kafka-operator-helm-3-chart-0.28.0.tgz
diff --git a/build/package.py b/build/package.py
index f0afcfc..3252faa 100755
--- a/build/package.py
+++ b/build/package.py
@@ -249,7 +249,8 @@
'**/helm-push_*_linux_amd64.tar.gz',
'**/kube-prometheus-stack-*.tgz',
'**/cert-manager-*.tgz',
- '**/cmctl-linux-amd64.tar.gz']
+ '**/cmctl-linux-amd64.tar.gz',
+ '**/strimzi-kafka-operator-helm-3-chart-*.tgz']
for pattern in bin_pattern_list:
for bin_file in glob.glob(os.path.join('.', pattern), recursive=True):