Skip to content

Instantly share code, notes, and snippets.

@FantomX1-github
Forked from mojsha/zalenium-template.yaml
Created April 24, 2018 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FantomX1-github/cf79ecb8d4f4a68682b7ec19bde0e9e5 to your computer and use it in GitHub Desktop.
Save FantomX1-github/cf79ecb8d4f4a68682b7ec19bde0e9e5 to your computer and use it in GitHub Desktop.
OpenShift template for Zalenium
apiVersion: v1
kind: Template
metadata:
name: zalenium
annotations:
"openshift.io/display-name": "Zalenium"
"description": "Disposable Selenium Grid for use in OpenShift"
message: |-
A Zalenium grid has been created in your project. Continue to overview to verify that it exists and start the deployment.
Username: ${ZALENIUM_USER}
Password: ${ZALENIUM_PASSWORD}
parameters:
- name: "FIREFOX_CONTAINERS"
displayName: "Number of initial Firefox containers."
description: "This is the number of Firefox containers that should be created when Zalenium starts up."
value: "0"
required: false
- name: "CHROME_CONTAINERS"
displayName: "Number of initial Chrome containers."
description: "This is the number of Chrome containers that should be created when Zalenium starts up."
value: "0"
required: false
- name: "ZALENIUM_KUBERNETES_CPU_REQUEST"
displayName: "CPU request for the Selenium Pods."
description: "This is the minimum amount of CPU that the container will be configured with."
value: "100m"
required: true
- name: "ZALENIUM_KUBERNETES_CPU_LIMIT"
displayName: "CPU Limit for the Selenium Pods."
description: "This is the maximum amount of CPU that the container will be configured with."
value: "200m"
required: true
- name: "ZALENIUM_KUBERNETES_MEMORY_REQUEST"
displayName: "Memory request for the Selenium Pods."
description: "This is the minimum amount of memory that the container will be configured with."
value: "500Mi"
required: true
- name: "ZALENIUM_KUBERNETES_MEMORY_LIMIT"
displayName: "Memory limit for the Selenium Pods."
description: "This is the maximum amount of memory that the container will be configured with."
value: "1Gi"
required: true
- name: "VOLUME_CAPACITY"
displayName: "Volume capacity for the disk that contains the test results."
description: "The volume is used to store all the test results, including logs and video recordings of the tests."
value: "10Gi"
required: true
- name: "ZALENIUM_USER"
displayName: "Basic auth user for Zalenium."
description: "This username is used to authenticate towards the Selenium Hub URL."
value: "zalenium"
required: true
- name: "ZALENIUM_PASSWORD"
displayName: "Basic auth password for Zalenium."
description: "This password is used to authenticate towards the Selenium Hub URL."
from: '[a-zA-Z0-9]{16}'
generate: expression
required: true
- name: "SESSION_SECRET"
displayName: "The session secret for the OAuth proxy."
description: "This is an auto-generated session secret that the OAuth proxy needs."
from: '[a-zA-Z0-9]{43}'
generate: expression
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
metadata:
generation: 1
labels:
app: zalenium
role: hub
name: zalenium
spec:
replicas: 1
selector:
app: zalenium
role: hub
strategy:
activeDeadlineSeconds: 21600
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
labels:
app: zalenium
role: hub
spec:
containers:
- args:
- '-provider=openshift'
- '-https-address=:8443'
- '-http-address='
- '-email-domain=*'
- '-upstream=http://localhost:4444'
- '-client-id=system:serviceaccount:$(CURRENT_NAMESPACE):zalenium'
- '-client-secret-file=/var/run/secrets/kubernetes.io/serviceaccount/token'
- '-openshift-sar={"resource": "namespaces", "verb": "get", "resourceName": "$(CURRENT_NAMESPACE)", "namespace": "$(CURRENT_NAMESPACE)"}'
- '-openshift-delegate-urls={"/": {"resource": "namespaces", "verb": "get", "resourceName": "$(CURRENT_NAMESPACE)", "namespace": "$(CURRENT_NAMESPACE)"}}'
- '-tls-cert=/etc/tls/private/tls.crt'
- '-tls-key=/etc/tls/private/tls.key'
- '-cookie-secret-file=/etc/proxy/secrets/session_secret'
- '-skip-auth-regex=^/wd'
- '-skip-provider-button'
- '-openshift-ca=/config/openshift-ca/ca.crt'
env:
- name: CURRENT_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: 'openshift/oauth-proxy:v1.0.0'
imagePullPolicy: IfNotPresent
name: zalenium-proxy
ports:
- containerPort: 8443
name: web
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /config/openshift-ca
name: openshift-ca
- mountPath: /etc/proxy/secrets
name: zalenium-proxy-secrets-volume
- mountPath: /etc/tls/private
name: zalenium-proxy-tls
- args:
- start
- --firefoxContainers
- ${FIREFOX_CONTAINERS}
- --chromeContainers
- ${CHROME_CONTAINERS}
- --seleniumImageName
- "openshift/elgalu_selenium:3.6.0-p3"
- --sendAnonymousUsageInfo
- "false"
- --gridUser
- ${ZALENIUM_USER}
- --gridPassword
- ${ZALENIUM_PASSWORD}
env:
- name: ZALENIUM_KUBERNETES_CPU_REQUEST
value: ${ZALENIUM_KUBERNETES_CPU_REQUEST}
- name: ZALENIUM_KUBERNETES_CPU_LIMIT
value: ${ZALENIUM_KUBERNETES_CPU_LIMIT}
- name: ZALENIUM_KUBERNETES_MEMORY_REQUEST
value: ${ZALENIUM_KUBERNETES_MEMORY_REQUEST}
- name: ZALENIUM_KUBERNETES_MEMORY_LIMIT
value: ${ZALENIUM_KUBERNETES_MEMORY_LIMIT}
- name: ZALENIUM_USER
value: zalenium
- name: ZALENIUM_PASSWORD
value: zalenium
image: openshift/dosel_zalenium:3.6.0f
imagePullPolicy: IfNotPresent
name: zalenium
ports:
- containerPort: 4444
protocol: TCP
resources:
requests:
cpu: '100m'
memory: 500Mi
limits:
cpu: '200m'
memory: 1Gi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /home/seluser/videos
name: zalenium-volume
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: zalenium
serviceAccountName: zalenium
terminationGracePeriodSeconds: 30
volumes:
- name: zalenium-volume
persistentVolumeClaim:
claimName: zalenium-pvc
- configMap:
defaultMode: 420
name: openshift-ca
name: openshift-ca
- name: zalenium-proxy-secrets-volume
secret:
defaultMode: 420
secretName: zalenium-proxy-secret
- name: zalenium-proxy-tls
secret:
defaultMode: 420
secretName: zalenium-proxy-tls
test: false
triggers:
- type: ConfigChange
- apiVersion: v1
kind: Route
metadata:
annotations:
openshift.io/host.generated: "true"
haproxy.router.openshift.io/timeout: "2000s"
name: zalenium
spec:
tls:
termination: Reencrypt
insecureEdgeTerminationPolicy: Redirect
to:
kind: Service
name: zalenium
weight: 100
wildcardPolicy: None
- apiVersion: v1
kind: Service
metadata:
annotations:
service.alpha.openshift.io/serving-cert-secret-name: zalenium-proxy-tls
name: zalenium
spec:
ports:
- port: 443
protocol: TCP
targetPort: 8443
selector:
app: zalenium
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
kind: ServiceAccount
metadata:
name: zalenium
annotations:
serviceaccounts.openshift.io/oauth-redirectreference.zalenium: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"zalenium"}}'
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: zalenium-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: ${VOLUME_CAPACITY}
- apiVersion: v1
groupNames: null
kind: RoleBinding
metadata:
creationTimestamp: null
name: zalenium-rolebinding
roleRef:
name: zalenium-role
subjects:
- kind: ServiceAccount
name: zalenium
userNames:
- zalenium
- apiVersion: v1
kind: Role
metadata:
name: zalenium-role
rules:
- apiGroups:
- ""
attributeRestrictions: null
resources:
- pods
verbs:
- create
- delete
- exec
- get
- list
- watch
- apiGroups:
- ""
attributeRestrictions: null
resources:
- services
verbs:
- create
- delete
- get
- list
- apiGroups:
- ""
attributeRestrictions: null
resources:
- pods/exec
verbs:
- create
- get
- apiVersion: v1
kind: Secret
metadata:
name: zalenium
stringData:
zalenium-user: ${ZALENIUM_USER}
zalenium-password: ${ZALENIUM_PASSWORD}
- apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: null
name: openshift-ca
data:
ca.crt: |-
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
- apiVersion: v1
kind: Secret
metadata:
name: zalenium-proxy-secret
stringData:
session_secret: "${SESSION_SECRET}="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment