diff --git a/moon2/templates/deployment.yaml b/moon2/templates/deployment.yaml index bed7dbd..818c122 100644 --- a/moon2/templates/deployment.yaml +++ b/moon2/templates/deployment.yaml @@ -26,121 +26,143 @@ spec: {{- else -}} {{- $def -}} {{- end }} + {{- if .Values.deployment -}} + {{- with .Values.deployment.securityContext }} + securityContext: + {{ toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.deployment.nodeSelector }} + nodeSelector: + {{- range $key, $value := .Values.deployment.nodeSelector }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + {{- with .Values.deployment.affinity }} + affinity: + {{- toYaml . | nindent 8 -}} + {{- end }} + {{- with .Values.deployment.tolerations }} + tolerations: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- if .Values.deployment.priorityClassName }} + priorityClassName: {{ .Values.deployment.priorityClassName }} + {{- end }} + {{- end }} containers: - - name: moon - image: {{ $defRepo := "quay.io/aerokube/moon" -}} - {{- $defTag := .Chart.AppVersion -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonRepo | default $defRepo -}}:{{- .Values.deployment.moonTag | default $defTag -}} - {{- else -}} - {{- $defRepo }}:{{- $defTag -}} - {{- end }} - command: - - /moon - - -moon-url - - http://{{ .Release.Name }}.{{ .Release.Namespace }}:4444/wd/hub - resources: - limits: - cpu: {{ $def := "0.5" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonCPULimit | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - memory: {{ $def := "256Mi" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonMemoryLimit | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - requests: - cpu: {{ $def := "0.2" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonCPURequest | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - memory: {{ $def := "256Mi" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonMemoryRequest | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - ports: - - containerPort: 4444 - - name: moon-conf - image: {{ $defRepo := "quay.io/aerokube/moon-conf" -}} - {{- $defTag := .Chart.AppVersion -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonConfRepo | default $defRepo -}}:{{- .Values.deployment.moonConfTag | default $defTag -}} - {{- else -}} - {{- $defRepo }}:{{- $defTag -}} - {{- end }} - resources: - limits: - cpu: {{ $def := "0.25" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonConfCPULimit | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - memory: {{ $def := "128Mi" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonConfMemoryLimit | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - requests: - cpu: {{ $def := "0.05" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonConfCPURequest | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - memory: {{ $def := "128Mi" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonConfMemoryRequest | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - - name: moon-ui - image: {{ $defRepo := "quay.io/aerokube/moon-ui" -}} - {{- $defTag := "2.0.1" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonUIRepo | default $defRepo -}}:{{- .Values.deployment.moonUITag | default $defTag -}} - {{- else -}} - {{- $defRepo }}:{{- $defTag -}} - {{- end }} - args: - - -allowed-origin - - "*" - resources: - limits: - cpu: {{ $def := "0.25" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonUICPULimit | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - memory: {{ $def := "64Mi" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonUIMemoryLimit | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - requests: - cpu: {{ $def := "0.05" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonUICPURequest | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - memory: {{ $def := "64Mi" -}} - {{- if .Values.deployment -}} - {{- .Values.deployment.moonUIMemoryRequest | default $def | quote -}} - {{- else -}} - {{- $def -}} - {{- end }} - ports: - - name: selenoid-ui - containerPort: 8080 + - name: moon + image: {{ $defRepo := "quay.io/aerokube/moon" -}} + {{- $defTag := .Chart.AppVersion -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonRepo | default $defRepo -}}:{{- .Values.deployment.moonTag | default $defTag -}} + {{- else -}} + {{- $defRepo }}:{{- $defTag -}} + {{- end }} + command: + - /moon + - -moon-url + - http://{{ .Release.Name }}.{{ .Release.Namespace }}:4444/wd/hub + resources: + limits: + cpu: {{ $def := "0.5" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonCPULimit | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + memory: {{ $def := "256Mi" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonMemoryLimit | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + requests: + cpu: {{ $def := "0.2" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonCPURequest | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + memory: {{ $def := "256Mi" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonMemoryRequest | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + ports: + - containerPort: 4444 + - name: moon-conf + image: {{ $defRepo := "quay.io/aerokube/moon-conf" -}} + {{- $defTag := .Chart.AppVersion -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonConfRepo | default $defRepo -}}:{{- .Values.deployment.moonConfTag | default $defTag -}} + {{- else -}} + {{- $defRepo }}:{{- $defTag -}} + {{- end }} + resources: + limits: + cpu: {{ $def := "0.25" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonConfCPULimit | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + memory: {{ $def := "128Mi" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonConfMemoryLimit | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + requests: + cpu: {{ $def := "0.05" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonConfCPURequest | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + memory: {{ $def := "128Mi" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonConfMemoryRequest | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + - name: moon-ui + image: {{ $defRepo := "quay.io/aerokube/moon-ui" -}} + {{- $defTag := "2.0.1" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonUIRepo | default $defRepo -}}:{{- .Values.deployment.moonUITag | default $defTag -}} + {{- else -}} + {{- $defRepo }}:{{- $defTag -}} + {{- end }} + args: + - -allowed-origin + - "*" + resources: + limits: + cpu: {{ $def := "0.25" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonUICPULimit | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + memory: {{ $def := "64Mi" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonUIMemoryLimit | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + requests: + cpu: {{ $def := "0.05" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonUICPURequest | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + memory: {{ $def := "64Mi" -}} + {{- if .Values.deployment -}} + {{- .Values.deployment.moonUIMemoryRequest | default $def | quote -}} + {{- else -}} + {{- $def -}} + {{- end }} + ports: + - containerPort: 8080 diff --git a/moon2/templates/ingress.yaml b/moon2/templates/ingress.yaml index 6a21601..4ce9e69 100644 --- a/moon2/templates/ingress.yaml +++ b/moon2/templates/ingress.yaml @@ -1,3 +1,36 @@ +{{- if .Values.customIngress.enabled }} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + {{- range $key, $value := .Values.customIngress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} +spec: + ingressClassName: {{ .Values.customIngress.ingressClassName }} + {{- if .Values.customIngress.tls }} + tls: + {{ toYaml .Values.customIngress.tls | nindent 4 }} + {{- end }} + rules: + - host: {{ .Values.customIngress.host }} + http: + paths: + {{- $releaseName := .Release.Name }} + {{- range $v := .Values.customIngress.paths }} + - path: {{ $v.path | quote }} + pathType: {{ $v.type | default "Prefix" }} + backend: + service: + name: {{ $releaseName }} + port: + number: {{ $v.port }} + {{- end }} +{{- else }} + {{- template "check.quota" . }} {{- template "check.quota.namespaces" . }} {{- template "check.ingress.host" . }} @@ -200,3 +233,4 @@ spec: port: number: 4444 {{- end }} +{{- end }} diff --git a/moon2/values.yaml b/moon2/values.yaml index 69856f8..1354c97 100644 --- a/moon2/values.yaml +++ b/moon2/values.yaml @@ -1,4 +1,29 @@ ## +## Custom Ingress settings. Overrides default Nginx Ingress configuration. +## +customIngress: + enabled: false + annotations: {} + ingressClassName: nginx + host: moon.aerokube.local + tls: [] + #- secretName: moon-tls + # hosts: + # - moon.aerokube.local + paths: + - path: / + port: 8080 + - path: /wd/hub + port: 4444 + - path: /cypress + port: 4444 + - path: /playwright + port: 4444 + - path: /devtools + port: 4444 + - path: /metrics + port: 4444 +## ## Ingress settings. This chart is using Nginx Ingress. By default, Ingress listens only on port 80 (HTTP). ## Port 443 (HTTPS) is enabled only if TLS certificate and private key are provided in the fields below. ## @@ -139,6 +164,46 @@ deployment: ## moonUIMemoryRequest: + ## If specified, the pod's security policies. + ## ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/ + ## + securityContext: {} + # runAsUser: 1000 + + ## + ## Node Selector for Moon pods + ## + nodeSelector: {} + # kubernetes.io/os: linux + + ## Assign custom affinity rules to the instance + ## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + ## + affinity: {} + # nodeAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # nodeSelectorTerms: + # - matchExpressions: + # - key: kubernetes.io/e2e-az-name + # operator: In + # values: + # - e2e-az1 + # - e2e-az2 + + # ## If specified, the pod's priorityClassName. + # ## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass + # ## + # priorityClassName: default + + ## If specified, the pod's tolerations. + ## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + #- key: "key" + # operator: "Equal" + # value: "value" + # effect: "NoSchedul + ## ## Available configuration objects. ##