From b8c3bbd365710057de1ebd375322f1ad10f2930e Mon Sep 17 00:00:00 2001 From: Jens Reimann Date: Thu, 23 Jul 2020 13:50:17 +0200 Subject: [PATCH 1/2] 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..932f044ee97 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 oc apply -n {{ namespace }} -f "$i"; done + with: not enable_iot + +- name: Install the IoT CRDs + shell: oc apply -n {{ namespace }} -f {{ playbook_dir }}/install/crds + with: enable_iot 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") { From 723b00750c1701e0e2018a00dbe0fd4aee304b76 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Fri, 24 Jul 2020 16:15:20 +0100 Subject: [PATCH 2/2] with -> when default to install iot true (maintains existing behaviour) exclude crds directory itself from the find results --- ansible/inventory/with-standard-authservice.txt | 1 + ansible/roles/cluster_admin/defaults/main.yml | 2 +- ansible/roles/crds/tasks/main.yml | 11 +++++------ ansible/roles/defaults/defaults/main.yml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ansible/inventory/with-standard-authservice.txt b/ansible/inventory/with-standard-authservice.txt index 37f75f5d985..61f87a3c6e2 100644 --- a/ansible/inventory/with-standard-authservice.txt +++ b/ansible/inventory/with-standard-authservice.txt @@ -4,6 +4,7 @@ localhost ansible_connection=local [enmasse:vars] namespace=enmasse-infra enable_rbac=True +enable_iot=True service_catalog=False keycloak_admin_password=admin authentication_services=["standard"] diff --git a/ansible/roles/cluster_admin/defaults/main.yml b/ansible/roles/cluster_admin/defaults/main.yml index ae13c7c1962..f3d1afb5039 100644 --- a/ansible/roles/cluster_admin/defaults/main.yml +++ b/ansible/roles/cluster_admin/defaults/main.yml @@ -1,4 +1,4 @@ --- monitoring_operator: False monitoring: False -enable_iot: False +enable_iot: True diff --git a/ansible/roles/crds/tasks/main.yml b/ansible/roles/crds/tasks/main.yml index 932f044ee97..4817bbeeae5 100644 --- a/ansible/roles/crds/tasks/main.yml +++ b/ansible/roles/crds/tasks/main.yml @@ -1,10 +1,9 @@ --- -- name: Install the CRDs - shell: oc apply -n {{ namespace }} -f {{ playbook_dir }}/install/crds +- name: Install the core CRDs (excluding IoT) shell: | - for i in $(find "{{ playbook_dir }}/install/crds" ! -name "010-iot*"); do oc apply -n {{ namespace }} -f "$i"; done - with: not enable_iot + for i in $(find "{{ playbook_dir }}/install/crds" -type f ! -name "010-iot*"); do oc apply -f "$i"; done + when: not enable_iot -- name: Install the IoT CRDs +- name: Install the CRDs (including IoT) shell: oc apply -n {{ namespace }} -f {{ playbook_dir }}/install/crds - with: enable_iot + when: enable_iot diff --git a/ansible/roles/defaults/defaults/main.yml b/ansible/roles/defaults/defaults/main.yml index ad853e64eac..96eb074f845 100644 --- a/ansible/roles/defaults/defaults/main.yml +++ b/ansible/roles/defaults/defaults/main.yml @@ -2,7 +2,7 @@ enmasse_serviceaccount: enmasse-admin enmasse_environment: development enable_rbac: true -enable_iot: false +enable_iot: true keycloak_admin_user: admin service_catalog: false standard_authservice_resources: standard_authservice_keycloak