Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci_gen_kustomize_values] Allow reject vars patches #2608

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions roles/ci_gen_kustomize_values/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ with a message.
* `ci_gen_kustomize_fetch_ocp_state`: (Boolean) If true it enables generating CI templates based on the OCP state. Defaults to `true`.
* `cifmw_ci_gen_kustomize_values_storage_class_prefix`: (String) Prefix for `storageClass` in generated values.yaml files. Defaults to `"lvms-"` only if `cifmw_use_lvms` is True, otherwise it defaults to `""`. The prefix is prepended to the `cifmw_ci_gen_kustomize_values_storage_class`. It is not recommended to override this value, instead set `cifmw_use_lvms` True or False.
* `cifmw_ci_gen_kustomize_values_storage_class`: (String) Value for `storageClass` in generated values.yaml files. Defaults to `"lvms-local-storage"` only if `cifmw_use_lvms` is True, otherwise it defaults to `"local-storage"`.
* `cifmw_ci_gen_kustomize_values_remove_keys_expressions`: (List) Remove keys matching the regular expressions from source ConfigMaps (values.yaml).
Defaults to `["^nodes$", "^node(_[0-9]+)?$"]`.
* `cifmw_ci_gen_kustomize_values_remove_keys_expressions*`: (List) Remove keys matching the regular expressions from source ConfigMaps (values.yaml).
Defaults to `["^nodes$", "^node(_[0-9]+)?$"]`. Accepts passing additional expressions by passing variables that matches `cifmw_ci_gen_kustomize_values_remove_keys_expressions.+`.

### Specific parameters for edpm-values
This configMap needs some more parameters in order to properly override the `architecture` provided one.
Expand Down
18 changes: 17 additions & 1 deletion roles/ci_gen_kustomize_values/tasks/generate_snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@
cifmw_ci_gen_kustomize_values_snippets_dir_prefix ~ _datatype) |
path_join
}}
_cifmw_gen_kustomize_values_reject_extra_expressions: >-
{{
hostvars[inventory_hostname] |
dict2items |
selectattr("key", "match", "^cifmw_ci_gen_kustomize_values_remove_keys_expressions.+") |
sort(attribute='key') |
map(attribute="value") |
list
}}
_cifmw_gen_kustomize_values_reject_expressions: >-
{{
(
_cifmw_gen_kustomize_values_reject_extra_expressions +
cifmw_ci_gen_kustomize_values_remove_keys_expressions
) | flatten | unique
}}
ansible.builtin.set_fact:
values_datatype: "{{ _datatype }}"
snippet_datadir: "{{ _dest_dir }}"
Expand All @@ -81,7 +97,7 @@
{{
_config_map_content |
ansible.utils.remove_keys(
target=cifmw_ci_gen_kustomize_values_remove_keys_expressions,
target=_cifmw_gen_kustomize_values_reject_expressions,
matching_parameter='regex')
}}
cacheable: false
Expand Down
Loading