-
Notifications
You must be signed in to change notification settings - Fork 45
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
salt: Fix shell-ui configuration upgrade #3499
base: development/2.10
Are you sure you want to change the base?
salt: Fix shell-ui configuration upgrade #3499
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
86ee888
to
2dd9ee9
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some rendering test cases, to clarify the expected behaviour?
{%- if metalk8s_shell_ui_config is not none %} | ||
{%- set config_data = metalk8s_shell_ui_config.data['config.yaml'] | load_yaml %} | ||
|
||
{%- if config_data.apiVersion == 'addons.metalk8s.scality.com/v1alpha1' and 'oidc' in config_data.spec %} | ||
|
||
Create metalk8s-ui-config ConfigMap: | ||
metalk8s_kubernetes.object_present: | ||
- manifest: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: metalk8s-ui-config | ||
namespace: metalk8s-ui | ||
data: | ||
config.yaml: |- | ||
apiVersion: addons.metalk8s.scality.com/v1alpha2 | ||
kind: UIConfig | ||
spec: | ||
kind: "OIDC" | ||
{{ config_data.spec.oidc | yaml(False) | indent(14) }} | ||
|
||
{%- else %} | ||
|
||
metalk8s-ui-config ConfigMap already exist: | ||
test.succeed_without_changes: [] | ||
|
||
{%- endif %} | ||
|
||
{%- else %} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure to understand this part:
- we have both
metalk8s-ui-config
andmetalk8s-shell-ui-config
already existing - we want to copy over the OIDC settings from the latter to the former, in case the
shell-ui
config is in the old format
But if that's true, we're overwriting the previous metalk8s-ui-config
, without checking its own apiVersion or previous contents (what if we changed the basePath?)
{%- if 'oidc' in config_data.spec %} | ||
oidc: | ||
{{ config_data.spec.oidc | yaml(False) | indent(16) }} | ||
{%- endif %} | ||
{%- if 'userGroupsMapping' in config_data.spec %} | ||
userGroupsMapping: | ||
{{ config_data.spec.userGroupsMapping | yaml(False) | indent(16) }} | ||
{%- endif %} | ||
{%- if 'logo' in config_data.spec %} | ||
logo: | ||
{{ config_data.spec.logo | yaml(False) | indent(16) }} | ||
{%- endif %} | ||
{%- if 'favicon' in config_data.spec %} | ||
favicon: | ||
{{ config_data.spec.favicon | yaml(False) | indent(16) }} | ||
{%- endif %} | ||
{%- if 'canChangeLanguage' in config_data.spec %} | ||
canChangeLanguage: | ||
{{ config_data.spec.canChangeLanguage | yaml(False) | indent(16) }} | ||
{%- endif %} | ||
{%- if 'canChangeTheme' in config_data.spec %} | ||
canChangeTheme: | ||
{{ config_data.spec.canChangeTheme | yaml(False) | indent(16) }} | ||
{%- endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really too verbose, don't you think? Would be good to reimplement the service_config_updated
state module we built in another project (:wink:)...
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list:
The following reviewers are expecting changes from the author, or must review again: |
Component:
salt, shell-ui
Context:
When upgrading from 2.9.x to 2.10.x we lost patches to OIDC and users groups mapping configuration.
Summary:
This solves it by copying the old configuration to the new CMs.
Acceptance criteria:
Tested an upgrade from 2.9 with patched configuration to 2.10.3-dev and the configuration was correctly kept.
Closes: #3496