From 4a993a9eb91e1d8c184f6609b1fef6bc35adf46f Mon Sep 17 00:00:00 2001 From: Akram Ben Aissi Date: Mon, 16 Dec 2024 09:14:32 +0100 Subject: [PATCH] Adding kueue-viz templates in helm charts --- .../kueue-viz/backend-deployment.yaml | 24 +++++++++++++++ .../templates/kueue-viz/backend-ingress.yaml | 28 ++++++++++++++++++ .../templates/kueue-viz/backend-service.yaml | 15 ++++++++++ .../templates/kueue-viz/clusterrole.yaml | 17 +++++++++++ .../kueue-viz/clusterrolebinding.yaml | 15 ++++++++++ .../kueue-viz/frontend-deployment.yaml | 29 +++++++++++++++++++ .../templates/kueue-viz/frontend-ingress.yaml | 28 ++++++++++++++++++ .../templates/kueue-viz/frontend-service.yaml | 15 ++++++++++ .../templates/kueue-viz/tls-certificate.yaml | 17 +++++++++++ charts/kueue/values.yaml | 20 +++++++++++++ 10 files changed, 208 insertions(+) create mode 100644 charts/kueue/templates/kueue-viz/backend-deployment.yaml create mode 100644 charts/kueue/templates/kueue-viz/backend-ingress.yaml create mode 100644 charts/kueue/templates/kueue-viz/backend-service.yaml create mode 100644 charts/kueue/templates/kueue-viz/clusterrole.yaml create mode 100644 charts/kueue/templates/kueue-viz/clusterrolebinding.yaml create mode 100644 charts/kueue/templates/kueue-viz/frontend-deployment.yaml create mode 100644 charts/kueue/templates/kueue-viz/frontend-ingress.yaml create mode 100644 charts/kueue/templates/kueue-viz/frontend-service.yaml create mode 100644 charts/kueue/templates/kueue-viz/tls-certificate.yaml diff --git a/charts/kueue/templates/kueue-viz/backend-deployment.yaml b/charts/kueue/templates/kueue-viz/backend-deployment.yaml new file mode 100644 index 0000000000..a776584178 --- /dev/null +++ b/charts/kueue/templates/kueue-viz/backend-deployment.yaml @@ -0,0 +1,24 @@ +{{- if .Values.kueueViz.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kueue-viz-backend + namespace: {{ .Values.kueueViz.namespace }} +spec: + replicas: {{ .Values.kueueViz.replicaCount }} + selector: + matchLabels: + app: kueue-viz-backend + template: + metadata: + labels: + app: kueue-viz-backend + spec: + containers: + - name: backend + image: {{ .Values.kueueViz.backend.image }} + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 +{{- end }} + diff --git a/charts/kueue/templates/kueue-viz/backend-ingress.yaml b/charts/kueue/templates/kueue-viz/backend-ingress.yaml new file mode 100644 index 0000000000..c651fcb6c6 --- /dev/null +++ b/charts/kueue/templates/kueue-viz/backend-ingress.yaml @@ -0,0 +1,28 @@ +{{- if and .Values.kueueViz.enabled .Values.kueueViz.backend.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "kueue.fullname" . }}-backend-ingress + namespace: '{{ .Release.Namespace }}' + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/ssl-redirect: "true" +spec: + {{- if and .Values.enableCertManager .Values.kueueViz.tls.enabled }} + tls: + - hosts: + - {{ .Values.kueueViz.backend.ingress.host }} + secretName: {{ include "kueue.fullname" . }}-kueue-viz-tls-secret + {{- end }} + rules: + - host: {{ .Values.kueueViz.backend.ingress.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "kueue.fullname" . }}-backend + port: + number: 8080 +{{- end }} diff --git a/charts/kueue/templates/kueue-viz/backend-service.yaml b/charts/kueue/templates/kueue-viz/backend-service.yaml new file mode 100644 index 0000000000..f42e4b8615 --- /dev/null +++ b/charts/kueue/templates/kueue-viz/backend-service.yaml @@ -0,0 +1,15 @@ +{{- if .Values.kueueViz.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: kueue-viz-backend + namespace: {{ .Values.kueueViz.namespace }} +spec: + type: ClusterIP + ports: + - port: 8080 + targetPort: 8080 + selector: + app: kueue-viz-backend +{{- end }} + diff --git a/charts/kueue/templates/kueue-viz/clusterrole.yaml b/charts/kueue/templates/kueue-viz/clusterrole.yaml new file mode 100644 index 0000000000..e5edd1ef54 --- /dev/null +++ b/charts/kueue/templates/kueue-viz/clusterrole.yaml @@ -0,0 +1,17 @@ +{{- if .Values.kueueViz.enabled }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kueue-backend-read-access +rules: + - apiGroups: ["kueue.x-k8s.io"] + resources: ["workloads", "clusterqueues", "localqueues", "resourceflavors"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["pods", "events", "nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["kueue.x-k8s.io"] + resources: ["workloadpriorityclass"] + verbs: ["get", "list", "watch"] +{{- end }} + diff --git a/charts/kueue/templates/kueue-viz/clusterrolebinding.yaml b/charts/kueue/templates/kueue-viz/clusterrolebinding.yaml new file mode 100644 index 0000000000..3d67761b5f --- /dev/null +++ b/charts/kueue/templates/kueue-viz/clusterrolebinding.yaml @@ -0,0 +1,15 @@ +{{- if .Values.kueueViz.enabled }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: kueue-backend-read-access-binding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: kueue-backend-read-access +subjects: + - kind: ServiceAccount + name: default + namespace: {{ .Values.kueueViz.namespace }} +{{- end }} + diff --git a/charts/kueue/templates/kueue-viz/frontend-deployment.yaml b/charts/kueue/templates/kueue-viz/frontend-deployment.yaml new file mode 100644 index 0000000000..a15d6525e4 --- /dev/null +++ b/charts/kueue/templates/kueue-viz/frontend-deployment.yaml @@ -0,0 +1,29 @@ +{{- if .Values.kueueViz.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kueue-viz-frontend + namespace: {{ .Values.kueueViz.namespace }} +spec: + replicas: {{ .Values.kueueViz.replicaCount }} + selector: + matchLabels: + app: kueue-viz-frontend + template: + metadata: + labels: + app: kueue-viz-frontend + spec: + + containers: + - name: frontend + image: {{ .Values.kueueViz.frontend.image }} + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + env: + - name: REACT_APP_WEBSOCKET_URL + value: "{{ if .Values.kueueViz.tls.enabled }}wss://{{ else }}ws://{{ end }}{{ .Values.kueueViz.backend.ingress.host }}" + +{{- end }} + diff --git a/charts/kueue/templates/kueue-viz/frontend-ingress.yaml b/charts/kueue/templates/kueue-viz/frontend-ingress.yaml new file mode 100644 index 0000000000..6294c1f588 --- /dev/null +++ b/charts/kueue/templates/kueue-viz/frontend-ingress.yaml @@ -0,0 +1,28 @@ +{{- if .Values.kueueViz.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "kueue.fullname" . }}-frontend-ingress + namespace: '{{ .Release.Namespace }}' + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/ssl-redirect: "true" +spec: + {{- if and .Values.enableCertManager .Values.kueueViz.tls.enabled }} + tls: + - hosts: + - {{ .Values.kueueViz.frontend.ingress.host }} + secretName: {{ include "kueue.fullname" . }}-kueue-viz-tls-secret + {{- end }} + rules: + - host: {{ .Values.kueueViz.frontend.ingress.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "kueue.fullname" . }}-frontend + port: + number: 8080 +{{- end }} diff --git a/charts/kueue/templates/kueue-viz/frontend-service.yaml b/charts/kueue/templates/kueue-viz/frontend-service.yaml new file mode 100644 index 0000000000..fc2c7253a2 --- /dev/null +++ b/charts/kueue/templates/kueue-viz/frontend-service.yaml @@ -0,0 +1,15 @@ +{{- if .Values.kueueViz.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: kueue-viz-frontend + namespace: {{ .Values.kueueViz.namespace }} +spec: + type: ClusterIP + ports: + - port: 8080 + targetPort: 8080 + selector: + app: kueue-viz-frontend +{{- end }} + diff --git a/charts/kueue/templates/kueue-viz/tls-certificate.yaml b/charts/kueue/templates/kueue-viz/tls-certificate.yaml new file mode 100644 index 0000000000..f1b3a75d65 --- /dev/null +++ b/charts/kueue/templates/kueue-viz/tls-certificate.yaml @@ -0,0 +1,17 @@ +{{- if and .Values.enableCertManager .Values.kueueViz.tls.enabled }} +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: {{ include "kueue.fullname" . }}-kueue-viz-cert + namespace: '{{ .Release.Namespace }}' + labels: + {{- include "kueue.labels" . | nindent 4 }} +spec: + dnsNames: + - {{ .Values.kueueViz.backend.ingress.host }} + - {{ .Values.kueueViz.frontend.ingress.host }} + issuerRef: + kind: Issuer + name: {{ include "kueue.fullname" . }}-selfsigned-issuer + secretName: {{ include "kueue.fullname" . }}-kueue-viz-tls-secret +{{- end }} diff --git a/charts/kueue/values.yaml b/charts/kueue/values.yaml index 81d46e0463..c33a2d0306 100644 --- a/charts/kueue/values.yaml +++ b/charts/kueue/values.yaml @@ -150,3 +150,23 @@ webhookService: protocol: TCP targetPort: 9443 type: ClusterIP + +# kueue-viz dashboard +kueueViz: + enabled: true + replicaCount: 1 + backend: + image: us-central1-docker.pkg.dev/k8s-staging-images/kueue/kueue-viz-backend:latest + ingress: + enabled: true + host: backend.kueue-viz.local + + frontend: + image: us-central1-docker.pkg.dev/k8s-staging-images/kueue/kueue-viz-frontend:latest + ingress: + enabled: true + host: frontend.kueue-viz.local + + tls: + enabled: true + tlsSecretName: kueue-viz-tls-secret