Skip to content

Commit

Permalink
Merge pull request #121 from aandryashin/master
Browse files Browse the repository at this point in the history
Add nodeSelector, affinity, tolerations, customIngress.
  • Loading branch information
vania-pooh authored Mar 9, 2022
2 parents d91fc1f + e3afb99 commit 85d1f93
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 117 deletions.
256 changes: 139 additions & 117 deletions moon2/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 34 additions & 0 deletions moon2/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -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" . }}
Expand Down Expand Up @@ -200,3 +233,4 @@ spec:
port:
number: 4444
{{- end }}
{{- end }}
65 changes: 65 additions & 0 deletions moon2/values.yaml
Original file line number Diff line number Diff line change
@@ -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.
##
Expand Down Expand Up @@ -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.
##
Expand Down

0 comments on commit 85d1f93

Please sign in to comment.