From 319db37538fe9de57ef27dcfeff385b2c1bc0494 Mon Sep 17 00:00:00 2001 From: Jens Reimann Date: Thu, 23 Jul 2020 13:50:17 +0200 Subject: [PATCH] Allow excluding IoT CRDs during Ansible installation (fixes #5046) --- ansible/roles/crds/tasks/main.yml | 7 ++++++ ansible/roles/enmasse_operator/tasks/main.yml | 3 +++ ansible/roles/iot/tasks/main.yml | 2 +- cmd/controller-manager/main.go | 25 +++++++++++-------- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ansible/roles/crds/tasks/main.yml b/ansible/roles/crds/tasks/main.yml index e8bcae8a67f..d3bfd0b594d 100644 --- a/ansible/roles/crds/tasks/main.yml +++ b/ansible/roles/crds/tasks/main.yml @@ -1,3 +1,10 @@ --- - name: Install the CRDs shell: oc apply -n {{ namespace }} -f {{ playbook_dir }}/install/crds + shell: | + for i in $(find "{{ playbook_dir }}/install/crds" ! -name "010-iot*"); do echo $i; done + with: not enable_iot + +- name: Install the IoT CRDs + shell: oc apply -n {{ namespace }} -f {{ playbook_dir }}/install/crds + with: enable_iot \ No newline at end of file diff --git a/ansible/roles/enmasse_operator/tasks/main.yml b/ansible/roles/enmasse_operator/tasks/main.yml index ff3f2c1ab7c..5df67c3dba0 100644 --- a/ansible/roles/enmasse_operator/tasks/main.yml +++ b/ansible/roles/enmasse_operator/tasks/main.yml @@ -1,3 +1,6 @@ --- - name: Apply the EnMasse Operator shell: oc apply -n {{ namespace }} -f {{ playbook_dir }}/install/enmasse-operator +- name: Disable IoT modules + shell: oc set env deployment/enmasse-operator CONTROLLER_ENABLE_IOT_CONFIG=false CONTROLLER_ENABLE_IOT_PROJECT=false + when: not enable_iot diff --git a/ansible/roles/iot/tasks/main.yml b/ansible/roles/iot/tasks/main.yml index e974036c51e..0cb14585b7d 100644 --- a/ansible/roles/iot/tasks/main.yml +++ b/ansible/roles/iot/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: Apply the IoT CRD +- name: Apply the IoT API Roles shell: oc apply -n {{ namespace }} -f {{ playbook_dir }}/install/iot/api - name: Apply the IoT Common shell: oc apply -n {{ namespace }} -f {{ playbook_dir }}/install/iot/common diff --git a/cmd/controller-manager/main.go b/cmd/controller-manager/main.go index 6343ac979f2..4588a60f14e 100644 --- a/cmd/controller-manager/main.go +++ b/cmd/controller-manager/main.go @@ -162,16 +162,21 @@ func main() { Version: "v1beta1", Kind: "AddressList", }, - schema.GroupVersionKind{ - Group: "iot.enmasse.io", - Version: "v1alpha1", - Kind: "IoTProject", - }, - schema.GroupVersionKind{ - Group: "iot.enmasse.io", - Version: "v1alpha1", - Kind: "IoTProjectList", - }, + } + + if util.IsModuleEnabled("IOT_PROJECT") { + globalGvks = append(globalGvks, + schema.GroupVersionKind{ + Group: "iot.enmasse.io", + Version: "v1alpha1", + Kind: "IoTProject", + }, + schema.GroupVersionKind{ + Group: "iot.enmasse.io", + Version: "v1alpha1", + Kind: "IoTProjectList", + }, + ) } if util.IsModuleEnabled("MESSAGING_INFRASTRUCTURE") {