-
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: Use csc framework for UI configuration #3181
Merged
bert-e
merged 6 commits into
development/2.9
from
improvement/use-csc-framework-for-ui-configuration
Mar 22, 2021
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d935de9
salt: Use csc framework to configure UI deployment path
JBWatenbergScality aed95a4
salt: Use csc framework to configure UI theme
JBWatenbergScality 4cb5f22
salt: Use csc framework to configure shell UI
JBWatenbergScality ded4746
salt: Reference ui configuration in service configuration in order to…
JBWatenbergScality bc98afc
salt: Fix Shell UI tragets
JBWatenbergScality dc7625a
test: Add support for .in templates in salt formulas tests
JBWatenbergScality File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
API | ||
arg | ||
basename | ||
buildargs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -8,8 +8,8 @@ given Cluster and Services Configurations. | |||||||||
Default Service Configurations | ||||||||||
------------------------------ | ||||||||||
|
||||||||||
MetalK8s addons (Alertmanager, Dex, Grafana and Prometheus) ships with default | ||||||||||
runtime service configurations required for basic service deployment. | ||||||||||
MetalK8s addons (Alertmanager, Dex, Grafana, Prometheus and UI) ships with | ||||||||||
default runtime service configurations required for basic service deployment. | ||||||||||
Find below an exhaustive list of available default Service Configurations | ||||||||||
deployed in a MetalK8s cluster. | ||||||||||
|
||||||||||
|
@@ -86,6 +86,53 @@ The default configuration values for Loki are specified below: | |||||||||
:language: yaml | ||||||||||
:lines: 3- | ||||||||||
|
||||||||||
|
||||||||||
UI Default Configuration | ||||||||||
~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||
|
||||||||||
MetalK8s UI simplifies management and monitoring of a MetalK8s cluster from a | ||||||||||
centralized user interface. | ||||||||||
|
||||||||||
The default configuration values for MetalK8s UI are specified below: | ||||||||||
|
||||||||||
.. literalinclude:: ../../salt/metalk8s/addons/ui/config/metalk8s-ui-config.yaml | ||||||||||
:language: yaml | ||||||||||
:lines: 3- | ||||||||||
|
||||||||||
See :ref:`csc-ui-customization` to override these defaults. | ||||||||||
|
||||||||||
UI Default Theme | ||||||||||
~~~~~~~~~~~~~~~~ | ||||||||||
|
||||||||||
You can override theme colors used by MetalK8s UI. | ||||||||||
|
||||||||||
The default theme for MetalK8s UI are specified below: | ||||||||||
|
||||||||||
.. literalinclude:: ../../shell-ui/theme.json | ||||||||||
:language: json | ||||||||||
:lines: 3- | ||||||||||
|
||||||||||
See :ref:`csc-ui-theme-customization` to override these defaults. | ||||||||||
|
||||||||||
Shell UI Default Configuration | ||||||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||
|
||||||||||
MetalK8s Shell UI provides a common set of features to MetalK8s UI and | ||||||||||
any other UI (both control and workload plane) configured to include the | ||||||||||
Shell UI component(s). | ||||||||||
Features exposed include: | ||||||||||
- user authentication using an OIDC provider | ||||||||||
- navigation menu items, displayed according to user groups | ||||||||||
(retrieved from OIDC) | ||||||||||
|
||||||||||
The default Shell UI configuration values are specified below: | ||||||||||
|
||||||||||
.. literalinclude:: ../../salt/metalk8s/addons/ui/config/metalk8s-shell-ui-config.yaml.j2 | ||||||||||
:language: yaml | ||||||||||
:lines: 3- | ||||||||||
|
||||||||||
See :ref:`csc-shell-ui-config-customization` to override these defaults. | ||||||||||
|
||||||||||
Service Configurations Customization | ||||||||||
------------------------------------ | ||||||||||
|
||||||||||
|
@@ -548,6 +595,176 @@ edited as follows: | |||||||||
Due to internal implementation, ``retention_period`` must be a multiple of | ||||||||||
``24h`` in order to get the expected behavior | ||||||||||
|
||||||||||
.. _csc-ui-customization: | ||||||||||
|
||||||||||
Metalk8s UI Configuration Customization | ||||||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||
|
||||||||||
Default configuration for MetalK8s UI can be overridden by editing its | ||||||||||
Cluster and Service ConfigMap ``metalk8s-ui-config`` in namespace | ||||||||||
``metalk8s-ui`` under the key ``data.config\.yaml``: | ||||||||||
|
||||||||||
.. code-block:: shell | ||||||||||
|
||||||||||
root@bootstrap $ kubectl --kubeconfig /etc/kubernetes/admin.conf \ | ||||||||||
edit configmap -n metalk8s-ui \ | ||||||||||
metalk8s-ui-config | ||||||||||
|
||||||||||
Changing the MetalK8s UI Ingress Path | ||||||||||
"""""""""""""""""""""""""""""""""""""""""""""""" | ||||||||||
|
||||||||||
In order to expose another UI at the root path of the control plane, | ||||||||||
in place of MetalK8s UI, you need to change the Ingress path from | ||||||||||
which MetalK8s UI is served. | ||||||||||
|
||||||||||
For example, to serve MetalK8s UI at **/platform** instead of **/**, follow | ||||||||||
these steps: | ||||||||||
|
||||||||||
#. Change the value of ``spec.basePath`` in the ConfigMap: | ||||||||||
|
||||||||||
.. code-block:: yaml | ||||||||||
|
||||||||||
apiVersion: v1 | ||||||||||
kind: ConfigMap | ||||||||||
data: | ||||||||||
config.yaml: |- | ||||||||||
apiVersion: addons.metalk8s.scality.com/v1alpha1 | ||||||||||
kind: UIConfig | ||||||||||
spec: | ||||||||||
basePath: /platform | ||||||||||
|
||||||||||
#. Apply your changes by running: | ||||||||||
|
||||||||||
.. parsed-literal:: | ||||||||||
|
||||||||||
root\@bootstrap $ kubectl exec -n kube-system -c salt-master \\ | ||||||||||
--kubeconfig /etc/kubernetes/admin.conf \\ | ||||||||||
salt-master-bootstrap -- salt-run state.sls \\ | ||||||||||
metalk8s.addons.ui.deployed saltenv=metalk8s-|version| | ||||||||||
|
||||||||||
.. _csc-ui-theme-customization: | ||||||||||
|
||||||||||
MetalK8s UI Theme Customization | ||||||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||
Comment on lines
+647
to
+648
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
Default configuration for MetalK8s UI Theme can be overridden by editing its | ||||||||||
Cluster and Service ConfigMap ``metalk8s-theme`` in namespace | ||||||||||
``metalk8s-ui`` under the key ``data.config\.yaml``: | ||||||||||
|
||||||||||
.. code-block:: shell | ||||||||||
|
||||||||||
root@bootstrap $ kubectl --kubeconfig /etc/kubernetes/admin.conf \ | ||||||||||
edit configmap -n metalk8s-ui \ | ||||||||||
metalk8s-theme | ||||||||||
|
||||||||||
Once the theme is edited, apply your changes by running: | ||||||||||
|
||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra empty line, to remove |
||||||||||
.. parsed-literal:: | ||||||||||
|
||||||||||
root\@bootstrap $ kubectl exec -n kube-system -c salt-master \\ | ||||||||||
--kubeconfig /etc/kubernetes/admin.conf \\ | ||||||||||
salt-master-bootstrap -- salt-run state.sls \\ | ||||||||||
metalk8s.addons.ui.deployed saltenv=metalk8s-|version| | ||||||||||
|
||||||||||
.. _csc-shell-ui-config-customization: | ||||||||||
|
||||||||||
MetalK8s Shell UI Configuration Customization | ||||||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||
|
||||||||||
Default configuration for MetalK8s Shell UI can be overridden by editing its | ||||||||||
Cluster and Service ConfigMap ``metalk8s-shell-ui-config`` in namespace | ||||||||||
``metalk8s-ui`` under the key ``data.config\.yaml``. | ||||||||||
|
||||||||||
Changing UI OIDC Configuration | ||||||||||
"""""""""""""""""""""""""""""" | ||||||||||
|
||||||||||
In order to adapt the OIDC configuration (e.g. the provider URL or | ||||||||||
the client ID) used by the UI shareable navigation bar (called Shell UI), | ||||||||||
you need to modify its ConfigMap. | ||||||||||
|
||||||||||
For example, in order to replace the default client ID with "ui", | ||||||||||
follow these steps: | ||||||||||
|
||||||||||
#. Edit the ConfigMap: | ||||||||||
|
||||||||||
.. code-block:: shell | ||||||||||
|
||||||||||
root@bootstrap $ kubectl --kubeconfig /etc/kubernetes/admin.conf \ | ||||||||||
edit configmap -n metalk8s-ui \ | ||||||||||
metalk8s-shell-ui-config | ||||||||||
|
||||||||||
#. Add the following entry: | ||||||||||
|
||||||||||
.. code-block:: yaml | ||||||||||
|
||||||||||
apiVersion: v1 | ||||||||||
kind: ConfigMap | ||||||||||
data: | ||||||||||
config.yaml: |- | ||||||||||
apiVersion: addons.metalk8s.scality.com/v1alpha1 | ||||||||||
kind: ShellUIConfig | ||||||||||
spec: | ||||||||||
# [...] | ||||||||||
oidc: | ||||||||||
# [...] | ||||||||||
clientId: "ui" | ||||||||||
|
||||||||||
#. Apply your changes by running: | ||||||||||
|
||||||||||
.. parsed-literal:: | ||||||||||
|
||||||||||
root\@bootstrap $ kubectl exec -n kube-system -c salt-master \\ | ||||||||||
--kubeconfig /etc/kubernetes/admin.conf \\ | ||||||||||
salt-master-bootstrap -- salt-run state.sls \\ | ||||||||||
metalk8s.addons.ui.deployed saltenv=metalk8s-|version| | ||||||||||
|
||||||||||
You can similarly edit the requested scopes through the "scopes" attribute or | ||||||||||
the OIDC provider URL through the "providerUrl" attribute. | ||||||||||
|
||||||||||
Changing UI Menu Entries | ||||||||||
"""""""""""""""""""""""" | ||||||||||
|
||||||||||
To change the UI navigation menu entries, follow these steps: | ||||||||||
|
||||||||||
#. Edit the ConfigMap: | ||||||||||
|
||||||||||
.. code-block:: shell | ||||||||||
|
||||||||||
root@bootstrap $ kubectl --kubeconfig /etc/kubernetes/admin.conf \ | ||||||||||
edit configmap -n metalk8s-ui \ | ||||||||||
metalk8s-shell-ui-config | ||||||||||
|
||||||||||
#. Edit the ``options`` field. As an example, we add an entry to | ||||||||||
the ``main`` section (there is also a ``subLogin`` section): | ||||||||||
|
||||||||||
.. code-block:: yaml | ||||||||||
|
||||||||||
apiVersion: v1 | ||||||||||
kind: ConfigMap | ||||||||||
data: | ||||||||||
config.yaml: |- | ||||||||||
apiVersion: addons.metalk8s.scality.com/v1alpha1 | ||||||||||
kind: ShellUIConfig | ||||||||||
spec: | ||||||||||
# [...] | ||||||||||
options: | ||||||||||
# [...] | ||||||||||
main: | ||||||||||
# [...] | ||||||||||
https://www.scality.com/: | ||||||||||
en: "Scality" | ||||||||||
fr: "Scality" | ||||||||||
|
||||||||||
#. Apply your changes by running: | ||||||||||
|
||||||||||
.. parsed-literal:: | ||||||||||
|
||||||||||
root\@bootstrap $ kubectl exec -n kube-system -c salt-master \\ | ||||||||||
--kubeconfig /etc/kubernetes/admin.conf \\ | ||||||||||
salt-master-bootstrap -- salt-run state.sls \\ | ||||||||||
metalk8s.addons.ui.deployed saltenv=metalk8s-|version| | ||||||||||
|
||||||||||
Replicas Count Customization | ||||||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||
|
||||||||||
|
28 changes: 28 additions & 0 deletions
28
salt/metalk8s/addons/ui/config/metalk8s-shell-ui-config.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!jinja|yaml | ||
|
||
# Defaults for shell UI configuration | ||
apiVersion: addons.metalk8s.scality.com/v1alpha1 | ||
kind: ShellUIConfig | ||
spec: | ||
oidc: | ||
providerUrl: "/oidc" | ||
redirectUrl: "https://{{ grains.metalk8s.control_plane_ip }}:8443/" | ||
clientId: "metalk8s-ui" | ||
responseType: "id_token" | ||
scopes: "openid profile email groups offline_access audience:server:client_id:oidc-auth-client" | ||
userGroupsMapping: | ||
"admin@metalk8s.invalid": | ||
- admin | ||
options: | ||
main: | ||
"https://{{ grains.metalk8s.control_plane_ip }}:8443/": | ||
en: "Platform" | ||
fr: "Plateforme" | ||
"https://{{ grains.metalk8s.control_plane_ip }}:8443/alerts": | ||
en: "Alerts" | ||
fr: "Alertes" | ||
subLogin: | ||
"https://{{ grains.metalk8s.control_plane_ip }}:8443/docs": | ||
en: "Documentation" | ||
fr: "Documentation" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!yaml | ||
|
||
# Defaults for configuration of MetalK8s UI | ||
apiVersion: addons.metalk8s.scality.com/v1alpha1 | ||
kind: ThemeConfig | ||
spec: | ||
theme: |- | ||
@@ThemeConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!yaml | ||
|
||
# Defaults for configuration of MetalK8s UI | ||
apiVersion: addons.metalk8s.scality.com/v1alpha1 | ||
kind: UIConfig | ||
spec: | ||
basePath: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It's not "critical" but still a bit ugly 😜
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.
I took care of it in #3196