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

salt: Fix shell-ui configuration upgrade #3499

Open
wants to merge 1 commit into
base: development/2.10
Choose a base branch
from

Conversation

JBWatenbergScality
Copy link
Contributor

@JBWatenbergScality JBWatenbergScality commented Aug 16, 2021

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

@bert-e

This comment has been minimized.

@bert-e

This comment has been minimized.

@JBWatenbergScality JBWatenbergScality changed the base branch from development/2.11 to development/2.10 August 17, 2021 08:28
@bert-e

This comment has been minimized.

@bert-e

This comment has been minimized.

@JBWatenbergScality JBWatenbergScality force-pushed the bugfix/upgrade-shell-ui-version branch from 86ee888 to 2dd9ee9 Compare August 17, 2021 08:30
@bert-e

This comment has been minimized.

@JBWatenbergScality

This comment has been minimized.

@bert-e

This comment has been minimized.

@bert-e

This comment has been minimized.

@bert-e
Copy link
Contributor

bert-e commented Aug 17, 2021

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • one peer

Peer approvals must include at least 1 approval from the following list:

@JBWatenbergScality JBWatenbergScality marked this pull request as ready for review August 17, 2021 12:57
@JBWatenbergScality JBWatenbergScality requested a review from a team as a code owner August 17, 2021 12:57
Copy link
Contributor

@gdemonet gdemonet left a 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?

Comment on lines +70 to +99
{%- 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 %}

Copy link
Contributor

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 and metalk8s-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?)

Comment on lines +287 to +310
{%- 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 %}
Copy link
Contributor

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:)...

@bert-e
Copy link
Contributor

bert-e commented Aug 19, 2021

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • one peer

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade overwrites some sections of Shell UI configuration
3 participants