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

Ease Federated App deployment on Workload Plane #4124

Merged
Merged
Show file tree
Hide file tree
Changes from 6 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

### Enhancements

- Add support in CSC to manage a new configuration for Shell UI on the WorkloadPlane
(PR[#4124](https://github.com/scality/metalk8s/pull/4124))

- Define workloadplane ingress default backend to be Shell UI
(PR[#4124](https://github.com/scality/metalk8s/pull/4124))

- Bump Kubernetes version to
[1.26.5](https://github.com/kubernetes/kubernetes/releases/tag/v1.26.5)
(PR[#4074](https://github.com/scality/metalk8s/pull/4074))
Expand Down
2 changes: 0 additions & 2 deletions buildchain/buildchain/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ def _local_image(name: str, **kwargs: Any) -> targets.LocalImage:
"fluent-bit",
],
constants.GOOGLE_REPOSITORY: [
"nginx-ingress-defaultbackend-amd64",
"pause",
],
constants.GRAFANA_REPOSITORY: [
Expand Down Expand Up @@ -224,7 +223,6 @@ def _local_image(name: str, **kwargs: Any) -> targets.LocalImage:
"calico-node": "node",
"calico-kube-controllers": "kube-controllers",
"nginx-ingress-controller": "controller",
"nginx-ingress-defaultbackend-amd64": "defaultbackend-amd64",
}

SAVE_AS: Dict[str, List[targets.ImageSaveFormat]] = {
Expand Down
1 change: 1 addition & 0 deletions buildchain/buildchain/salt_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ def task(self) -> types.TaskDict:
Path("salt/metalk8s/addons/ui/deployed/init.sls"),
Path("salt/metalk8s/addons/ui/config/metalk8s-shell-ui-config.yaml.j2"),
Path("salt/metalk8s/addons/ui/config/metalk8s-ui-config.yaml.j2"),
Path("salt/metalk8s/addons/ui/config/workloadplane-shell-ui-config.yaml.j2"),
targets.TemplateFile(
task_name="salt/metalk8s/addons/ui/config/deployed-ui-apps.yaml.j2",
source=constants.ROOT.joinpath(
Expand Down
5 changes: 0 additions & 5 deletions buildchain/buildchain/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ def _version_prefix(version: str, prefix: str = "v") -> str:
version="v1.8.1",
digest="sha256:e5c4824e7375fcf2a393e1c03c293b69759af37a9ca6abdb91b13d78a93da8bd",
),
Image(
name="nginx-ingress-defaultbackend-amd64",
version="1.5",
digest="sha256:4dc5e07c8ca4e23bddb3153737d7b8c556e5fb2f29c4558b7cd6e6df99c512c7",
),
Image(
name="node-exporter",
version="v1.6.0",
Expand Down
2 changes: 0 additions & 2 deletions charts/ingress-nginx-control-plane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ controller:
digest: null
repository: '{%- endraw -%}{{ build_image_name(\"nginx-ingress-controller\", False) }}{%- raw -%}'

defaultBackendService: 'metalk8s-ingress/nginx-ingress-default-backend'

electionID: ingress-control-plane-controller-leader

ingressClassResource:
Expand Down
17 changes: 2 additions & 15 deletions charts/ingress-nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ controller:
type: ClusterIP

extraArgs:
default-backend-service: metalk8s-ui/metalk8s-ui
default-ssl-certificate: "metalk8s-ingress/ingress-workload-plane-default-certificate"
metrics-per-host: false

Expand All @@ -39,18 +40,4 @@ controller:
metalk8s.scality.com/monitor: ''

defaultBackend:
enabled: true

image:
repository: '{%- endraw -%}{{ build_image_name(\"nginx-ingress-defaultbackend-amd64\", False) }}{%- raw -%}'

tolerations:
- key: "node-role.kubernetes.io/bootstrap"
operator: "Exists"
effect: "NoSchedule"
- key: "node-role.kubernetes.io/infra"
operator: "Exists"
effect: "NoSchedule"

nodeSelector:
node-role.kubernetes.io/infra: ''
enabled: false
77 changes: 77 additions & 0 deletions docs/operation/cluster_and_service_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ The default Shell UI configuration values are specified below:

See :ref:`csc-shell-ui-config-customization` to override these defaults.

Shell UI Workload Plane Default Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Shell UI has a different configuration for the workload plane.

The default Shell UI workload plane configuration values are specified below:

.. literalinclude:: ../../salt/metalk8s/addons/ui/config/workloadplane-shell-ui-config.yaml.j2
:lines: 3-


Service Configurations Customization
------------------------------------

Expand Down Expand Up @@ -988,6 +999,72 @@ To change the UI navigation menu entries, follow these steps:
salt-master-bootstrap -- salt-run state.sls \\
metalk8s.addons.ui.deployed saltenv=metalk8s-|version|


MetalK8s Shell UI Workloadplane Configuration Customization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Default configuration for MetalK8s Shell UI workloadplane can be overridden by
editing its Cluster and Service ConfigMap ``workloadplane-shell-ui-config`` in
namespace ``metalk8s-ui`` under the key ``data.config\.yaml``.

Changing UI Menu Entries
""""""""""""""""""""""""

To change the UI navigation menu entries on the workloadplane, follow these
steps:

#. Edit the ConfigMap:

.. code-block:: shell

root@bootstrap $ kubectl --kubeconfig /etc/kubernetes/admin.conf \
edit configmap -n metalk8s-ui \
workloadplane-shell-ui-config

#. Edit the ``navbar`` 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: WorkloadplaneShellUIConfig
spec:
deployedApps:
- kind: ModuleFederatedAppKind,
name: appname,
version: x.y.z,
url: https://app.url,
appHistoryBasePath: ""
config:
# [...]
navbar:
# [...]
main:
# [...]
kind: ModuleFederatedAppKind
view: ViewToFederate
# Alternatively for a non federated app
isExternal: true
label:
en: Documentation
fr: Documentation
url: https://13.48.197.10:8443/docs/

#. 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
125 changes: 1 addition & 124 deletions salt/metalk8s/addons/nginx-ingress/deployed/chart.sls
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,6 @@ metadata:
name: ingress-nginx
namespace: metalk8s-ingress
---
apiVersion: v1
automountServiceAccountToken: true
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: default-backend
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/managed-by: salt
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: metalk8s
app.kubernetes.io/version: 1.8.1
helm.sh/chart: ingress-nginx-4.7.1
heritage: metalk8s
name: ingress-nginx-backend
namespace: metalk8s-ingress
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down Expand Up @@ -324,33 +308,6 @@ spec:
app.kubernetes.io/name: ingress-nginx
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: default-backend
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/managed-by: salt
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: metalk8s
app.kubernetes.io/version: 1.8.1
helm.sh/chart: ingress-nginx-4.7.1
heritage: metalk8s
name: ingress-nginx-defaultbackend
namespace: metalk8s-ingress
spec:
ports:
- appProtocol: http
name: http
port: 80
protocol: TCP
targetPort: http
selector:
app.kubernetes.io/component: default-backend
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
type: ClusterIP
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand Down Expand Up @@ -388,13 +345,13 @@ spec:
containers:
- args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/ingress-nginx-defaultbackend
- --publish-service=$(POD_NAMESPACE)/ingress-nginx-controller
- --election-id=ingress-nginx-leader
- --controller-class=k8s.io/ingress-nginx
- --ingress-class=nginx
- --configmap=$(POD_NAMESPACE)/ingress-nginx-controller
- --watch-ingress-without-class=true
- --default-backend-service=metalk8s-ui/metalk8s-ui
- --default-ssl-certificate=metalk8s-ingress/ingress-workload-plane-default-certificate
- --metrics-per-host=false
env:
Expand Down Expand Up @@ -474,86 +431,6 @@ spec:
key: node-role.kubernetes.io/infra
operator: Exists
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: default-backend
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/managed-by: salt
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: metalk8s
app.kubernetes.io/version: 1.8.1
helm.sh/chart: ingress-nginx-4.7.1
heritage: metalk8s
name: ingress-nginx-defaultbackend
namespace: metalk8s-ingress
spec:
minReadySeconds: 0
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/component: default-backend
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
template:
metadata:
labels:
app.kubernetes.io/component: default-backend
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
spec:
containers:
- image: '{%- endraw -%}{{ build_image_name("nginx-ingress-defaultbackend-amd64",
False) }}{%- raw -%}:1.5'
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
name: ingress-nginx-default-backend
ports:
- containerPort: 8080
name: http
protocol: TCP
readinessProbe:
failureThreshold: 6
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534
nodeSelector:
kubernetes.io/os: linux
node-role.kubernetes.io/infra: ''
serviceAccountName: ingress-nginx-backend
terminationGracePeriodSeconds: 60
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/bootstrap
operator: Exists
- effect: NoSchedule
key: node-role.kubernetes.io/infra
operator: Exists
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!jinja|yaml

# Defaults for configuration of Shell-UI Workload Plane
apiVersion: addons.metalk8s.scality.com/v1alpha1
kind: WorkloadPlaneShellUIConfig
spec:
deployedApps: []
config:
discoveryUrl: /shell/deployed-ui-apps.json
logo:
light: /brand/assets/logo-light.svg
dark: /brand/assets/logo-dark.svg
darkRebrand: /brand/assets/logo-darkRebrand.svg
favicon: /brand/favicon-metalk8s.svg
canChangeLanguage: false
canChangeTheme: false
productName: MetalK8s
themes:
darkRebrand:
logoPath: /brand/assets/logo-darkRebrand.svg

Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ spec:
- name: deployed-ui-apps-volume
mountPath: /etc/metalk8s/ui/deployed-ui-apps
readOnly: true
- name: workloadplane-shell-ui-config-volume
mountPath: /usr/share/nginx/html/wp
readOnly: true
volumes:
- name: metalk8s-ui-volume
configMap:
Expand All @@ -77,3 +80,6 @@ spec:
- name: deployed-ui-apps-volume
configMap:
name: deployed-ui-apps-generated
- name: workloadplane-shell-ui-config-volume
configMap:
name: workloadplane-shell-ui-config-generated
Loading