redhat-cop / agnosticd

AgnosticD - Ansible Deployer for multiple Cloud Deployers
https://redhat-cop.github.io/agnosticd/
GNU General Public License v3.0
384 stars 493 forks source link

ocp4_workload_showroom: multi-user AgnosticD deployment is broken #7785

Open btison opened 7 months ago

btison commented 7 months ago

Describe the bug Multi-user AgnosticD deployment uses an applicationset to deploy showroom for each user. To propagate the user-specific data into the each application of the set, the list generator is used to build a yaml representation of the user data:

https://github.com/redhat-cop/agnosticd/blob/25a25e545696dc013e9a51fd9352b519b103d9c0/ansible/roles_ocp_workloads/ocp4_workload_showroom/templates/applicationset.yaml.j2#L9-L16

However, when setting the userdata variable for the Helm chart, the userData variable is not used, but rather _showroom_user_data

https://github.com/redhat-cop/agnosticd/blob/25a25e545696dc013e9a51fd9352b519b103d9c0/ansible/roles_ocp_workloads/ocp4_workload_showroom/templates/applicationset.yaml.j2#L76-L77

This doesn't work as the user data are not parsed and segmented per user, so when deploying showroom, the user data configmap contains the userdata for all the users.

Apparently the issue is that in the applicationset template, it is not possible to correctly indent the userData yaml when setting the Helm chart variable.

Possible fix

A possible (very hacky) solution for this issue consists of of playing with the indent in the applicationset template:

In the list generator:

  generators:
  - list:
      elements:
{% for n in range(1, _user_count | int + 1 ) %}
      - user: user{{ n }}
        userData: |
          {{ _showroom_user_data['users']['user'~n] | to_nice_yaml | indent(14)}}
{% endfor %}

(indent 14 instead of 10)

When setting the Helm value:

              user_data: |
                {% raw %}{{.userData}}{% endraw %}

Another fix would be to not use an applicationset, but loop through the users and user data, and deploy an Argo application per user.

newgoliath commented 6 months ago

Per the README.adoc, do not use this feature until we revisit after summit. Use the helm install path.