From 39016242aa661e67d475f9cc30203b18198c7766 Mon Sep 17 00:00:00 2001 From: Subin M Date: Thu, 26 Feb 2015 04:08:49 +0530 Subject: [PATCH 1/2] Update examples to support v1beta3 api - liveness/mysql-wordpress --- .../v1beta3/hazelcast-controller.yaml | 4 +- examples/liveness/v1beta3/exec-liveness.yaml | 29 +++++++++++++ examples/liveness/v1beta3/http-liveness.yaml | 26 ++++++++++++ .../v1beta3/mysql-service.yaml | 12 ++++++ .../mysql-wordpress-pd/v1beta3/mysql.yaml | 42 +++++++++++++++++++ .../v1beta3/wordpress-service.yaml | 12 ++++++ .../mysql-wordpress-pd/v1beta3/wordpress.yaml | 39 +++++++++++++++++ 7 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 examples/liveness/v1beta3/exec-liveness.yaml create mode 100644 examples/liveness/v1beta3/http-liveness.yaml create mode 100644 examples/mysql-wordpress-pd/v1beta3/mysql-service.yaml create mode 100644 examples/mysql-wordpress-pd/v1beta3/mysql.yaml create mode 100644 examples/mysql-wordpress-pd/v1beta3/wordpress-service.yaml create mode 100644 examples/mysql-wordpress-pd/v1beta3/wordpress.yaml diff --git a/examples/hazelcast/v1beta3/hazelcast-controller.yaml b/examples/hazelcast/v1beta3/hazelcast-controller.yaml index ed7679d119066..ddeeb67dbba2f 100644 --- a/examples/hazelcast/v1beta3/hazelcast-controller.yaml +++ b/examples/hazelcast/v1beta3/hazelcast-controller.yaml @@ -14,7 +14,9 @@ spec: name: hazelcast spec: containers: - - cpu: 1000 + - resources: + limits: + cpu: 1000m image: pires/hazelcast-k8s name: hazelcast ports: diff --git a/examples/liveness/v1beta3/exec-liveness.yaml b/examples/liveness/v1beta3/exec-liveness.yaml new file mode 100644 index 0000000000000..d032e2c409e10 --- /dev/null +++ b/examples/liveness/v1beta3/exec-liveness.yaml @@ -0,0 +1,29 @@ +apiVersion: v1beta3 +kind: ReplicationController +metadata: + labels: + test: liveness + name: liveness-exec +spec: + replicas: 1 + selector: + test: liveness + template: + metadata: + labels: + test: liveness + spec: + containers: + - command: + - "/bin/sh" + - "-c" + - "echo ok > /tmp/health; sleep 10; echo fail > /tmp/health; sleep 600" + image: busybox + livenessProbe: + exec: + command: + - "cat" + - "/tmp/health" + initialDelaySeconds: 15 + name: liveness + diff --git a/examples/liveness/v1beta3/http-liveness.yaml b/examples/liveness/v1beta3/http-liveness.yaml new file mode 100644 index 0000000000000..7cb8aec07395b --- /dev/null +++ b/examples/liveness/v1beta3/http-liveness.yaml @@ -0,0 +1,26 @@ +apiVersion: v1beta3 +kind: ReplicationController +metadata: + labels: + test: liveness + name: liveness-http +spec: + replicas: 1 + selector: + test: liveness + template: + metadata: + labels: + test: liveness + spec: + containers: + - command: + - "/server" + image: kubernetes/liveness + livenessProbe: + httpGet: + path: "/healthz" + port: 8080 + initialDelaySeconds: 15 + name: liveness + diff --git a/examples/mysql-wordpress-pd/v1beta3/mysql-service.yaml b/examples/mysql-wordpress-pd/v1beta3/mysql-service.yaml new file mode 100644 index 0000000000000..3bf5f2825fc74 --- /dev/null +++ b/examples/mysql-wordpress-pd/v1beta3/mysql-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1beta3 +kind: Service +metadata: + labels: + name: mysql + name: mysql +spec: + containerPort: 3306 + port: 3306 + selector: + name: mysql + diff --git a/examples/mysql-wordpress-pd/v1beta3/mysql.yaml b/examples/mysql-wordpress-pd/v1beta3/mysql.yaml new file mode 100644 index 0000000000000..0e90a7386731b --- /dev/null +++ b/examples/mysql-wordpress-pd/v1beta3/mysql.yaml @@ -0,0 +1,42 @@ +apiVersion: v1beta3 +kind: ReplicationController +metadata: + labels: + name: mysql + name: mysql +spec: + replicas: 1 + selector: + name: mysql + template: + metadata: + labels: + name: mysql + spec: + containers: + - resources: + limits : + cpu: 1000m + image: mysql + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + # change this + value: yourpassword + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + # name must match the volume name below + - name: mysql-persistent-storage + # mount path within the container + mountPath: /var/lib/mysql + volumes: + - name: mysql-persistent-storage + source: + # emptyDir: {} + persistentDisk: + # This GCE PD must already exist. + pdName: mysql-disk + fsType: ext4 + diff --git a/examples/mysql-wordpress-pd/v1beta3/wordpress-service.yaml b/examples/mysql-wordpress-pd/v1beta3/wordpress-service.yaml new file mode 100644 index 0000000000000..c1988c271868a --- /dev/null +++ b/examples/mysql-wordpress-pd/v1beta3/wordpress-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1beta3 +kind: Service +metadata: + labels: + name: wpfrontend + name: wpfrontend +spec: + containerPort: 80 + port: 80 + selector: + name: wpfrontend + diff --git a/examples/mysql-wordpress-pd/v1beta3/wordpress.yaml b/examples/mysql-wordpress-pd/v1beta3/wordpress.yaml new file mode 100644 index 0000000000000..bf73df3f82cf5 --- /dev/null +++ b/examples/mysql-wordpress-pd/v1beta3/wordpress.yaml @@ -0,0 +1,39 @@ +apiVersion: v1beta3 +kind: ReplicationController +metadata: + labels: + name: wordpress + name: wordpress +spec: + replicas: 1 + selector: + name: wordpress + template: + metadata: + labels: + name: wordpress + spec: + containers: + image: wordpress + name: wordpress + env: + - name: WORDPRESS_DB_PASSWORD + # change this - must match mysql.yaml password + value: yourpassword + ports: + - containerPort: 80 + name: wordpress + volumeMounts: + # name must match the volume name below + - name: wordpress-persistent-storage + # mount path within the container + mountPath: /var/www/html + volumes: + - name: wordpress-persistent-storage + source: + # emptyDir: {} + persistentDisk: + # This GCE PD must already exist. + pdName: wordpress-disk + fsType: ext4 + From efaf274a0b665aaf586c5a29e9c9bb6440d8ac21 Mon Sep 17 00:00:00 2001 From: Subin M Date: Thu, 26 Feb 2015 13:48:29 +0530 Subject: [PATCH 2/2] modify resource limits --- examples/hazelcast/v1beta3/hazelcast-controller.yaml | 2 +- examples/mysql-wordpress-pd/v1beta3/mysql.yaml | 2 +- examples/mysql-wordpress-pd/v1beta3/wordpress.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/hazelcast/v1beta3/hazelcast-controller.yaml b/examples/hazelcast/v1beta3/hazelcast-controller.yaml index ddeeb67dbba2f..795e0de0df8a7 100644 --- a/examples/hazelcast/v1beta3/hazelcast-controller.yaml +++ b/examples/hazelcast/v1beta3/hazelcast-controller.yaml @@ -16,7 +16,7 @@ spec: containers: - resources: limits: - cpu: 1000m + cpu: 1 image: pires/hazelcast-k8s name: hazelcast ports: diff --git a/examples/mysql-wordpress-pd/v1beta3/mysql.yaml b/examples/mysql-wordpress-pd/v1beta3/mysql.yaml index 0e90a7386731b..9ebc424585797 100644 --- a/examples/mysql-wordpress-pd/v1beta3/mysql.yaml +++ b/examples/mysql-wordpress-pd/v1beta3/mysql.yaml @@ -16,7 +16,7 @@ spec: containers: - resources: limits : - cpu: 1000m + cpu: 1 image: mysql name: mysql env: diff --git a/examples/mysql-wordpress-pd/v1beta3/wordpress.yaml b/examples/mysql-wordpress-pd/v1beta3/wordpress.yaml index bf73df3f82cf5..3ee5b12f75600 100644 --- a/examples/mysql-wordpress-pd/v1beta3/wordpress.yaml +++ b/examples/mysql-wordpress-pd/v1beta3/wordpress.yaml @@ -14,7 +14,7 @@ spec: name: wordpress spec: containers: - image: wordpress + - image: wordpress name: wordpress env: - name: WORDPRESS_DB_PASSWORD