hitachienergy / epiphany

Cloud and on-premises automation for Kubernetes centered industrial grade solutions.
Apache License 2.0
138 stars 107 forks source link

Fix configuration/feature-mapping enabling #3189

Closed plirglo closed 2 years ago

plirglo commented 2 years ago

Is your feature request related to a problem? Please describe. Even if role is set up enabled: false is installed if is listed in roles_mapping list.

kind: configuration/feature-mapping
title: Feature mapping to roles
name: default
specification:
  available_roles:
  - name: postgresql
    enabled: true
  roles_mapping:
    single_machine:
    - repository
    - image-registry
    - kubernetes-master
    - helm
    - applications
    - rabbitmq
    - postgresql
    - firewall

Currently to not run role, role has to be removed from role_mapping list.

Describe the solution you'd like Role should not be run if it's set up to false: enabled: false


DoD checklist

seriva commented 2 years ago

Sounds like something we have seen before: #2425

seriva commented 2 years ago

@plirglo This is actually not a bug but a feature ;) available_roles is a named list, so if you want to define it partially and merge it with the other entries from default you need to define the _merge tag:

kind: configuration/feature-mapping
title: Feature mapping to roles
name: default
specification:
  available_roles:
  - _merge: true
  - name: postgresql
    enabled: true
  roles_mapping:
    single_machine:
    - repository
    - image-registry
    - kubernetes-master
    - helm
    - applications
    - rabbitmq
    - postgresql
    - firewall

Otherwise it will not merge but use the entire listing in defaults. More information here: https://github.com/epiphany-platform/epiphany/blob/develop/docs/home/howto/CONFIGURATION_FILE.md

plirglo commented 2 years ago

I agree, i was testing this wrong way. I think we can close this issue.

seriva commented 2 years ago

Ok so after re-reviewing this with @plirglo it turns out things are being added to the inventory, just not executed on a playbook level. However this can still cause issues with pre-flight checks. Re-opening and implementing fix to remove roles from inventory as well.