Skip to content

Commit

Permalink
Merge pull request kubernetes#219 from ilievlad/master
Browse files Browse the repository at this point in the history
Update selenium examples to use deployments and newer selenium
  • Loading branch information
k8s-ci-robot authored Apr 4, 2018
2 parents 11aa742 + cd409d6 commit 59bc6cd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
20 changes: 10 additions & 10 deletions staging/selenium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Your cluster must have 4 CPU and 6 GB of RAM to complete the example up to the s
We will be using Selenium Grid Hub to make our Selenium install scalable via a master/worker model. The Selenium Hub is the master, and the Selenium Nodes are the workers(not to be confused with Kubernetes nodes). We only need one hub, but we're using a replication controller to ensure that the hub is always running:

```console
kubectl create --filename=examples/selenium/selenium-hub-rc.yaml
kubectl create --filename=staging/selenium/selenium-hub-deployment.yaml
```

The Selenium Nodes will need to know how to get to the Hub, let's create a service for the nodes to connect to.

```console
kubectl create --filename=examples/selenium/selenium-hub-svc.yaml
kubectl create --filename=staging/selenium/selenium-hub-svc.yaml
```

### Verify Selenium Hub Deployment
Expand Down Expand Up @@ -59,7 +59,7 @@ curl http://localhost:4444
If you are using Google Container Engine, you can expose your hub via the internet. This is a bad idea for many reasons, but you can do it as follows:

```console
kubectl expose rc selenium-hub --name=selenium-hub-external --labels="app=selenium-hub,external=true" --type=LoadBalancer
kubectl expose deployment selenium-hub --name=selenium-hub-external --labels="app=selenium-hub,external=true" --type=LoadBalancer
```

Then wait a few minutes, eventually your new `selenium-hub-external` service will be assigned a load balanced IP from gcloud. Once `kubectl get svc selenium-hub-external` shows two IPs, run this snippet.
Expand All @@ -79,13 +79,13 @@ Now that the Hub is up, we can deploy workers.
This will deploy 2 Chrome nodes.

```console
kubectl create --filename=examples/selenium/selenium-node-chrome-rc.yaml
kubectl create --filename=staging/selenium/selenium-node-chrome-deployment.yaml
```

And 2 Firefox nodes to match.

```console
kubectl create --filename=examples/selenium/selenium-node-firefox-rc.yaml
kubectl create --filename=staging/selenium/selenium-node-firefox-deployment.yaml
```

Once the pods start, you will see them show up in the Selenium Hub interface.
Expand Down Expand Up @@ -160,8 +160,8 @@ Congratulations, your Selenium Hub is up, with Firefox and Chrome nodes!
If you need more Firefox or Chrome nodes, your hardware is the limit:

```console
kubectl scale rc selenium-node-firefox --replicas=10
kubectl scale rc selenium-node-chrome --replicas=10
kubectl scale deployment selenium-node-firefox --replicas=10
kubectl scale deployment selenium-node-chrome --replicas=10
```

You now have 10 Firefox and 10 Chrome nodes, happy Seleniuming!
Expand All @@ -185,9 +185,9 @@ Adapted from: https://github.com/SeleniumHQ/docker-selenium
To remove all created resources, run the following:

```console
kubectl delete rc selenium-hub
kubectl delete rc selenium-node-chrome
kubectl delete rc selenium-node-firefox
kubectl delete deployment selenium-hub
kubectl delete deployment selenium-node-chrome
kubectl delete deployment selenium-node-firefox
kubectl delete deployment selenium-python
kubectl delete svc selenium-hub
kubectl delete svc selenium-hub-external
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1
kind: Deployment
metadata:
name: selenium-hub
labels:
app: selenium-hub
spec:
replicas: 1
selector:
app: selenium-hub
matchLabels:
app: selenium-hub
template:
metadata:
labels:
app: selenium-hub
spec:
containers:
- name: selenium-hub
image: selenium/hub:2.53.0
image: selenium/hub:3.11
ports:
- containerPort: 4444
resources:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1
kind: Deployment
metadata:
name: selenium-node-chrome
labels:
app: selenium-node-chrome
spec:
replicas: 2
selector:
app: selenium-node-chrome
matchLabels:
app: selenium-node-chrome
template:
metadata:
labels:
app: selenium-node-chrome
spec:
containers:
- name: selenium-node-chrome
image: selenium/node-chrome-debug:2.53.0
image: selenium/node-chrome-debug:3.11
ports:
- containerPort: 5900
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1
kind: Deployment
metadata:
name: selenium-node-firefox
labels:
app: selenium-node-firefox
spec:
replicas: 2
selector:
app: selenium-node-firefox
matchLabels:
app: selenium-node-firefox
template:
metadata:
labels:
app: selenium-node-firefox
spec:
volumes:
- name: dshm
emptyDir:
medium: Memory
containers:
- name: selenium-node-firefox
image: selenium/node-firefox-debug:2.53.0
image: selenium/node-firefox-debug:3.11
ports:
- containerPort: 5900
volumeMounts:
- mountPath: /dev/shm
name: dshm
env:
- name: HUB_PORT_4444_TCP_ADDR
value: "selenium-hub"
Expand Down

0 comments on commit 59bc6cd

Please sign in to comment.