diff --git a/charts/channels/.helmignore b/charts/channels/.helmignore new file mode 100644 index 0000000..50af031 --- /dev/null +++ b/charts/channels/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/channels/Chart.yaml b/charts/channels/Chart.yaml new file mode 100644 index 0000000..d60ef84 --- /dev/null +++ b/charts/channels/Chart.yaml @@ -0,0 +1,25 @@ +apiVersion: v2 +name: channels +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 1.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: 1.0.0 + +home: https://github.com/everpcpc/channels +maintainers: +- name: LeoQuote diff --git a/charts/channels/README.md b/charts/channels/README.md new file mode 100644 index 0000000..6213d43 --- /dev/null +++ b/charts/channels/README.md @@ -0,0 +1,17 @@ +# channels + +## NOTE +you should create a secret under the deploy namespace named `channels-config` + +e.g.: + +```yaml +apiVersion: v1 +data: + config.json: +kind: Secret +metadata: + name: channels-config + namespace: +type: Opaque +``` diff --git a/charts/channels/templates/_helpers.tpl b/charts/channels/templates/_helpers.tpl new file mode 100644 index 0000000..71c707f --- /dev/null +++ b/charts/channels/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=gotemplate: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "channels.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "channels.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "channels.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "channels.labels" -}} +helm.sh/chart: {{ include "channels.chart" . }} +{{ include "channels.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "channels.selectorLabels" -}} +app.kubernetes.io/name: {{ include "channels.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "channels.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "channels.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/channels/templates/deployment_irc.yaml b/charts/channels/templates/deployment_irc.yaml new file mode 100644 index 0000000..2359f6a --- /dev/null +++ b/charts/channels/templates/deployment_irc.yaml @@ -0,0 +1,64 @@ +{{- if .Values.irc.enabled -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "channels.fullname" . }}-irc + labels: + app.kubernetes.io/name: {{ include "channels.name" . }}-irc + app.kubernetes.io/instance: {{ .Release.Name }}-irc + helm.sh/chart: {{ include "channels.chart" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "channels.name" . }} +spec: + replicas: {{ .Values.irc.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "channels.name" . }}-irc + app.kubernetes.io/instance: {{ .Release.Name }}-irc + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "channels.name" . }}-irc + app.kubernetes.io/instance: {{ .Release.Name }}-irc + app.kubernetes.io/part-of: {{ include "channels.name" . }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "channels.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-irc + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - irc + ports: + - name: irc + containerPort: {{ .Values.irc.port }} + protocol: TCP + volumeMounts: + {{- toYaml .Values.volumeMounts | nindent 12 }} + resources: + {{- toYaml .Values.irc.resources | nindent 12 }} + volumes: + {{- toYaml .Values.volumes | nindent 8 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} + +# vi: ft=goyaml diff --git a/charts/channels/templates/deployment_slack.yaml b/charts/channels/templates/deployment_slack.yaml new file mode 100644 index 0000000..cb9659c --- /dev/null +++ b/charts/channels/templates/deployment_slack.yaml @@ -0,0 +1,60 @@ +{{- if .Values.slack.enabled -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "channels.fullname" . }}-slack + labels: + app.kubernetes.io/name: {{ include "channels.name" . }}-slack + app.kubernetes.io/instance: {{ .Release.Name }}-slack + helm.sh/chart: {{ include "channels.chart" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "channels.name" . }} +spec: + replicas: {{ .Values.slack.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "channels.name" . }}-slack + app.kubernetes.io/instance: {{ .Release.Name }}-slack + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "channels.name" . }}-slack + app.kubernetes.io/instance: {{ .Release.Name }}-slack + app.kubernetes.io/part-of: {{ include "channels.name" . }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "channels.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-slack + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - slack + volumeMounts: + {{- toYaml .Values.volumeMounts | nindent 12 }} + resources: + {{- toYaml .Values.slack.resources | nindent 12 }} + volumes: + {{- toYaml .Values.volumes | nindent 8 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} + +# vi: ft=goyaml diff --git a/charts/channels/templates/deployment_web.yaml b/charts/channels/templates/deployment_web.yaml new file mode 100644 index 0000000..c92c41b --- /dev/null +++ b/charts/channels/templates/deployment_web.yaml @@ -0,0 +1,70 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "channels.fullname" . }}-web + labels: + app.kubernetes.io/name: {{ include "channels.name" . }}-web + app.kubernetes.io/instance: {{ .Release.Name }}-web + helm.sh/chart: {{ include "channels.chart" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "channels.name" . }} +spec: + replicas: {{ .Values.web.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "channels.name" . }}-web + app.kubernetes.io/instance: {{ .Release.Name }}-web + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "channels.name" . }}-web + app.kubernetes.io/instance: {{ .Release.Name }}-web + app.kubernetes.io/part-of: {{ include "channels.name" . }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "channels.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-web + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - web + ports: + - name: http + containerPort: {{ .Values.web.port }} + protocol: TCP + livenessProbe: + httpGet: + path: /ping + port: http + readinessProbe: + httpGet: + path: /ping + port: http + volumeMounts: + {{- toYaml .Values.volumeMounts | nindent 12 }} + resources: + {{- toYaml .Values.web.resources | nindent 12 }} + volumes: + {{- toYaml .Values.volumes | nindent 8 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + +# vi: ft=goyaml diff --git a/charts/channels/templates/ingress.yaml b/charts/channels/templates/ingress.yaml new file mode 100644 index 0000000..3217b45 --- /dev/null +++ b/charts/channels/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "channels.fullname" . -}} +{{- $svcPort := .Values.web.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "channels.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-web + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }}-web + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/channels/templates/service_irc.yaml b/charts/channels/templates/service_irc.yaml new file mode 100644 index 0000000..017b38b --- /dev/null +++ b/charts/channels/templates/service_irc.yaml @@ -0,0 +1,28 @@ +{{- if .Values.irc.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "channels.fullname" . }}-irc + labels: + app.kubernetes.io/name: {{ include "channels.name" . }}-irc + helm.sh/chart: {{ include "channels.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }}-irc + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "channels.name" . }} + {{- with .Values.irc.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.irc.service.type }} + ports: + - port: {{ .Values.irc.service.port }} + targetPort: {{ .Values.irc.port }} + protocol: TCP + name: irc + selector: + app.kubernetes.io/name: {{ include "channels.name" . }}-irc + app.kubernetes.io/instance: {{ .Release.Name }}-irc +{{- end }} + +# vi: ft=goyaml diff --git a/charts/channels/templates/service_web.yaml b/charts/channels/templates/service_web.yaml new file mode 100644 index 0000000..b1ef457 --- /dev/null +++ b/charts/channels/templates/service_web.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "channels.fullname" . }}-web + labels: + app.kubernetes.io/name: {{ include "channels.name" . }}-web + helm.sh/chart: {{ include "channels.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }}-web + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "channels.name" . }} + {{- with .Values.web.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.web.service.type }} + ports: + - port: {{ .Values.web.service.port }} + targetPort: {{ .Values.web.port }} + protocol: TCP + name: web + selector: + app.kubernetes.io/name: {{ include "channels.name" . }}-web + app.kubernetes.io/instance: {{ .Release.Name }}-web + +# vi: ft=goyaml diff --git a/charts/channels/templates/serviceaccount.yaml b/charts/channels/templates/serviceaccount.yaml new file mode 100644 index 0000000..835da88 --- /dev/null +++ b/charts/channels/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "channels.serviceAccountName" . }} + labels: +{{ include "channels.labels" . | nindent 4 }} +{{- end -}} diff --git a/charts/channels/values.yaml b/charts/channels/values.yaml new file mode 100644 index 0000000..a71f18d --- /dev/null +++ b/charts/channels/values.yaml @@ -0,0 +1,82 @@ +# Default values for channels. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: everpcpc/channels + tag: latest + pullPolicy: Always + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +ingress: + enabled: false + # className: "nginx" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +web: + replicaCount: 2 + port: 8989 + service: + type: ClusterIP + port: 8989 + annotations: {} + resources: {} + +irc: + enabled: true + replicaCount: 2 + port: 6667 + service: + type: ClusterIP + port: 6667 + annotations: {} + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +slack: + enabled: false + replicaCount: 1 + resources: {} + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/selenium/.helmignore b/charts/selenium/.helmignore new file mode 100644 index 0000000..a34fb98 --- /dev/null +++ b/charts/selenium/.helmignore @@ -0,0 +1,24 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj + +# OWNERS file for Kubernetes +OWNERS diff --git a/charts/selenium/Chart.yaml b/charts/selenium/Chart.yaml new file mode 100644 index 0000000..ca1e99e --- /dev/null +++ b/charts/selenium/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v2 +name: selenium +version: 1.3.0 +appVersion: 3.141.59 +description: Chart for selenium grid +type: application +keywords: +- qa +home: http://www.seleniumhq.org/ +icon: http://docs.seleniumhq.org/images/big-logo.png +sources: +- https://github.com/SeleniumHQ/docker-selenium +- https://github.com/douban/charts +maintainers: +- name: LeoQuote diff --git a/charts/selenium/README.md b/charts/selenium/README.md new file mode 100644 index 0000000..7bc6bcd --- /dev/null +++ b/charts/selenium/README.md @@ -0,0 +1,236 @@ +# ⚠️ Repo Archive Notice + +As of Nov 13, 2020, charts in this repo will no longer be updated. +For more information, see the Helm Charts [Deprecation and Archive Notice](https://github.com/helm/charts#%EF%B8%8F-deprecation-and-archive-notice), and [Update](https://helm.sh/blog/charts-repo-deprecation/). + +# Selenium + +## DEPRECATION NOTICE + +This chart is deprecated and no longer supported. + +## TL;DR; + +```console +$ helm install stable/selenium +``` + +## Introduction + +This chart bootstraps a [Selenium](http://www.seleniumhq.org/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.5+ with Beta APIs enabled + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm install --name my-release stable/selenium +``` + +The command deploys Selenium on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following table lists the configurable parameters of the Selenium chart and their default values. + +| Parameter | Description | Default | +| --------- | ----------- | ------- | +| `global.nodeSelector` | Node label to be useed globally for scheduling of all images | `nil` | +| `global.hostAliases` | A list of hostAliases, that contains ip and hostnames, to be used globally | `[]` | +| `global.affinity` | Deployemnt affinities to be used globally for scheduling of all images | `nil` | +| `global.tolerations` | Deployment tolerations to be used globally for scheduling of all images | `nil` | +| `global.imagePullSecrets` | The secret to use for pulling the images for all deployments | `nil` | +| `hub.image` | The selenium hub image | `selenium/hub` | +| `hub.tag` | The selenium hub image tag | `3.141.59` | +| `hub.imagePullSecrets` | The secret to use for pulling the image. Will override the global parameter if set | `nil` | +| `hub.pullPolicy` | The pull policy for the hub image | `IfNotPresent` | +| `hub.port` | The port the hub listens on | `4444` | +| `hub.servicePort` | The port the hub Service listens on | `4444` | +| `hub.nodePort` | The port the hub is exposed when Nodeport mode is selected | `nil` | +| `hub.podAnnotations` | Annotations on the hub pod | `{}` | +| `hub.podLabels` | Additionals labels to the hub pod | `{}`| +| `hub.securityContext` | SecurityContext on the hub pod | `{"runAsUser": 1000, "fsGroup": 1000}` | +| `hub.extraEnvs` | Any additional environment variables to set in the pods | `[]` | +| `hub.javaOpts` | The java options for the selenium hub JVM, default sets the maximum heap size to 400 mb | `-Xmx400m` | +| `hub.resources` | The resources for the hub container, defaults to minimum half a cpu and maximum 512 mb RAM | `{"limits":{"cpu":".5", "memory":"512Mi"}}` | +| `hub.serviceType` | The Service type | `LoadBalancer` | +| `hub.serviceLoadBalancerIP` | The Public IP for the Load Balancer | `nil` | +| `hub.loadBalancerSourceRanges` | A list of IP CIDRs allowed access to load balancer (if supported) | `[]` | +| `hub.serviceSessionAffinity` | The session affinity for the hub service| `None` | +| `hub.gridNewSessionWaitTimeout` | | `nil` | +| `hub.gridJettyMaxThreads` | | `nil` | +| `hub.gridNodePolling` | | `nil` | +| `hub.gridCleanUpCycle` | Specifies how often the hub will poll running proxies for timed-out (i.e. hung) threads **(in ms)**. Must also specify "timeout" option | `nil` | +| `hub.gridTimeout` | Specifies the timeout before the server automatically kills a session that hasn't had any activity in the last X seconds.| `nil` | +| `hub.gridBrowserTimeout` | Number of seconds a browser session is allowed to hang while a WebDriver command is running | `nil` | +| `hub.gridMaxSession` | | `nil` | +| `hub.gridUnregisterIfStillDownAfter` | | `nil` | +| `hub.seOpts` | Command line arguments to pass to hub | `nil` | +| `hub.timeZone` | The time zone for the container | `nil` | +| `hub.nodeSelector` | Node label to use for scheduling of the hub if set this takes precedence over the global value | `nil` | +| `hub.affinity` | Deployemnt affinities to use for scheduling of the hub if set this takes precedence over the global value | `nil` | +| `hub.tolerations` | Deployment tolerations to use for scheduling of the hub if set this takes precedence over the global value | `nil` | +| `hub.ingress.enabled` | Configure an ingress for the selenium hub | `false` | +| `hub.ingress.annotations` | Annotations for the ingress for the selenium hub | `nil` | +| `hub.ingress.path` | The path for this ingress from which to route the traffic to the selenium hub | `/` | +| `hub.ingress.hosts` | The list hosts for which this ingress should resolve the selenium hub | `[selenium-hub.local]` | +| `hub.ingress.tls` | The tls secret to configure ssl for this ingress | `[]` | +| `hub.readinessTimeout` | Timeout for hub readiness probe in seconds | `1` | +| `hub.livenessTimeout` | Timeout for hub liveness probe in seconds | `1` | +| `hub.probePath` | Path for readiness and liveness probes to check | `/wd/hub/status` | +| `chrome.enabled` | Schedule a chrome node pod | `false` | +| `chrome.runAsDaemonSet` | Schedule chrome node pods as DaemonSet | `false` | +| `chrome.image` | The selenium node chrome image | `selenium/node-chrome` | +| `chrome.tag` | The selenium node chrome tag | `3.141.59` | +| `chrome.imagePullSecrets` | The secret to use for pulling the image. Will override the global parameter if set | `nil` | +| `chrome.pullPolicy` | The pull policy for the node chrome image | `IfNotPresent` | +| `chrome.replicas` | The number of selenium node chrome pods. This is ignored if runAsDaemonSet is enabled. | `1` | +| `chrome.enableLivenessProbe` | When true will add a liveness check to the pod | `false` | +| `chrome.waitForRunningSessions` | When true will wait for current running sessions to finish before terminating the pod | `false` | +| `chrome.podAnnotations` | Annotations on the chrome pods | `{}` | +| `chrome.podLabels` | Additional labels on the chrome pods | `{}` | +| `chrome.securityContext` | SecurityContext on the chrome pods | `{"runAsUser": 1000, "fsGroup": 1000}` | +| `chrome.extraEnvs` | Any additional environment variables to set in the pods | `[]` | +| `chrome.javaOpts` | The java options for the selenium node chrome JVM, default sets the maximum heap size to 900 mb | `-Xmx900m` | +| `chrome.volumeMounts` | Additional volumes to mount, the default provides a larger shared memory | `[{"mountPath":"/dev/shm", "name":"dshm"}]` | +| `chrome.volumes` | Additional volumes import, the default provides a larger shared memory | `[{"name":"dshm", "emptyDir":{"medium":"Memory"}}]` | +| `chrome.resources` | The resources for the node chrome container, defaults to minimum half a cpu and maximum 1,000 mb | `{"limits":{"cpu":".5", "memory":"1000Mi"}}` | +| `chrome.screenWidth` | | `nil` | +| `chrome.screenHeight` | | `nil` | +| `chrome.screenDepth` | | `nil` | +| `chrome.display` | The vnc display | `nil` | +| `chrome.chromeVersion` | The version of chrome to use | `nil` | +| `chrome.nodeMaxInstances` | The maximum number of browser instances | `nil` | +| `chrome.nodeMaxSession` | The maximum number of sessions | `nil` | +| `chrome.nodeRegistryCycle` | The number of milliseconds to wait, registering a node| `nil` | +| `chrome.nodePort` | The port to listen on | `nil` | +| `chrome.seOpts` | Command line arguments to pass to node | `nil` | +| `chrome.timeZone` | The time zone for the container | `nil` | +| `chrome.nodeSelector` | Node label to use for scheduling of chrome images if set this takes precedence over the global value | `nil` | +| `chrome.affinity` | Deployemnt affinities to use for scheduling of the chrome if set this takes precedence over the global value | `nil` | +| `chrome.tolerations` | Deployment tolerations to use for scheduling of the chrome if set this takes precedence over the global value | `nil` | +| `chromeDebug.enabled` | Schedule a selenium node chrome debug pod | `false` | +| `chromeDebug.runAsDaemonSet` | Schedule selenium node chrome debug pods as DaemonSet | `false` | +| `chromeDebug.image` | The selenium node chrome debug image | `selenium/node-chrome-debug` | +| `chromeDebug.tag` | The selenium node chrome debug tag | `3.141.59` | +| `chromeDebug.imagePullSecrets` | The secret to use for pulling the image. Will override the global parameter if set | `nil` | +| `chromeDebug.pullPolicy` | The selenium node chrome debug pull policy | `IfNotPresent` | +| `chromeDebug.replicas` | The number of selenium node chrome debug pods. This is ignored if runAsDaemonSet is enabled. | `1` | +| `chromeDebug.enableLivenessProbe` | When true will add a liveness check to the pod | `false` | +| `chromeDebug.waitForRunningSessions` | When true will wait for current running sessions to finish before terminating the pod | `false` | +| `chromeDebug.podAnnotations` | Annotations on the Chrome debug pod | `{}` | +| `chromeDebug.podLabels` | Additional labels on the Chrome debug pods | `{}` | +| `chromeDebug.securityContext` | SecurityContext on the Chrome debug pods | `{"runAsUser": 1000, "fsGroup": 1000}` | +| `chromeDebug.extraEnvs` | Any additional environment variables to set in the pods | `[]` | +| `chromeDebug.javaOpts` | The java options for a selenium node chrome debug JVM, default sets the max heap size to 900 mb | `-Xmx900m` | +| `chromeDebug.volumeMounts` | Additional volumes to mount, the default provides a larger shared | `[{"mountPath":"/dev/shm", "name":"dshm"}]` | +| `chromeDebug.volumes` | Additional volumes import, the default provides a larger shared | `[{"name":"dshm", "emptyDir":{"medium":"Memory"}}]` | +| `chromeDebug.resources` | The resources for the hub container, defaults to minimum half a cpu and maximum 1,000 mb | `{"limits":{"cpu":".5", "memory":"1000Mi"}}` | +| `chromeDebug.screenWidth` | | `nil` | +| `chromeDebug.screenHeight` | | `nil` | +| `chromeDebug.screenDepth` | | `nil` | +| `chromeDebug.display` | The vnc display | `nil` | +| `chromeDebug.chromeVersion` | The version of chrome to use | `nil` | +| `chromeDebug.nodeMaxInstances` | The maximum number of browser instances | `nil` | +| `chromeDebug.nodeMaxSession` | The maximum number of sessions | `nil` | +| `chromeDebug.nodeRegistryCycle` | The number of milliseconds to wait, registering a node| `nil` | +| `chromeDebug.nodePort` | The port to listen on | `nil` | +| `chromeDebug.seOpts` | Command line arguments to pass to node | `nil` | +| `chromeDebug.timeZone` | The time zone for the container | `nil` | +| `chromeDebug.nodeSelector` | Node label to use for scheduling of chromeDebug images if set this takes precedence over the global value | `nil` | +| `chromeDebug.affinity` | Deployemnt affinities to use for scheduling of the chromeDebug if set this takes precedence over the global value | `nil` | +| `chromeDebug.tolerations` | Deployment tolerations to use for scheduling of the chromeDebug if set this takes precedence over the global value | `nil` | +| `firefox.enabled` | Schedule a selenium node firefox pod | `false` | +| `firefox.runAsDaemonSet` | Schedule selenium node firefox pods as DaemonSet | `false` | +| `firefox.image` | The selenium node firefox image | `selenium/node-firefox` | +| `firefox.tag` | The selenium node firefox tag | `3.141.59` | +| `firefox.imagePullSecrets` | The secret to use for pulling the image. Will override the global parameter if set | `nil` | +| `firefox.pullPolicy` | The selenium node firefox pull policy | `IfNotPresent` | +| `firefox.replicas` | The number of selenium node firefox pods. This is ignored if runAsDaemonSet is enabled. | `1` | +| `firefox.enableLivenessProbe` | When true will add a liveness check to the pod | `false` | +| `firefox.waitForRunningSessions` | When true will wait for current running sessions to finish before terminating the pod | `false` | +| `firefox.podAnnotations` | Annotations on the firefox pods | `{}` | +| `firefox.podLabels` | Additional labels on the firefox pods | `{}` | +| `firefox.securityContext` | SecurityContext on the firefox pods | `{"runAsUser": 1000, "fsGroup": 1000}` | +| `firefox.extraEnvs` | Any additional environment variables to set in the pods | `[]` | +| `firefox.javaOpts` | The java options for a selenium node firefox JVM, default sets the max heap size to 900 mb | `-Xmx900m` | +| `firefox.volumeMounts` | Additional volumes to mount, the default provides a larger shared memory | `[{"mountPath":"/dev/shm", "name":"dshm"}]` | +| `firefox.volumes` | Additional volumes import, the default provides a larger shared memory | `[{"name":"dshm", "emptyDir":{"medium":"Memory"}}]` | +| `firefox.resources` | The resources for the hub container, defaults to minimum half a cpu and maximum 1,000 mb | `{"limits":{"cpu":".5", "memory":"1000Mi"}}` | +| `firefox.screenWidth` | | `nil` | +| `firefox.screenHeight` | | `nil` | +| `firefox.screenDepth` | | `nil` | +| `firefox.display` | The vnc display | `nil` | +| `firefox.firefoxVersion` | The version of firefox to use | `nil` | +| `firefox.nodeMaxInstances` | The maximum number of browser instances | `nil` | +| `firefox.nodeMaxSession` | The maximum number of sessions | `nil` | +| `firefox.nodeRegistryCycle` | The number of milliseconds to wait, registering a node| `nil` | +| `firefox.nodePort` | The port to listen on | `nil` | +| `firefox.seOpts` | Command line arguments to pass to node | `nil` | +| `firefox.timeZone` | The time zone for the container | `nil` | +| `firefox.nodeSelector` | Node label to use for scheduling of firefox images if set this takes precedence over the global value | `nil` | +| `firefox.affinity` | Deployemnt affinities to use for scheduling of the firefox if set this takes precedence over the global value | `nil` | +| `firefox.tolerations` | Deployment tolerations to use for scheduling of the firefox if set this takes precedence over the global value | `nil` | +| `firefoxDebug.enabled` | Schedule a selenium node firefox debug pod | `false` | +| `firefoxDebug.runAsDaemonSet` | Schedule selenium node firefox debug pods as DaemonSet | `false` | +| `firefoxDebug.image` | The selenium node firefox debug image | `selenium/node-firefox-debug` | +| `firefoxDebug.tag` | The selenium node firefox debug tag | `3.141.59` | +| `firefoxDebug.imagePullSecrets` | The secret to use for pulling the image. Will override the global parameter if set | `nil` | +| `firefoxDebug.pullPolicy` | The selenium node firefox debug pull policy | `IfNotPresent` | +| `firefoxDebug.replicas` | The number of selenium node firefox debug pods. This is ignored if runAsDaemonSet is enabled. | `1` | +| `firefoxDebug.enableLivenessProbe` | When true will add a liveness check to the pod | `false` | +| `firefoxDebug.waitForRunningSessions` | When true will wait for current running sessions to finish before terminating the pod | `false` | +| `firefoxDebug.podAnnotations` | Annotations on the firefox debug pods | `{}` | +| `firefoxDebug.podLabels` | Additional labels on the firefox debug pods | `{}` | +| `firefoxDebug.securityContext` | SecurityContext on the firefox debug pods | `{"runAsUser": 1000, "fsGroup": 1000}` | +| `firefoxDebug.extraEnvs` | Any additional environment variables to set in the pods | `[]` | +| `firefoxDebug.javaOpts` | The java options for a selenium node firefox debug JVM, default sets the max heap size to 900 mb | `-Xmx900m` | +| `firefoxDebug.volumeMounts` | Additional volumes to mount, the default provides a larger shared | `[{"mountPath":"/dev/shm", "name":"dshm"}]` | +| `firefoxDebug.volumes` | Additional volumes import, the default provides a larger shared | `[{"name":"dshm", "emptyDir":{"medium":"Memory"}}]` | +| `firefoxDebug.resources` | The resources for the selenium node firefox debug container, defaults to minimum half a cpu and maximum 1,000 mb | `{"limits":{"cpu":".5", "memory":"1000Mi"}}` | +| `firefoxDebug.screenWidth` | | `nil` | +| `firefoxDebug.screenHeight` | | `nil` | +| `firefoxDebug.screenDepth` | | `nil` | +| `firefoxDebug.display` | The vnc display | `nil` | +| `firefoxDebug.firefoxVersion` | The version of firefox to use | `nil` | +| `firefoxDebug.nodeMaxInstances` | The maximum number of browser instances | `nil` | +| `firefoxDebug.nodeMaxSession` | The maximum number of sessions | `nil` | +| `firefoxDebug.nodeRegistryCycle` | The number of milliseconds to wait, registering a node| `nil` | +| `firefoxDebug.nodePort` | The port to listen on | `nil` | +| `firefoxDebug.seOpts` | Command line arguments to pass to node | `nil` | +| `firefoxDebug.timeZone` | The time zone for the container | `nil` | +| `firefoxDebug.nodeSelector` | Node label to use for scheduling of firefoxDebug images if set this takes precedence over the global value | `nil` | +| `firefoxDebug.affinity` | Deployemnt affinities to use for scheduling of the firefoxDebug if set this takes precedence over the global value | `nil` | +| `firefoxDebug.tolerations` | Deployment tolerations to use for scheduling of the firefoxDebug if set this takes precedence over the global value | `nil` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install --name my-release \ + --set chrome.enabled=true \ + stable/selenium +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml stable/selenium +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) diff --git a/charts/selenium/templates/NOTES.txt b/charts/selenium/templates/NOTES.txt new file mode 100644 index 0000000..29608aa --- /dev/null +++ b/charts/selenium/templates/NOTES.txt @@ -0,0 +1,95 @@ +Selenium Hub can be accessed via port {{ .Values.hub.port }} on the following +DNS name from within your cluster: + +- http://{{ template "selenium.hub.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.hub.port }} + +You can easily connect to the remote instance from your browser. Forward the +webserver port to localhost:4444 + +- kubectl port-forward --namespace {{ .Release.Namespace }} \ + $(kubectl get pods --namespace {{ .Release.Namespace }} \ + -l app={{ template "selenium.hub.fullname" . }} \ + -o jsonpath='{ .items[0].metadata.name }') 4444 + +You can also connect to the container running Selenium Hub. To open a shell +session in the pod run the following: + +- kubectl exec -i -t --namespace {{ .Release.Namespace }} \ + $(kubectl get pods --namespace {{ .Release.Namespace }} \ + -l app={{ template "selenium.hub.fullname" . }} \ + -o jsonpath='{.items[0].metadata.name}') /bin/sh + +To tail the logs for the Selenium Hub pod run the following: + +- kubectl logs -f --namespace {{ .Release.Namespace }} \ + $(kubectl get pods --namespace {{ .Release.Namespace }} \ + -l app={{ template "selenium.hub.fullname" . }} \ + -o jsonpath='{ .items[0].metadata.name }') + +{{- if eq .Values.hub.serviceType "LoadBalancer" }} + +To watch for the LoadBalancer IP run the following + +- kubectl get svc -w --namespace {{ .Release.Namespace }} \ + -l app={{ template "selenium.hub.fullname" . }} +{{- end }} + +{{- if and (not .Values.chrome.enabled) (not .Values.chromeDebug.enabled) (not .Values.firefox.enabled) (not .Values.firefoxDebug.enabled) }} +WARNING: No nodes enabled, no browsers available via hub + +- Enable Chrome + helm upgrade --set chrome.enabled=true {{ .Release.Name }} stable/selenium + +- Enable Chrome Debug + helm upgrade --set chromeDebug.enabled=true {{ .Release.Name }} stable/selenium + +- Enable Firefox + helm upgrade --set firefox.enabled=true {{ .Release.Name }} stable/selenium + +- Enable Firefox Debug + helm upgrade --set firefoxDebug.enabled=true {{ .Release.Name }} stable/selenium + +{{- else -}} + +To scale the number of selenium nodes + +{{- if eq true .Values.chrome.enabled }} +- Chrome + helm upgrade --set chrome.replicas=N {{ .Release.Name }} stable/selenium +{{ end }} + +{{- if eq true .Values.chromeDebug.enabled }} +- Chrome Debug + helm upgrade --set chromeDebug.replicas=N {{ .Release.Name }} stable/selenium + +- Chrome VNC + kubectl port-forward --namespace {{ .Release.Namespace }} \ + $(kubectl get pods --namespace {{ .Release.Namespace }} \ + -l app={{ template "selenium.chromeDebug.fullname" . }} \ + -o jsonpath='{ .items[0].metadata.name }') 5900 + + Install VNC Client and open a session at localhost:5900. Username is not + required, password is "secret". +{{ end }} + +{{- if eq true .Values.firefox.enabled }} +- Firefox + helm upgrade --set firefox.replicas=N {{ .Release.Name }} stable/selenium +{{ end }} + +{{ if eq true .Values.firefoxDebug.enabled }} +- Firefox Debug + helm upgrade --set firefoxDebug.replicas=N {{ .Release.Name }} stable/selenium +- Firefox VNC + kubectl port-forward --namespace {{ .Release.Namespace }} \ + $(kubectl get pods --namespace {{ .Release.Namespace }} \ + -l app={{ template "selenium.firefoxDebug.fullname" . }} \ + -o jsonpath='{ .items[0].metadata.name }') 5900 + + Install VNC Client and open a session at localhost:5900. Username is not + required, password is "secret". +{{ end -}} + +{{ end }} + +If you find your hub is OOMKilled, try adding -XX:+UseSerialGC to hub.javaOpts. diff --git a/charts/selenium/templates/_helpers.tpl b/charts/selenium/templates/_helpers.tpl new file mode 100644 index 0000000..3496ce0 --- /dev/null +++ b/charts/selenium/templates/_helpers.tpl @@ -0,0 +1,67 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "selenium.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "selenium.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name, for hub. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "selenium.hub.fullname" -}} +{{- printf "%s-selenium-hub" .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name, for chrome. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "selenium.chrome.fullname" -}} +{{- printf "%s-selenium-chrome" .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name, for chromeDebug. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "selenium.chromeDebug.fullname" -}} +{{- printf "%s-selenium-chrome-debug" .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name, for firefox. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "selenium.firefox.fullname" -}} +{{- printf "%s-selenium-firefox" .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name, for firefoxDebug. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "selenium.firefoxDebug.fullname" -}} +{{- printf "%s-selenium-firefox-debug" .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Return the apiVersion of deployment. +*/}} +{{- define "deployment.apiVersion" -}} +{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} diff --git a/charts/selenium/templates/chrome-daemonset.yaml b/charts/selenium/templates/chrome-daemonset.yaml new file mode 100644 index 0000000..6eaacb2 --- /dev/null +++ b/charts/selenium/templates/chrome-daemonset.yaml @@ -0,0 +1,142 @@ +{{- if and (eq true .Values.chrome.enabled) (eq true .Values.chrome.runAsDaemonSet) -}} +apiVersion: {{ template "deployment.apiVersion" . }} +kind: DaemonSet +metadata: + name: {{ template "selenium.chrome.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + selector: + matchLabels: + app: {{ template "selenium.chrome.fullname" . }} + release: "{{ .Release.Name }}" + template: + metadata: + labels: + app: {{ template "selenium.chrome.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + {{- with .Values.chrome.podLabels }} + {{ toYaml .| indent 2 }} + {{- end }} + {{- if .Values.chrome.podAnnotations }} + annotations: +{{ toYaml .Values.chrome.podAnnotations | indent 8 }} + {{- end}} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.chrome.image }}:{{ .Values.chrome.tag }}" + imagePullPolicy: {{ .Values.chrome.pullPolicy }} + ports: + {{- if .Values.hub.jmxPort }} + - containerPort: {{ .Values.hub.jmxPort }} + name: jmx + protocol: TCP + {{- end }} + {{- if .Values.chrome.enableLivenessProbe }} + livenessProbe: + httpGet: + path: /wd/hub/status + port: {{ default "5555" .Values.chrome.nodePort }} + initialDelaySeconds: 30 + periodSeconds: 30 + failureThreshold: 1 + {{- end }} + {{- if .Values.chrome.waitForRunningSessions }} + lifecycle: + preStop: + exec: + command: + - /bin/bash + - -c + - "while [ $(wget -q -O - http://localhost:{{ default "5555" .Values.chrome.nodePort }}/wd/hub/sessions | grep -c capabilities) -gt 0 ]; do sleep 1; done" + {{- end }} + env: + - name: HUB_PORT_4444_TCP_ADDR + value: {{ template "selenium.hub.fullname" . }} + - name: HUB_PORT_4444_TCP_PORT + value: {{ .Values.hub.servicePort | quote }} + - name: JAVA_TOOL_OPTIONS + value: {{ default "" .Values.chrome.javaOpts | quote }} + - name: SE_OPTS + value: {{ default "" .Values.chrome.seOpts | quote }} + {{- if .Values.chrome.chromeVersion }} + - name: CHROME_VERSION + value: {{ .Values.chrome.chromeVersion | quote }} + {{- end }} + {{- if .Values.chrome.nodeMaxInstances }} + - name: NODE_MAX_INSTANCES + value: {{ .Values.chrome.nodeMaxInstances | quote }} + {{- end }} + {{- if .Values.chrome.nodeMaxSession }} + - name: NODE_MAX_SESSION + value: {{ .Values.chrome.nodeMaxSession | quote }} + {{- end }} + {{- if .Values.chrome.nodeRegisterCycle }} + - name: NODE_REGISTER_CYCLE + value: {{ .Values.chrome.nodeRegisterCycle | quote }} + {{- end }} + {{- if .Values.chrome.nodePort }} + - name: NODE_PORT + value: {{ .Values.chrome.nodePort | quote }} + {{- end }} + {{- if .Values.chrome.screenWidth }} + - name: SCREEN_WIDTH + value: {{ .Values.chrome.screenWidth | quote }} + {{- end }} + {{- if .Values.chrome.screenHeight }} + - name: SCREEN_HEIGHT + value: {{ .Values.chrome.screenHeight | quote }} + {{- end }} + {{- if .Values.chrome.screenDepth }} + - name: SCREEN_DEPTH + value: {{ .Values.chrome.screenDepth | quote }} + {{- end }} + {{- if .Values.chrome.display }} + - name: DISPLAY + value: {{ .Values.chrome.display | quote }} + {{- end }} + {{- if .Values.chrome.timeZone }} + - name: TZ + value: {{ .Values.chrome.timeZone | quote }} + {{- end }} + {{- if .Values.chrome.extraEnvs }} +{{ toYaml .Values.chrome.extraEnvs | indent 12 }} + {{- end }} + volumeMounts: +{{ if .Values.chrome.volumeMounts -}} +{{ toYaml .Values.chrome.volumeMounts | trim | indent 12 }} +{{- end }} + resources: +{{ toYaml .Values.chrome.resources | trim | indent 12 }} +{{- if or .Values.global.imagePullSecrets .Values.chrome.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.chrome.imagePullSecrets | default .Values.global.imagePullSecrets | quote }} +{{- end }} + volumes: +{{ if .Values.chrome.volumes -}} +{{ toYaml .Values.chrome.volumes | trim | indent 8 }} +{{- end }} + hostAliases: +{{ toYaml .Values.global.hostAliases | trim | indent 8 }} + nodeSelector: +{{- if .Values.chrome.nodeSelector }} +{{ toYaml .Values.chrome.nodeSelector | trim | indent 8 }} +{{- else if .Values.global.nodeSelector }} +{{ toYaml .Values.global.nodeSelector | trim | indent 8 }} +{{- end }} + affinity: +{{- if .Values.chrome.affinity }} +{{ toYaml .Values.chrome.affinity | indent 8 }} +{{- else if .Values.global.affinity }} +{{ toYaml .Values.global.affinity | indent 8 }} +{{- end }} + tolerations: +{{- if .Values.chrome.tolerations }} +{{ toYaml .Values.chrome.tolerations | indent 8 }} +{{- else if .Values.global.tolerations }} +{{ toYaml .Values.global.tolerations | indent 8 }} +{{- end }} +{{- end -}} diff --git a/charts/selenium/templates/chrome-deployment.yaml b/charts/selenium/templates/chrome-deployment.yaml new file mode 100644 index 0000000..94fa433 --- /dev/null +++ b/charts/selenium/templates/chrome-deployment.yaml @@ -0,0 +1,147 @@ +{{- if and (eq true .Values.chrome.enabled) (eq false .Values.chrome.runAsDaemonSet) -}} +apiVersion: {{ template "deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "selenium.chrome.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + replicas: {{ .Values.chrome.replicas }} + selector: + matchLabels: + app: {{ template "selenium.chrome.fullname" . }} + release: "{{ .Release.Name }}" + template: + metadata: + labels: + app: {{ template "selenium.chrome.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + {{- with .Values.chrome.podLabels }} + {{ toYaml .| indent 2 }} + {{- end }} + {{- if .Values.chrome.podAnnotations }} + annotations: +{{ toYaml .Values.chrome.podAnnotations | indent 8 }} + {{- end}} + spec: + {{- if .Values.chrome.securityContext }} + securityContext: +{{ toYaml .Values.chrome.securityContext | indent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.chrome.image }}:{{ .Values.chrome.tag }}" + imagePullPolicy: {{ .Values.chrome.pullPolicy }} + ports: + {{- if .Values.hub.jmxPort }} + - containerPort: {{ .Values.hub.jmxPort }} + name: jmx + protocol: TCP + {{- end }} + {{- if .Values.chrome.enableLivenessProbe }} + livenessProbe: + httpGet: + path: /wd/hub/status + port: {{ default "5555" .Values.chrome.nodePort }} + initialDelaySeconds: 30 + periodSeconds: 30 + failureThreshold: 1 + {{- end }} + {{- if .Values.chrome.waitForRunningSessions }} + lifecycle: + preStop: + exec: + command: + - /bin/bash + - -c + - "while [ $(wget -q -O - http://localhost:{{ default "5555" .Values.chrome.nodePort }}/wd/hub/sessions | grep -c capabilities) -gt 0 ]; do sleep 1; done" + {{- end }} + env: + - name: HUB_PORT_4444_TCP_ADDR + value: {{ template "selenium.hub.fullname" . }} + - name: HUB_PORT_4444_TCP_PORT + value: {{ .Values.hub.servicePort | quote }} + - name: JAVA_TOOL_OPTIONS + value: {{ default "" .Values.chrome.javaOpts | quote }} + - name: SE_OPTS + value: {{ default "" .Values.chrome.seOpts | quote }} + {{- if .Values.chrome.chromeVersion }} + - name: CHROME_VERSION + value: {{ .Values.chrome.chromeVersion | quote }} + {{- end }} + {{- if .Values.chrome.nodeMaxInstances }} + - name: NODE_MAX_INSTANCES + value: {{ .Values.chrome.nodeMaxInstances | quote }} + {{- end }} + {{- if .Values.chrome.nodeMaxSession }} + - name: NODE_MAX_SESSION + value: {{ .Values.chrome.nodeMaxSession | quote }} + {{- end }} + {{- if .Values.chrome.nodeRegisterCycle }} + - name: NODE_REGISTER_CYCLE + value: {{ .Values.chrome.nodeRegisterCycle | quote }} + {{- end }} + {{- if .Values.chrome.nodePort }} + - name: NODE_PORT + value: {{ .Values.chrome.nodePort | quote }} + {{- end }} + {{- if .Values.chrome.screenWidth }} + - name: SCREEN_WIDTH + value: {{ .Values.chrome.screenWidth | quote }} + {{- end }} + {{- if .Values.chrome.screenHeight }} + - name: SCREEN_HEIGHT + value: {{ .Values.chrome.screenHeight | quote }} + {{- end }} + {{- if .Values.chrome.screenDepth }} + - name: SCREEN_DEPTH + value: {{ .Values.chrome.screenDepth | quote }} + {{- end }} + {{- if .Values.chrome.display }} + - name: DISPLAY + value: {{ .Values.chrome.display | quote }} + {{- end }} + {{- if .Values.chrome.timeZone }} + - name: TZ + value: {{ .Values.chrome.timeZone | quote }} + {{- end }} + {{- if .Values.chrome.extraEnvs }} +{{ toYaml .Values.chrome.extraEnvs | indent 12 }} + {{- end }} + volumeMounts: +{{ if .Values.chrome.volumeMounts -}} +{{ toYaml .Values.chrome.volumeMounts | trim | indent 12 }} +{{- end }} + resources: +{{ toYaml .Values.chrome.resources | trim | indent 12 }} +{{- if or .Values.global.imagePullSecrets .Values.chrome.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.chrome.imagePullSecrets | default .Values.global.imagePullSecrets | quote }} +{{- end }} + volumes: +{{ if .Values.chrome.volumes -}} +{{ toYaml .Values.chrome.volumes | trim | indent 8 }} +{{- end }} + hostAliases: +{{ toYaml .Values.global.hostAliases | trim | indent 8 }} + nodeSelector: +{{- if .Values.chrome.nodeSelector }} +{{ toYaml .Values.chrome.nodeSelector | trim | indent 8 }} +{{- else if .Values.global.nodeSelector }} +{{ toYaml .Values.global.nodeSelector | trim | indent 8 }} +{{- end }} + affinity: +{{- if .Values.chrome.affinity }} +{{ toYaml .Values.chrome.affinity | indent 8 }} +{{- else if .Values.global.affinity }} +{{ toYaml .Values.global.affinity | indent 8 }} +{{- end }} + tolerations: +{{- if .Values.chrome.tolerations }} +{{ toYaml .Values.chrome.tolerations | indent 8 }} +{{- else if .Values.global.tolerations }} +{{ toYaml .Values.global.tolerations | indent 8 }} +{{- end }} +{{- end -}} diff --git a/charts/selenium/templates/chromeDebug-daemonset.yaml b/charts/selenium/templates/chromeDebug-daemonset.yaml new file mode 100644 index 0000000..c0a4b85 --- /dev/null +++ b/charts/selenium/templates/chromeDebug-daemonset.yaml @@ -0,0 +1,144 @@ +{{- if and (eq true .Values.chromeDebug.enabled) (eq true .Values.chromeDebug.runAsDaemonSet) -}} +apiVersion: {{ template "deployment.apiVersion" . }} +kind: DaemonSet +metadata: + name: {{ template "selenium.chromeDebug.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + selector: + matchLabels: + app: {{ template "selenium.chromeDebug.fullname" . }} + release: "{{ .Release.Name }}" + template: + metadata: + labels: + app: {{ template "selenium.chromeDebug.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + {{- with .Values.chromeDebug.podLabels }} + {{ toYaml .| indent 2 }} + {{- end }} + {{- if .Values.chromeDebug.podAnnotations }} + annotations: +{{ toYaml .Values.chromeDebug.podAnnotations | indent 8 }} + {{- end}} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.chromeDebug.image }}:{{ .Values.chromeDebug.tag }}" + imagePullPolicy: {{ .Values.chromeDebug.pullPolicy }} + ports: + {{- if .Values.hub.jmxPort }} + - containerPort: {{ .Values.hub.jmxPort }} + name: jmx + protocol: TCP + {{- end }} + - containerPort: 5900 + name: vnc + {{- if .Values.chromeDebug.enableLivenessProbe }} + livenessProbe: + httpGet: + path: /wd/hub/status + port: {{ default "5555" .Values.chromeDebug.nodePort }} + initialDelaySeconds: 30 + periodSeconds: 30 + failureThreshold: 1 + {{- end }} + {{- if .Values.chromeDebug.waitForRunningSessions }} + lifecycle: + preStop: + exec: + command: + - /bin/bash + - -c + - "while [ $(wget -q -O - http://localhost:{{ default "5555" .Values.chromeDebug.nodePort }}/wd/hub/sessions | grep -c capabilities) -gt 0 ]; do sleep 1; done" + {{- end }} + env: + - name: HUB_PORT_4444_TCP_ADDR + value: {{ template "selenium.hub.fullname" . }} + - name: HUB_PORT_4444_TCP_PORT + value: {{ .Values.hub.servicePort | quote }} + - name: JAVA_TOOL_OPTIONS + value: {{ default "" .Values.chromeDebug.javaOpts | quote }} + - name: SE_OPTS + value: {{ default "" .Values.chromeDebug.seOpts | quote }} + {{- if .Values.chromeDebug.chromeVersion }} + - name: CHROME_VERSION + value: {{ .Values.chromeDebug.chromeVersion | quote }} + {{- end }} + {{- if .Values.chromeDebug.nodeMaxInstances }} + - name: NODE_MAX_INSTANCES + value: {{ .Values.chromeDebug.nodeMaxInstances | quote }} + {{- end }} + {{- if .Values.chromeDebug.nodeMaxSession }} + - name: NODE_MAX_SESSION + value: {{ .Values.chromeDebug.nodeMaxSession | quote }} + {{- end }} + {{- if .Values.chromeDebug.nodeRegisterCycle }} + - name: NODE_REGISTER_CYCLE + value: {{ .Values.chromeDebug.nodeRegisterCycle | quote }} + {{- end }} + {{- if .Values.chromeDebug.nodePort }} + - name: NODE_PORT + value: {{ .Values.chromeDebug.nodePort | quote }} + {{- end }} + {{- if .Values.chromeDebug.screenWidth }} + - name: SCREEN_WIDTH + value: {{ .Values.chromeDebug.screenWidth | quote }} + {{- end }} + {{- if .Values.chromeDebug.screenHeight }} + - name: SCREEN_HEIGHT + value: {{ .Values.chromeDebug.screenHeight | quote }} + {{- end }} + {{- if .Values.chromeDebug.screenDepth }} + - name: SCREEN_DEPTH + value: {{ .Values.chromeDebug.screenDepth | quote }} + {{- end }} + {{- if .Values.chromeDebug.display }} + - name: DISPLAY + value: {{ .Values.chromeDebug.display | quote }} + {{- end }} + {{- if .Values.chromeDebug.timeZone }} + - name: TZ + value: {{ .Values.chromeDebug.timeZone | quote }} + {{- end }} + {{- if .Values.chromeDebug.extraEnvs }} +{{ toYaml .Values.chromeDebug.extraEnvs | indent 12 }} + {{- end }} + volumeMounts: +{{ if .Values.chromeDebug.volumeMounts -}} +{{ toYaml .Values.chromeDebug.volumeMounts | indent 12 }} +{{- end }} + resources: +{{ toYaml .Values.chromeDebug.resources | indent 12 }} +{{- if or .Values.global.imagePullSecrets .Values.chromeDebug.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.chromeDebug.imagePullSecrets | default .Values.global.imagePullSecrets | quote }} +{{- end }} + volumes: +{{ if .Values.chromeDebug.volumes -}} +{{ toYaml .Values.chromeDebug.volumes | indent 8 }} +{{- end }} + hostAliases: +{{ toYaml .Values.global.hostAliases | indent 8 }} + nodeSelector: +{{- if .Values.chromeDebug.nodeSelector }} +{{ toYaml .Values.chromeDebug.nodeSelector | indent 8 }} +{{- else if .Values.global.nodeSelector }} +{{ toYaml .Values.global.nodeSelector | indent 8 }} +{{- end }} + affinity: +{{- if .Values.chromeDebug.affinity }} +{{ toYaml .Values.chromeDebug.affinity | indent 8 }} +{{- else if .Values.global.affinity }} +{{ toYaml .Values.global.affinity | indent 8 }} +{{- end }} + tolerations: +{{- if .Values.chromeDebug.tolerations }} +{{ toYaml .Values.chromeDebug.tolerations | indent 8 }} +{{- else if .Values.global.tolerations }} +{{ toYaml .Values.global.tolerations | indent 8 }} +{{- end }} +{{- end -}} diff --git a/charts/selenium/templates/chromeDebug-deployment.yaml b/charts/selenium/templates/chromeDebug-deployment.yaml new file mode 100644 index 0000000..2fa0ce6 --- /dev/null +++ b/charts/selenium/templates/chromeDebug-deployment.yaml @@ -0,0 +1,149 @@ +{{- if and (eq true .Values.chromeDebug.enabled) (eq false .Values.chromeDebug.runAsDaemonSet) -}} +apiVersion: {{ template "deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "selenium.chromeDebug.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + replicas: {{ .Values.chromeDebug.replicas }} + selector: + matchLabels: + app: {{ template "selenium.chromeDebug.fullname" . }} + release: "{{ .Release.Name }}" + template: + metadata: + labels: + app: {{ template "selenium.chromeDebug.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + {{- with .Values.chromeDebug.podLabels }} + {{ toYaml .| indent 2 }} + {{- end }} + {{- if .Values.chromeDebug.podAnnotations }} + annotations: +{{ toYaml .Values.chromeDebug.podAnnotations | indent 8 }} + {{- end}} + spec: + {{- if .Values.chromeDebug.securityContext }} + securityContext: +{{ toYaml .Values.chromeDebug.securityContext | indent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.chromeDebug.image }}:{{ .Values.chromeDebug.tag }}" + imagePullPolicy: {{ .Values.chromeDebug.pullPolicy }} + ports: + {{- if .Values.hub.jmxPort }} + - containerPort: {{ .Values.hub.jmxPort }} + name: jmx + protocol: TCP + {{- end }} + - containerPort: 5900 + name: vnc + {{- if .Values.chromeDebug.enableLivenessProbe }} + livenessProbe: + httpGet: + path: /wd/hub/status + port: {{ default "5555" .Values.chromeDebug.nodePort }} + initialDelaySeconds: 30 + periodSeconds: 30 + failureThreshold: 1 + {{- end }} + {{- if .Values.chromeDebug.waitForRunningSessions }} + lifecycle: + preStop: + exec: + command: + - /bin/bash + - -c + - "while [ $(wget -q -O - http://localhost:{{ default "5555" .Values.chromeDebug.nodePort }}/wd/hub/sessions | grep -c capabilities) -gt 0 ]; do sleep 1; done" + {{- end }} + env: + - name: HUB_PORT_4444_TCP_ADDR + value: {{ template "selenium.hub.fullname" . }} + - name: HUB_PORT_4444_TCP_PORT + value: {{ .Values.hub.servicePort | quote }} + - name: JAVA_TOOL_OPTIONS + value: {{ default "" .Values.chromeDebug.javaOpts | quote }} + - name: SE_OPTS + value: {{ default "" .Values.chromeDebug.seOpts | quote }} + {{- if .Values.chromeDebug.chromeVersion }} + - name: CHROME_VERSION + value: {{ .Values.chromeDebug.chromeVersion | quote }} + {{- end }} + {{- if .Values.chromeDebug.nodeMaxInstances }} + - name: NODE_MAX_INSTANCES + value: {{ .Values.chromeDebug.nodeMaxInstances | quote }} + {{- end }} + {{- if .Values.chromeDebug.nodeMaxSession }} + - name: NODE_MAX_SESSION + value: {{ .Values.chromeDebug.nodeMaxSession | quote }} + {{- end }} + {{- if .Values.chromeDebug.nodeRegisterCycle }} + - name: NODE_REGISTER_CYCLE + value: {{ .Values.chromeDebug.nodeRegisterCycle | quote }} + {{- end }} + {{- if .Values.chromeDebug.nodePort }} + - name: NODE_PORT + value: {{ .Values.chromeDebug.nodePort | quote }} + {{- end }} + {{- if .Values.chromeDebug.screenWidth }} + - name: SCREEN_WIDTH + value: {{ .Values.chromeDebug.screenWidth | quote }} + {{- end }} + {{- if .Values.chromeDebug.screenHeight }} + - name: SCREEN_HEIGHT + value: {{ .Values.chromeDebug.screenHeight | quote }} + {{- end }} + {{- if .Values.chromeDebug.screenDepth }} + - name: SCREEN_DEPTH + value: {{ .Values.chromeDebug.screenDepth | quote }} + {{- end }} + {{- if .Values.chromeDebug.display }} + - name: DISPLAY + value: {{ .Values.chromeDebug.display | quote }} + {{- end }} + {{- if .Values.chromeDebug.timeZone }} + - name: TZ + value: {{ .Values.chromeDebug.timeZone | quote }} + {{- end }} + {{- if .Values.chromeDebug.extraEnvs }} +{{ toYaml .Values.chromeDebug.extraEnvs | indent 12 }} + {{- end }} + volumeMounts: +{{ if .Values.chromeDebug.volumeMounts -}} +{{ toYaml .Values.chromeDebug.volumeMounts | indent 12 }} +{{- end }} + resources: +{{ toYaml .Values.chromeDebug.resources | indent 12 }} +{{- if or .Values.global.imagePullSecrets .Values.chromeDebug.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.chromeDebug.imagePullSecrets | default .Values.global.imagePullSecrets | quote }} +{{- end }} + volumes: +{{ if .Values.chromeDebug.volumes -}} +{{ toYaml .Values.chromeDebug.volumes | indent 8 }} +{{- end }} + hostAliases: +{{ toYaml .Values.global.hostAliases | indent 8 }} + nodeSelector: +{{- if .Values.chromeDebug.nodeSelector }} +{{ toYaml .Values.chromeDebug.nodeSelector | indent 8 }} +{{- else if .Values.global.nodeSelector }} +{{ toYaml .Values.global.nodeSelector | indent 8 }} +{{- end }} + affinity: +{{- if .Values.chromeDebug.affinity }} +{{ toYaml .Values.chromeDebug.affinity | indent 8 }} +{{- else if .Values.global.affinity }} +{{ toYaml .Values.global.affinity | indent 8 }} +{{- end }} + tolerations: +{{- if .Values.chromeDebug.tolerations }} +{{ toYaml .Values.chromeDebug.tolerations | indent 8 }} +{{- else if .Values.global.tolerations }} +{{ toYaml .Values.global.tolerations | indent 8 }} +{{- end }} +{{- end -}} diff --git a/charts/selenium/templates/firefox-daemonset.yaml b/charts/selenium/templates/firefox-daemonset.yaml new file mode 100644 index 0000000..5758ca4 --- /dev/null +++ b/charts/selenium/templates/firefox-daemonset.yaml @@ -0,0 +1,142 @@ +{{- if and (eq true .Values.firefox.enabled) (eq true .Values.firefox.runAsDaemonSet) -}} +apiVersion: {{ template "deployment.apiVersion" . }} +kind: DaemonSet +metadata: + name: {{ template "selenium.firefox.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + selector: + matchLabels: + app: {{ template "selenium.firefox.fullname" . }} + release: "{{ .Release.Name }}" + template: + metadata: + labels: + app: {{ template "selenium.firefox.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + {{- with .Values.firefox.podLabels }} + {{ toYaml .| indent 2 }} + {{- end }} + {{- if .Values.firefox.podAnnotations }} + annotations: +{{ toYaml .Values.firefox.podAnnotations | indent 8 }} + {{- end}} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.firefox.image }}:{{ .Values.firefox.tag }}" + imagePullPolicy: {{ .Values.firefox.pullPolicy }} + ports: + {{- if .Values.hub.jmxPort }} + - containerPort: {{ .Values.hub.jmxPort }} + name: jmx + protocol: TCP + {{- end }} + {{- if .Values.firefox.enableLivenessProbe }} + livenessProbe: + httpGet: + path: /wd/hub/status + port: {{ default "5555" .Values.firefox.nodePort }} + initialDelaySeconds: 30 + periodSeconds: 30 + failureThreshold: 1 + {{- end }} + {{- if .Values.firefox.waitForRunningSessions }} + lifecycle: + preStop: + exec: + command: + - /bin/bash + - -c + - "while [ $(wget -q -O - http://localhost:{{ default "5555" .Values.firefox.nodePort }}/wd/hub/sessions | grep -c capabilities) -gt 0 ]; do sleep 1; done" + {{- end }} + env: + - name: HUB_PORT_4444_TCP_ADDR + value: {{ template "selenium.hub.fullname" . }} + - name: HUB_PORT_4444_TCP_PORT + value: {{ .Values.hub.servicePort | quote }} + - name: JAVA_TOOL_OPTIONS + value: {{ default "" .Values.firefox.javaOpts | quote }} + - name: SE_OPTS + value: {{ default "" .Values.firefox.seOpts | quote }} + {{- if .Values.firefox.firefoxVersion }} + - name: FIREFOX_VERSION + value: {{ .Values.firefox.firefoxVersion | quote }} + {{- end }} + {{- if .Values.firefox.nodeMaxInstances }} + - name: NODE_MAX_INSTANCES + value: {{ .Values.firefox.nodeMaxInstances | quote }} + {{- end }} + {{- if .Values.firefox.nodeMaxSession }} + - name: NODE_MAX_SESSION + value: {{ .Values.firefox.nodeMaxSession | quote }} + {{- end }} + {{- if .Values.firefox.nodeRegisterCycle }} + - name: NODE_REGISTER_CYCLE + value: {{ .Values.firefox.nodeRegisterCycle | quote }} + {{- end }} + {{- if .Values.firefox.nodePort }} + - name: NODE_PORT + value: {{ .Values.firefox.nodePort | quote }} + {{- end }} + {{- if .Values.firefox.screenWidth }} + - name: SCREEN_WIDTH + value: {{ .Values.firefox.screenWidth | quote }} + {{- end }} + {{- if .Values.firefox.screenHeight }} + - name: SCREEN_HEIGHT + value: {{ .Values.firefox.screenHeight | quote }} + {{- end }} + {{- if .Values.firefox.screenDepth }} + - name: SCREEN_DEPTH + value: {{ .Values.firefox.screenDepth | quote }} + {{- end }} + {{- if .Values.firefox.display }} + - name: DISPLAY + value: {{ .Values.firefox.display | quote }} + {{- end }} + {{- if .Values.firefox.timeZone }} + - name: TZ + value: {{ .Values.firefox.timeZone | quote }} + {{- end }} + {{- if .Values.firefox.extraEnvs }} +{{ toYaml .Values.firefox.extraEnvs | indent 12 }} + {{- end }} + volumeMounts: +{{ if .Values.firefox.volumeMounts -}} +{{ toYaml .Values.firefox.volumeMounts | trim | indent 12 }} +{{- end }} + resources: +{{ toYaml .Values.firefox.resources | indent 12 }} +{{- if or .Values.global.imagePullSecrets .Values.firefox.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.firefox.imagePullSecrets | default .Values.global.imagePullSecrets | quote }} +{{- end }} + volumes: +{{ if .Values.firefox.volumes -}} +{{ toYaml .Values.firefox.volumes | trim | indent 8 }} +{{- end }} + hostAliases: +{{ toYaml .Values.global.hostAliases | indent 8 }} + nodeSelector: +{{- if .Values.firefox.nodeSelector }} +{{ toYaml .Values.firefox.nodeSelector | trim | indent 8 }} +{{- else if .Values.global.nodeSelector }} +{{ toYaml .Values.global.nodeSelector | trim | indent 8 }} +{{- end }} + affinity: +{{- if .Values.firefox.affinity }} +{{ toYaml .Values.firefox.affinity | trim | indent 8 }} +{{- else if .Values.global.affinity }} +{{ toYaml .Values.global.affinity | trim | indent 8 }} +{{- end }} + tolerations: +{{- if .Values.firefox.tolerations }} +{{ toYaml .Values.firefox.tolerations | trim | indent 8 }} +{{- else if .Values.global.tolerations }} +{{ toYaml .Values.global.tolerations | trim | indent 8 }} +{{- end }} +{{- end -}} diff --git a/charts/selenium/templates/firefox-deployment.yaml b/charts/selenium/templates/firefox-deployment.yaml new file mode 100644 index 0000000..13b27da --- /dev/null +++ b/charts/selenium/templates/firefox-deployment.yaml @@ -0,0 +1,147 @@ +{{- if and (eq true .Values.firefox.enabled) (eq false .Values.firefox.runAsDaemonSet) -}} +apiVersion: {{ template "deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "selenium.firefox.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + replicas: {{ .Values.firefox.replicas }} + selector: + matchLabels: + app: {{ template "selenium.firefox.fullname" . }} + release: "{{ .Release.Name }}" + template: + metadata: + labels: + app: {{ template "selenium.firefox.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + {{- with .Values.firefox.podLabels }} + {{ toYaml .| indent 2 }} + {{- end }} + {{- if .Values.firefox.podAnnotations }} + annotations: +{{ toYaml .Values.firefox.podAnnotations | indent 8 }} + {{- end}} + spec: + {{- if .Values.firefox.securityContext }} + securityContext: +{{ toYaml .Values.firefox.securityContext | indent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.firefox.image }}:{{ .Values.firefox.tag }}" + imagePullPolicy: {{ .Values.firefox.pullPolicy }} + ports: + {{- if .Values.hub.jmxPort }} + - containerPort: {{ .Values.hub.jmxPort }} + name: jmx + protocol: TCP + {{- end }} + {{- if .Values.firefox.enableLivenessProbe }} + livenessProbe: + httpGet: + path: /wd/hub/status + port: {{ default "5555" .Values.firefox.nodePort }} + initialDelaySeconds: 30 + periodSeconds: 30 + failureThreshold: 1 + {{- end }} + {{- if .Values.firefox.waitForRunningSessions }} + lifecycle: + preStop: + exec: + command: + - /bin/bash + - -c + - "while [ $(wget -q -O - http://localhost:{{ default "5555" .Values.firefox.nodePort }}/wd/hub/sessions | grep -c capabilities) -gt 0 ]; do sleep 1; done" + {{- end }} + env: + - name: HUB_PORT_4444_TCP_ADDR + value: {{ template "selenium.hub.fullname" . }} + - name: HUB_PORT_4444_TCP_PORT + value: {{ .Values.hub.servicePort | quote }} + - name: JAVA_TOOL_OPTIONS + value: {{ default "" .Values.firefox.javaOpts | quote }} + - name: SE_OPTS + value: {{ default "" .Values.firefox.seOpts | quote }} + {{- if .Values.firefox.firefoxVersion }} + - name: FIREFOX_VERSION + value: {{ .Values.firefox.firefoxVersion | quote }} + {{- end }} + {{- if .Values.firefox.nodeMaxInstances }} + - name: NODE_MAX_INSTANCES + value: {{ .Values.firefox.nodeMaxInstances | quote }} + {{- end }} + {{- if .Values.firefox.nodeMaxSession }} + - name: NODE_MAX_SESSION + value: {{ .Values.firefox.nodeMaxSession | quote }} + {{- end }} + {{- if .Values.firefox.nodeRegisterCycle }} + - name: NODE_REGISTER_CYCLE + value: {{ .Values.firefox.nodeRegisterCycle | quote }} + {{- end }} + {{- if .Values.firefox.nodePort }} + - name: NODE_PORT + value: {{ .Values.firefox.nodePort | quote }} + {{- end }} + {{- if .Values.firefox.screenWidth }} + - name: SCREEN_WIDTH + value: {{ .Values.firefox.screenWidth | quote }} + {{- end }} + {{- if .Values.firefox.screenHeight }} + - name: SCREEN_HEIGHT + value: {{ .Values.firefox.screenHeight | quote }} + {{- end }} + {{- if .Values.firefox.screenDepth }} + - name: SCREEN_DEPTH + value: {{ .Values.firefox.screenDepth | quote }} + {{- end }} + {{- if .Values.firefox.display }} + - name: DISPLAY + value: {{ .Values.firefox.display | quote }} + {{- end }} + {{- if .Values.firefox.timeZone }} + - name: TZ + value: {{ .Values.firefox.timeZone | quote }} + {{- end }} + {{- if .Values.firefox.extraEnvs }} +{{ toYaml .Values.firefox.extraEnvs | indent 12 }} + {{- end }} + volumeMounts: +{{ if .Values.firefox.volumeMounts -}} +{{ toYaml .Values.firefox.volumeMounts | trim | indent 12 }} +{{- end }} + resources: +{{ toYaml .Values.firefox.resources | indent 12 }} +{{- if or .Values.global.imagePullSecrets .Values.firefox.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.firefox.imagePullSecrets | default .Values.global.imagePullSecrets | quote }} +{{- end }} + volumes: +{{ if .Values.firefox.volumes -}} +{{ toYaml .Values.firefox.volumes | trim | indent 8 }} +{{- end }} + hostAliases: +{{ toYaml .Values.global.hostAliases | indent 8 }} + nodeSelector: +{{- if .Values.firefox.nodeSelector }} +{{ toYaml .Values.firefox.nodeSelector | trim | indent 8 }} +{{- else if .Values.global.nodeSelector }} +{{ toYaml .Values.global.nodeSelector | trim | indent 8 }} +{{- end }} + affinity: +{{- if .Values.firefox.affinity }} +{{ toYaml .Values.firefox.affinity | trim | indent 8 }} +{{- else if .Values.global.affinity }} +{{ toYaml .Values.global.affinity | trim | indent 8 }} +{{- end }} + tolerations: +{{- if .Values.firefox.tolerations }} +{{ toYaml .Values.firefox.tolerations | trim | indent 8 }} +{{- else if .Values.global.tolerations }} +{{ toYaml .Values.global.tolerations | trim | indent 8 }} +{{- end }} +{{- end -}} diff --git a/charts/selenium/templates/firefoxDebug-daemonset.yaml b/charts/selenium/templates/firefoxDebug-daemonset.yaml new file mode 100644 index 0000000..e9a7bf0 --- /dev/null +++ b/charts/selenium/templates/firefoxDebug-daemonset.yaml @@ -0,0 +1,145 @@ +{{- if and (eq true .Values.firefoxDebug.enabled) (eq true .Values.firefoxDebug.runAsDaemonSet) -}} +apiVersion: {{ template "deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "selenium.firefoxDebug.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + replicas: {{ .Values.firefoxDebug.replicas }} + selector: + matchLabels: + app: {{ template "selenium.firefoxDebug.fullname" . }} + release: "{{ .Release.Name }}" + template: + metadata: + labels: + app: {{ template "selenium.firefoxDebug.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + {{- with .Values.firefoxDebug.podLabels }} + {{ toYaml .| indent 2 }} + {{- end }} + {{- if .Values.firefoxDebug.podAnnotations }} + annotations: +{{ toYaml .Values.firefoxDebug.podAnnotations | indent 8 }} + {{- end}} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.firefoxDebug.image }}:{{ .Values.firefoxDebug.tag }}" + imagePullPolicy: {{ .Values.firefoxDebug.pullPolicy }} + ports: + {{- if .Values.firefoxDebug.jmxPort }} + - containerPort: {{ .Values.firefoxDebug.jmxPort }} + name: jmx + protocol: TCP + {{- end }} + - containerPort: 5900 + name: vnc + {{- if .Values.firefoxDebug.enableLivenessProbe }} + livenessProbe: + httpGet: + path: /wd/hub/status + port: {{ default "5555" .Values.firefoxDebug.nodePort }} + initialDelaySeconds: 30 + periodSeconds: 30 + failureThreshold: 1 + {{- end }} + {{- if .Values.firefoxDebug.waitForRunningSessions }} + lifecycle: + preStop: + exec: + command: + - /bin/bash + - -c + - "while [ $(wget -q -O - http://localhost:{{ default "5555" .Values.firefoxDebug.nodePort }}/wd/hub/sessions | grep -c capabilities) -gt 0 ]; do sleep 1; done" + {{- end }} + env: + - name: HUB_PORT_4444_TCP_ADDR + value: {{ template "selenium.hub.fullname" . }} + - name: HUB_PORT_4444_TCP_PORT + value: {{ .Values.hub.servicePort | quote }} + - name: JAVA_TOOL_OPTIONS + value: {{ default "" .Values.firefoxDebug.javaOpts | quote }} + - name: SE_OPTS + value: {{ default "" .Values.firefoxDebug.seOpts | quote }} + {{- if .Values.firefoxDebug.firefoxVersion }} + - name: FIREFOX_VERSION + value: {{ .Values.firefoxDebug.firefoxVersion | quote }} + {{- end }} + {{- if .Values.firefoxDebug.nodeMaxInstances }} + - name: NODE_MAX_INSTANCES + value: {{ .Values.firefoxDebug.nodeMaxInstances | quote }} + {{- end }} + {{- if .Values.firefoxDebug.nodeMaxSession }} + - name: NODE_MAX_SESSION + value: {{ .Values.firefoxDebug.nodeMaxSession | quote }} + {{- end }} + {{- if .Values.firefoxDebug.nodeRegisterCycle }} + - name: NODE_REGISTER_CYCLE + value: {{ .Values.firefoxDebug.nodeRegisterCycle | quote }} + {{- end }} + {{- if .Values.firefoxDebug.nodePort }} + - name: NODE_PORT + value: {{ .Values.firefoxDebug.nodePort | quote }} + {{- end }} + {{- if .Values.firefoxDebug.screenWidth }} + - name: SCREEN_WIDTH + value: {{ .Values.firefoxDebug.screenWidth | quote }} + {{- end }} + {{- if .Values.firefoxDebug.screenHeight }} + - name: SCREEN_HEIGHT + value: {{ .Values.firefoxDebug.screenHeight | quote }} + {{- end }} + {{- if .Values.firefoxDebug.screenDepth }} + - name: SCREEN_DEPTH + value: {{ .Values.firefoxDebug.screenDepth | quote }} + {{- end }} + {{- if .Values.firefoxDebug.display }} + - name: DISPLAY + value: {{ .Values.firefoxDebug.display | quote }} + {{- end }} + {{- if .Values.firefoxDebug.timeZone }} + - name: TZ + value: {{ .Values.firefoxDebug.timeZone | quote }} + {{- end }} + {{- if .Values.firefoxDebug.extraEnvs }} +{{ toYaml .Values.firefoxDebug.extraEnvs | indent 12 }} + {{- end }} + volumeMounts: +{{ if .Values.firefoxDebug.volumeMounts -}} +{{ toYaml .Values.firefoxDebug.volumeMounts | indent 12 }} +{{- end }} + resources: +{{ toYaml .Values.firefoxDebug.resources | indent 12 }} +{{- if or .Values.global.imagePullSecrets .Values.firefoxDebug.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.firefoxDebug.imagePullSecrets | default .Values.global.imagePullSecrets | quote }} +{{- end }} + volumes: +{{ if .Values.firefoxDebug.volumes -}} +{{ toYaml .Values.firefoxDebug.volumes | indent 8 }} +{{- end }} + hostAliases: +{{ toYaml .Values.global.hostAliases | indent 8 }} + nodeSelector: +{{- if .Values.firefoxDebug.nodeSelector }} +{{ toYaml .Values.firefoxDebug.nodeSelector | indent 8 }} +{{- else if .Values.global.nodeSelector }} +{{ toYaml .Values.global.nodeSelector | indent 8 }} +{{- end }} + affinity: +{{- if .Values.firefoxDebug.affinity }} +{{ toYaml .Values.firefoxDebug.affinity | indent 8 }} +{{- else if .Values.global.affinity }} +{{ toYaml .Values.global.affinity | indent 8 }} +{{- end }} + tolerations: +{{- if .Values.firefoxDebug.tolerations }} +{{ toYaml .Values.firefoxDebug.tolerations | indent 8 }} +{{- else if .Values.global.tolerations }} +{{ toYaml .Values.global.tolerations | indent 8 }} +{{- end }} +{{- end -}} diff --git a/charts/selenium/templates/firefoxDebug-deployment.yaml b/charts/selenium/templates/firefoxDebug-deployment.yaml new file mode 100644 index 0000000..77975ae --- /dev/null +++ b/charts/selenium/templates/firefoxDebug-deployment.yaml @@ -0,0 +1,149 @@ +{{- if and (eq true .Values.firefoxDebug.enabled) (eq false .Values.firefoxDebug.runAsDaemonSet) -}} +apiVersion: {{ template "deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "selenium.firefoxDebug.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + replicas: {{ .Values.firefoxDebug.replicas }} + selector: + matchLabels: + app: {{ template "selenium.firefoxDebug.fullname" . }} + release: "{{ .Release.Name }}" + template: + metadata: + labels: + app: {{ template "selenium.firefoxDebug.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + {{- with .Values.firefoxDebug.podLabels }} + {{ toYaml .| indent 2 }} + {{- end }} + {{- if .Values.firefoxDebug.podAnnotations }} + annotations: +{{ toYaml .Values.firefoxDebug.podAnnotations | indent 8 }} + {{- end}} + spec: + {{- if .Values.firefoxDebug.securityContext }} + securityContext: +{{ toYaml .Values.firefoxDebug.securityContext | indent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.firefoxDebug.image }}:{{ .Values.firefoxDebug.tag }}" + imagePullPolicy: {{ .Values.firefoxDebug.pullPolicy }} + ports: + {{- if .Values.firefoxDebug.jmxPort }} + - containerPort: {{ .Values.firefoxDebug.jmxPort }} + name: jmx + protocol: TCP + {{- end }} + - containerPort: 5900 + name: vnc + {{- if .Values.firefoxDebug.enableLivenessProbe }} + livenessProbe: + httpGet: + path: /wd/hub/status + port: {{ default "5555" .Values.firefoxDebug.nodePort }} + initialDelaySeconds: 30 + periodSeconds: 30 + failureThreshold: 1 + {{- end }} + {{- if .Values.firefoxDebug.waitForRunningSessions }} + lifecycle: + preStop: + exec: + command: + - /bin/bash + - -c + - "while [ $(wget -q -O - http://localhost:{{ default "5555" .Values.firefoxDebug.nodePort }}/wd/hub/sessions | grep -c capabilities) -gt 0 ]; do sleep 1; done" + {{- end }} + env: + - name: HUB_PORT_4444_TCP_ADDR + value: {{ template "selenium.hub.fullname" . }} + - name: HUB_PORT_4444_TCP_PORT + value: {{ .Values.hub.servicePort | quote }} + - name: JAVA_TOOL_OPTIONS + value: {{ default "" .Values.firefoxDebug.javaOpts | quote }} + - name: SE_OPTS + value: {{ default "" .Values.firefoxDebug.seOpts | quote }} + {{- if .Values.firefoxDebug.firefoxVersion }} + - name: FIREFOX_VERSION + value: {{ .Values.firefoxDebug.firefoxVersion | quote }} + {{- end }} + {{- if .Values.firefoxDebug.nodeMaxInstances }} + - name: NODE_MAX_INSTANCES + value: {{ .Values.firefoxDebug.nodeMaxInstances | quote }} + {{- end }} + {{- if .Values.firefoxDebug.nodeMaxSession }} + - name: NODE_MAX_SESSION + value: {{ .Values.firefoxDebug.nodeMaxSession | quote }} + {{- end }} + {{- if .Values.firefoxDebug.nodeRegisterCycle }} + - name: NODE_REGISTER_CYCLE + value: {{ .Values.firefoxDebug.nodeRegisterCycle | quote }} + {{- end }} + {{- if .Values.firefoxDebug.nodePort }} + - name: NODE_PORT + value: {{ .Values.firefoxDebug.nodePort | quote }} + {{- end }} + {{- if .Values.firefoxDebug.screenWidth }} + - name: SCREEN_WIDTH + value: {{ .Values.firefoxDebug.screenWidth | quote }} + {{- end }} + {{- if .Values.firefoxDebug.screenHeight }} + - name: SCREEN_HEIGHT + value: {{ .Values.firefoxDebug.screenHeight | quote }} + {{- end }} + {{- if .Values.firefoxDebug.screenDepth }} + - name: SCREEN_DEPTH + value: {{ .Values.firefoxDebug.screenDepth | quote }} + {{- end }} + {{- if .Values.firefoxDebug.display }} + - name: DISPLAY + value: {{ .Values.firefoxDebug.display | quote }} + {{- end }} + {{- if .Values.firefoxDebug.timeZone }} + - name: TZ + value: {{ .Values.firefoxDebug.timeZone | quote }} + {{- end }} + {{- if .Values.firefoxDebug.extraEnvs }} +{{ toYaml .Values.firefoxDebug.extraEnvs | indent 12 }} + {{- end }} + volumeMounts: +{{ if .Values.firefoxDebug.volumeMounts -}} +{{ toYaml .Values.firefoxDebug.volumeMounts | indent 12 }} +{{- end }} + resources: +{{ toYaml .Values.firefoxDebug.resources | indent 12 }} +{{- if or .Values.global.imagePullSecrets .Values.firefoxDebug.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.firefoxDebug.imagePullSecrets | default .Values.global.imagePullSecrets | quote }} +{{- end }} + volumes: +{{ if .Values.firefoxDebug.volumes -}} +{{ toYaml .Values.firefoxDebug.volumes | indent 8 }} +{{- end }} + hostAliases: +{{ toYaml .Values.global.hostAliases | indent 8 }} + nodeSelector: +{{- if .Values.firefoxDebug.nodeSelector }} +{{ toYaml .Values.firefoxDebug.nodeSelector | indent 8 }} +{{- else if .Values.global.nodeSelector }} +{{ toYaml .Values.global.nodeSelector | indent 8 }} +{{- end }} + affinity: +{{- if .Values.firefoxDebug.affinity }} +{{ toYaml .Values.firefoxDebug.affinity | indent 8 }} +{{- else if .Values.global.affinity }} +{{ toYaml .Values.global.affinity | indent 8 }} +{{- end }} + tolerations: +{{- if .Values.firefoxDebug.tolerations }} +{{ toYaml .Values.firefoxDebug.tolerations | indent 8 }} +{{- else if .Values.global.tolerations }} +{{ toYaml .Values.global.tolerations | indent 8 }} +{{- end }} +{{- end -}} diff --git a/charts/selenium/templates/hub-deployment.yaml b/charts/selenium/templates/hub-deployment.yaml new file mode 100644 index 0000000..a0a1e44 --- /dev/null +++ b/charts/selenium/templates/hub-deployment.yaml @@ -0,0 +1,128 @@ +apiVersion: {{ template "deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "selenium.hub.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + replicas: 1 + selector: + matchLabels: + app: {{ template "selenium.hub.fullname" . }} + release: "{{ .Release.Name }}" + template: + metadata: + labels: + app: {{ template "selenium.hub.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + {{- with .Values.hub.podLabels }} + {{ toYaml .| indent 2 }} + {{- end }} + {{- if .Values.hub.podAnnotations }} + annotations: +{{ toYaml .Values.hub.podAnnotations | indent 8 }} + {{- end}} + spec: + {{- if .Values.hub.securityContext }} + securityContext: +{{ toYaml .Values.hub.securityContext | indent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.hub.image }}:{{ .Values.hub.tag }}" + imagePullPolicy: {{ .Values.hub.pullPolicy }} + ports: + {{- if .Values.hub.jmxPort }} + - containerPort: {{ .Values.hub.jmxPort }} + name: jmx + protocol: TCP + {{- end }} + - containerPort: {{ .Values.hub.port }} + name: http + livenessProbe: + httpGet: + path: {{ .Values.hub.probePath }} + port: {{ .Values.hub.port }} + initialDelaySeconds: 30 + periodSeconds: 5 + timeoutSeconds: {{ .Values.hub.livenessTimeout }} + readinessProbe: + httpGet: + path: {{ .Values.hub.probePath }} + port: {{ .Values.hub.port }} + initialDelaySeconds: {{ .Values.hub.readinessDelay }} + timeoutSeconds: {{ .Values.hub.readinessTimeout }} + env: + - name: JAVA_TOOL_OPTIONS + value: {{ default "" .Values.hub.javaOpts | quote }} + - name: SE_OPTS + value: {{ default "" .Values.hub.seOpts | quote }} + {{- if .Values.hub.gridNewSessionWaitTimeout }} + - name: GRID_NEW_SESSION_WAIT_TIMEOUT + value: {{ .Values.hub.gridNewSessionWaitTimeout | quote }} + {{- end }} + {{- if .Values.hub.gridJettyMaxThreads }} + - name: GRID_JETTY_MAX_THREADS + value: {{ .Values.hub.gridJettyMaxThreads | quote }} + {{- end }} + {{- if .Values.hub.gridNodePolling }} + - name: GRID_NODE_POLLING + value: {{ .Values.hub.gridNodePolling | quote }} + {{- end }} + {{- if .Values.hub.gridCleanUpCycle }} + - name: GRID_CLEAN_UP_CYCLE + value: {{ .Values.hub.gridCleanUpCycle | quote }} + {{- end }} + {{- if .Values.hub.gridTimeout }} + - name: GRID_TIMEOUT + value: {{ .Values.hub.gridTimeout | quote }} + {{- end }} + {{- if .Values.hub.gridBrowserTimeout }} + - name: GRID_BROWSER_TIMEOUT + value: {{ .Values.hub.gridBrowserTimeout | quote }} + {{- end }} + {{- if .Values.hub.gridMaxSession }} + - name: GRID_MAX_SESSION + value: {{ .Values.hub.gridMaxSession | quote }} + {{- end }} + {{- if .Values.hub.gridUnregisterIfStillDownAfter }} + - name: GRID_UNREGISTER_IF_STILL_DOWN_AFTER + value: {{ .Values.hub.gridUnregisterIfStillDownAfter | quote }} + {{- end }} + {{- if .Values.hub.timeZone }} + - name: TZ + value: {{ .Values.hub.timeZone | quote }} + {{- end }} + {{- if .Values.hub.port }} + - name: GRID_HUB_PORT + value: {{ .Values.hub.port | quote }} + {{- end }} + {{- if .Values.hub.extraEnvs }} +{{ toYaml .Values.hub.extraEnvs | indent 12 }} + {{- end }} + resources: +{{ toYaml .Values.hub.resources | trim | indent 12 -}} +{{- if or .Values.global.imagePullSecrets .Values.hub.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.hub.imagePullSecrets | default .Values.global.imagePullSecrets | quote }} +{{- end }} + nodeSelector: +{{- if .Values.hub.nodeSelector }} +{{ toYaml .Values.hub.nodeSelector | trim | indent 8 }} +{{- else if .Values.global.nodeSelector }} +{{ toYaml .Values.global.nodeSelector | trim | indent 8 }} +{{- end }} + affinity: +{{- if .Values.hub.affinity }} +{{ toYaml .Values.hub.affinity | indent 8 }} +{{- else if .Values.global.affinity }} +{{ toYaml .Values.global.affinity | indent 8 }} +{{- end }} + tolerations: +{{- if .Values.hub.tolerations }} +{{ toYaml .Values.hub.tolerations | indent 8 }} +{{- else if .Values.global.tolerations }} +{{ toYaml .Values.global.tolerations | indent 8 }} +{{- end }} diff --git a/charts/selenium/templates/hub-service.yaml b/charts/selenium/templates/hub-service.yaml new file mode 100644 index 0000000..f6014d1 --- /dev/null +++ b/charts/selenium/templates/hub-service.yaml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "selenium.hub.fullname" . }} + labels: + app: {{ template "selenium.hub.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- if .Values.hub.serviceAnnotations }} + annotations: +{{ toYaml .Values.hub.serviceAnnotations | indent 4 }} +{{- end }} +spec: + type: {{ .Values.hub.serviceType | quote }} + {{- if .Values.hub.serviceLoadBalancerIP }} + loadBalancerIP: {{ .Values.hub.serviceLoadBalancerIP | quote }} + {{- end }} +{{- if .Values.hub.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml .Values.hub.loadBalancerSourceRanges | indent 4 }} +{{- end }} + sessionAffinity: {{ .Values.hub.serviceSessionAffinity | quote }} + ports: + - name: hub + port: {{ .Values.hub.servicePort }} + targetPort: {{ .Values.hub.port }} + {{- if and ( eq .Values.hub.serviceType "NodePort") .Values.hub.nodePort }} + nodePort: {{ .Values.hub.nodePort }} + {{- end }} + selector: + app: {{ template "selenium.hub.fullname" . }} diff --git a/charts/selenium/templates/ingress.yaml b/charts/selenium/templates/ingress.yaml new file mode 100644 index 0000000..1b6aafd --- /dev/null +++ b/charts/selenium/templates/ingress.yaml @@ -0,0 +1,52 @@ +{{- if .Values.hub.ingress.enabled -}} +{{- $fullName := include "selenium.hub.fullname" . -}} +{{- $ingressPath := .Values.hub.ingress.path -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.hub.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.hub.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.hub.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app: {{ template "selenium.hub.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- with .Values.hub.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.hub.ingress.tls }} + tls: + {{- range .Values.hub.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.hub.ingress.hosts }} + - host: {{ . | quote }} + http: + paths: + - path: {{ $ingressPath }} + backend: + service: + name: {{ $fullName }} + port: + name: hub + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/selenium/values.yaml b/charts/selenium/values.yaml new file mode 100644 index 0000000..9c5ecc5 --- /dev/null +++ b/charts/selenium/values.yaml @@ -0,0 +1,569 @@ +global: + ## NodeSelector to be used in every deployment + ## hub, chrome, firefox, chromeDebug and firefoxDebug + ## can also be specified at chart level see below + nodeSelector: + # label: value + ## Configure HostAliases + hostAliases: [] + affinity: + # label: value + tolerations: + # label: value + ## imagePullSecrets is the secret to use to pull the image from in case of a private flavour image + ## to be used in every deployment hub, chrome, firefox, chromeDebug and firefoxDebug + ## can also be specified at chart level see below. + ## Specifying secret at a chart level will override the global option + imagePullSecrets: + +hub: + ## The repository and image + ## ref: https://hub.docker.com/r/selenium/hub/ + image: "selenium/hub" + + ## The tag for the image + ## ref: https://hub.docker.com/r/selenium/hub/tags/ + tag: "3.141.59" + + ## imagePullSecrets is the secret to use to pull the image from in case of a private flavour image + # imagePullSecrets: "regcred" + + ## Specify an imagePullPolicy + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + pullPolicy: "IfNotPresent" + + ## The port which the hub listens on + port: 4444 + + ## The port the service listens on + servicePort: 4444 + + ## nodePort - The node port the service exposed on + # nodePort: 30044 + + ## Timeout for probe Hub readiness via HTTP request on hub.probePath + readinessTimeout: 1 + + ## Initial delay before performing the first readinessProbe + readinessDelay: 15 + + ## Timeout for probe Hub liveness via HTTP request on hub.probePath + livenessTimeout: 1 + + ## Path for checking readiness and liveness via HTTP Request + probePath: "/wd/hub/status" + + # Configure security context on the hub pod + # securityContext: + # fsGroup: 1000 + # runAsUser: 1000 + + ## Additional environment variables to set + extraEnvs: [] + # extraEnvs: + # - name: FOO + # valueFrom: + # secretKeyRef: + # key: FOO + # name: secret-resource + + ## Set the JAVA_TOOL_OPTIONS environment variable + ## If you find your selenium hub is OOMKilled, try adding -XX:+UseSerialGC + javaOpts: "-Xmx400m" + + ## Set the SE_OPTS environment variable + ## ref: http://www.seleniumhq.org/docs/07_selenium_grid.jsp#node-configuration + # seOpts: + + ## Defining a JMX port will open the port on the container, however, it + ## requires additional javaOpts, ie + ## javaOpts: > + ## -Dcom.sun.management.jmxremote.port=4000 + ## -Dcom.sun.management.jmxremote.authenticate=false + ## -Dcom.sun.management.jmxremote.ssl=false + ## ref: http://openjdk.java.net/groups/jmx/ + # jmxPort: 4000 + + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + resources: + limits: + cpu: ".5" + memory: "512Mi" + + ## Configure annotations on the hub pod + podAnnotations: {} + ## Configure labels on the hub pod + podLabels: {} + + ## The type of service to create + ## Values: ClusterIP, NodePort, LoadBalancer, or ExternalName + ## ref: https://kubernetes.io/docs/user-guide/services/ + serviceType: "LoadBalancer" + + ## The LoadBalancer IP Address + ## ref: https://kubernetes.io/docs/user-guide/services/ + ## serviceLoadBalancerIP: "40.121.183.52" + loadBalancerSourceRanges: [] + + ## Control where client requests go, to the same pod or round-robin + ## Values: ClientIP or None + ## ref: https://kubernetes.io/docs/user-guide/services/ + serviceSessionAffinity: "None" + + ## Define various attributes of the service + # serviceAnnotations: + # # internal AWS ELB + # service.beta.kubernetes.io/aws-load-balancer-internal: "0.0.0.0/0" + + ## ref: https://github.com/SeleniumHQ/selenium/wiki/Grid2#configuring-the-nodes + ## In milliseconds + # gridNewSessionWaitTimeout: -1 + # gridJettyMaxThreads: -1 + ## In milliseconds + # gridNodePolling: 5000 + ## In milliseconds + # gridCleanUpCycle: 5000 + ## In seconds + # gridTimeout: 30 + ## In seconds + # gridBrowserTimeout: 0 + # gridMaxSession: 5 + ## In milliseconds + # gridUnregisterIfStillDownAfter: 30000 + # timeZone: UTC + + ## NodeSelector to be used for the hub + nodeSelector: + # label: value + ingress: + enabled: false + # className: 'nginx' + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: + - selenium-hub.local + tls: [] + # - secretName: selenium-hub-tls + # hosts: + # - selenium-hub.local + + +chrome: + ## Enable the creation of a node-chrome pod + enabled: false + + ## DaemonSet instead of Deployment + runAsDaemonSet: false + + ## The repository and image + ## ref: https://hub.docker.com/r/selenium/node-chrome/ + image: "selenium/node-chrome" + + ## The tag for the image + ## ref: https://hub.docker.com/r/selenium/node-chrome/tags/ + tag: "3.141.59" + + ## imagePullSecrets is the secret to use to pull the image from in case of a private flavour image + # imagePullSecrets: "regcred" + + ## Specify an imagePullPolicy + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + pullPolicy: "IfNotPresent" + + ## The number of pods in the deployment. This is ignored if runAsDaemonSet is enabled. + replicas: 1 + + ## When true will add a liveness check to the pod + enableLivenessProbe: false + + ## When true will wait for current running sessions to finish before terminating the pod + waitForRunningSessions: false + + ## Configure annotations on the chrome pods + podAnnotations: {} + ## Configure Labels on the chrome pods + podLabels: {} + + # Configure security context on the chrome pods + # securityContext: + # fsGroup: 1000 + # runAsUser: 1000 + + ## Additional environment variables to set + extraEnvs: [] + # extraEnvs: + # - name: FOO + # valueFrom: + # secretKeyRef: + # key: FOO + # name: secret-resource + + ## Set the JAVA_TOOL_OPTIONS environment variable + ## If you find your selenium node is OOMKilled, try adding -XX:+UseSerialGC + javaOpts: "-Xmx900m" + + ## Set the SE_OPTS environment variable + ## ref: http://www.seleniumhq.org/docs/07_selenium_grid.jsp#node-configuration + # seOpts: + + ## Defining a JMX port will open the port on the container, however, it + ## requires additional javaOpts, ie + ## javaOpts: > + ## -Dcom.sun.management.jmxremote.port=4000 + ## -Dcom.sun.management.jmxremote.authenticate=false + ## -Dcom.sun.management.jmxremote.ssl=false + ## ref: http://openjdk.java.net/groups/jmx/ + # jmxPort: 4000 + + ## User defined volumes + ## ref: https://kubernetes.io/docs/user-guide/volumes/ + volumes: + ## https://github.com/kubernetes/kubernetes/pull/34928#issuecomment-277952723 + ## http://stackoverflow.com/questions/39852716/chrome-driver-throwing-org-openqa-selenium-remote-sessionnotfoundexception-whe + ## Chrome wants more than 64mb of shared memory. Docker/k8s default to 64mb. + - name: dshm + emptyDir: + medium: Memory + volumeMounts: + - mountPath: /dev/shm + name: dshm + + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + resources: + limits: + cpu: ".5" + memory: "1000Mi" + + ## Characteristics of the browser window + # screenWidth: 1280 + # screenHeight: 1024 + # screenDepth: 24 + # display: :10 + + ## Selenium node options + # chromeVersion: + # nodeMaxInstances: 1 + # nodeMaxSession: 1 + ## In milliseconds + # nodeRegisterCycle: 5000 + # nodePort: 5555 + # timeZone: UTC + + ## NodeSelector to be used for chrome + nodeSelector: + # label: value + + +chromeDebug: + ## Enable the creation of a node-chrome-debug pod + enabled: false + + ## DaemonSet instead of Deployment + runAsDaemonSet: false + + ## The repository and image + ## ref: https://hub.docker.com/r/selenium/node-chrome-debug/ + image: "selenium/node-chrome-debug" + + ## The tag for the image + ## ref: https://hub.docker.com/r/selenium/node-chrome-debug/tags/ + tag: "3.141.59" + + ## imagePullSecrets is the secret to use to pull the image from in case of a private flavour image + # imagePullSecrets: "regcred" + + ## Specify an imagePullPolicy + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + pullPolicy: "IfNotPresent" + + ## The number of pods in the deployment. This is ignored if runAsDaemonSet is enabled. + replicas: 1 + + ## When true will add a liveness check to the pod + enableLivenessProbe: false + + ## When true will wait for current running sessions to finish before terminating the pod + waitForRunningSessions: false + + ## Configure annotations on the chrome debug pods + podAnnotations: {} + ## Configure labels on the chrome debug pods + podLabels: {} + + # Configure security context on the chrome debug pods + # securityContext: + # fsGroup: 1000 + # runAsUser: 1000 + + ## Additional environment variables to set + extraEnvs: [] + # extraEnvs: + # - name: FOO + # valueFrom: + # secretKeyRef: + # key: FOO + # name: secret-resource + + ## Set the JAVA_TOOL_OPTIONS environment variable + ## If you find your selenium hub is OOMKilled, try adding -XX:+UseSerialGC + javaOpts: "-Xmx900m" + + ## Set the SE_OPTS environment variable + ## ref: http://www.seleniumhq.org/docs/07_selenium_grid.jsp#node-configuration + # seOpts: + + ## Defining a JMX port will open the port on the container, however, it + ## requires additional javaOpts, ie + ## javaOpts: > + ## -Dcom.sun.management.jmxremote.port=4000 + ## -Dcom.sun.management.jmxremote.authenticate=false + ## -Dcom.sun.management.jmxremote.ssl=false + ## ref: http://openjdk.java.net/groups/jmx/ + # jmxPort: 4000 + + ## User defined volumes + ## ref: https://kubernetes.io/docs/user-guide/volumes/ + volumes: + ## https://github.com/kubernetes/kubernetes/pull/34928#issuecomment-277952723 + ## http://stackoverflow.com/questions/39852716/chrome-driver-throwing-org-openqa-selenium-remote-sessionnotfoundexception-whe + ## Chrome wants more than 64mb of shared memory. Docker/k8s default to 64mb. + - name: dshm + emptyDir: + medium: Memory + volumeMounts: + - mountPath: /dev/shm + name: dshm + + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + resources: + limits: + cpu: ".5" + memory: "1500Mi" + + ## Characteristics of the browser window + # screenWidth: 1280 + # screenHeight: 1024 + # screenDepth: 24 + # display: :10 + + ## Selenium node options + # chromeVersion: + # nodeMaxInstances: 1 + # nodeMaxSession: 1 + ## In milliseconds + # nodeRegisterCycle: 5000 + # nodePort: 5555 + # timeZone: UTC + + ## NodeSelector to be used for chromeDebug + nodeSelector: + # label: value + +firefox: + ## Enable the creation of a node-firefox pod + enabled: false + + ## DaemonSet instead of Deployment + runAsDaemonSet: false + + ## The repository and image + ## ref: https://hub.docker.com/r/selenium/node-firefox/ + image: "selenium/node-firefox" + + ## The tag for the image + ## ref: https://hub.docker.com/r/selenium/node-firefox/tags/ + tag: "3.141.59" + + ## imagePullSecrets is the secret to use to pull the image from in case of a private flavour image + # imagePullSecrets: "regcred" + + ## Specify an imagePullPolicy + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + pullPolicy: "IfNotPresent" + + ## The number of pods in the deployment. This is ignored if runAsDaemonSet is enabled. + replicas: 1 + + ## When true will add a liveness check to the pod + enableLivenessProbe: false + + ## When true will wait for current running sessions to finish before terminating the pod + waitForRunningSessions: false + + ## Configure annotations on the firefox pods + podAnnotations: {} + ## Configure labels on the firefox pods + podLabels: {} + + # Configure security context on the firefox pods + # securityContext: + # fsGroup: 1000 + # runAsUser: 1000 + + ## Additional environment variables to set + extraEnvs: [] + # extraEnvs: + # - name: FOO + # valueFrom: + # secretKeyRef: + # key: FOO + # name: secret-resource + + ## Set the JAVA_TOOL_OPTIONS environment variable + ## If you find your selenium hub is OOMKilled, try adding -XX:+UseSerialGC + javaOpts: "-Xmx900m" + + ## Set the SE_OPTS environment variable + ## ref: http://www.seleniumhq.org/docs/07_selenium_grid.jsp#node-configuration + # seOpts: + + ## Defining a JMX port will open the port on the container, however, it + ## requires additional javaOpts, ie + ## javaOpts: > + ## -Dcom.sun.management.jmxremote.port=4000 + ## -Dcom.sun.management.jmxremote.authenticate=false + ## -Dcom.sun.management.jmxremote.ssl=false + ## ref: http://openjdk.java.net/groups/jmx/ + # jmxPort: 4000 + + volumes: + ## https://docs.openshift.com/container-platform/3.6/dev_guide/shared_memory.html + - name: dshm + emptyDir: + medium: Memory + volumeMounts: + - mountPath: /dev/shm + name: dshm + + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + resources: + limits: + cpu: ".5" + memory: "1000Mi" + + ## Characteristics of the browser window + # screenWidth: 1280 + # screenHeight: 1024 + # screenDepth: 24 + # display: :10 + + ## Selenium node options + # firefoxVersion: + # nodeMaxInstances: 1 + # nodeMaxSession: 1 + ## In milliseconds + # nodeRegisterCycle: 5000 + # nodePort: 5555 + # timeZone: UTC + + ## NodeSelector to be used for firefox + nodeSelector: + # label: value + +firefoxDebug: + ## Enable the creation of a node-firefox-debug pod + enabled: false + + ## DaemonSet instead of Deployment + runAsDaemonSet: false + + ## The repository and image + ## ref: https://hub.docker.com/r/selenium/node-firefox-debug/ + image: "selenium/node-firefox-debug" + + ## The tag for the image + ## ref: https://hub.docker.com/r/selenium/node-firefox-debug/tags/ + tag: "3.141.59" + + ## imagePullSecrets is the secret to use to pull the image from in case of a private flavour image + # imagePullSecrets: "regcred" + + ## Specify an imagePullPolicy + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + pullPolicy: "IfNotPresent" + + ## The number of pods in the deployment. This is ignored if runAsDaemonSet is enabled. + replicas: 1 + + ## When true will add a liveness check to the pod + enableLivenessProbe: false + + ## When true will wait for current running sessions to finish before terminating the pod + waitForRunningSessions: false + + ## Configure annotations on the firefox debug pods + podAnnotations: {} + ## Configure labels on the firefox debug pods + podLabels: {} + + # Configure security context on the firefox debug pods + # securityContext: + # fsGroup: 1000 + # runAsUser: 1000 + + ## Additional environment variables to set + extraEnvs: [] + # extraEnvs: + # - name: FOO + # valueFrom: + # secretKeyRef: + # key: FOO + # name: secret-resource + + ## Set the JAVA_TOOL_OPTIONS environment variable + ## If you find your selenium hub is OOMKilled, try adding -XX:+UseSerialGC + javaOpts: "-Xmx900m" + + ## Set the SE_OPTS environment variable + ## ref: http://www.seleniumhq.org/docs/07_selenium_grid.jsp#node-configuration + # seOpts: + + ## Defining a JMX port will open the port on the container, however, it + ## requires additional javaOpts, ie + ## javaOpts: > + ## -Dcom.sun.management.jmxremote.port=4000 + ## -Dcom.sun.management.jmxremote.authenticate=false + ## -Dcom.sun.management.jmxremote.ssl=false + ## ref: http://openjdk.java.net/groups/jmx/ + # jmxPort: 4000 + + volumes: + ## https://docs.openshift.com/container-platform/3.6/dev_guide/shared_memory.html + - name: dshm + emptyDir: + medium: Memory + volumeMounts: + - mountPath: /dev/shm + name: dshm + + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + resources: + limits: + cpu: ".5" + memory: "1500Mi" + + ## Characteristics of the browser window + # screenWidth: 1280 + # screenHeight: 1024 + # screenDepth: 24 + # display: :10 + + ## Selenium node options + # firefoxVersion: + # nodeMaxInstances: 1 + # nodeMaxSession: 1 + ## In milliseconds + # nodeRegisterCycle: 5000 + # nodePort: 5555 + # timeZone: UTC + + ## NodeSelector to be used for firefoxDebug + nodeSelector: + # label: value