diff --git a/sock-shop/components/carts-db-deploy.yaml b/sock-shop/components/carts-db-dep.yaml similarity index 94% rename from sock-shop/components/carts-db-deploy.yaml rename to sock-shop/components/carts-db-dep.yaml index b57cb5b..5452b6f 100644 --- a/sock-shop/components/carts-db-deploy.yaml +++ b/sock-shop/components/carts-db-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -37,4 +38,4 @@ spec: emptyDir: medium: Memory nodeSelector: - beta.kubernetes.io/os: linux \ No newline at end of file + beta.kubernetes.io/os: linux diff --git a/sock-shop/components/carts-db-svc.yaml b/sock-shop/components/carts-db-svc.yaml index 5747b89..df88dd9 100644 --- a/sock-shop/components/carts-db-svc.yaml +++ b/sock-shop/components/carts-db-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: diff --git a/sock-shop/components/carts-deploy.yaml b/sock-shop/components/carts-dep.yaml similarity index 67% rename from sock-shop/components/carts-deploy.yaml rename to sock-shop/components/carts-dep.yaml index c765443..7c44ff0 100644 --- a/sock-shop/components/carts-deploy.yaml +++ b/sock-shop/components/carts-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -17,13 +18,20 @@ spec: containers: - name: carts image: weaveworksdemos/carts:0.4.8 - ports: - - containerPort: 80 env: - name: ZIPKIN value: zipkin.jaeger.svc.cluster.local - name: JAVA_OPTS value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom + resources: + limits: + cpu: 300m + memory: 500Mi + requests: + cpu: 300m + memory: 500Mi + ports: + - containerPort: 80 securityContext: runAsNonRoot: true runAsUser: 10001 @@ -36,6 +44,18 @@ spec: volumeMounts: - mountPath: /tmp name: tmp-volume + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 volumes: - name: tmp-volume emptyDir: diff --git a/sock-shop/components/catalogue-db-deploy.yaml b/sock-shop/components/catalogue-db-dep.yaml similarity index 99% rename from sock-shop/components/catalogue-db-deploy.yaml rename to sock-shop/components/catalogue-db-dep.yaml index 1221c2b..23890fa 100644 --- a/sock-shop/components/catalogue-db-deploy.yaml +++ b/sock-shop/components/catalogue-db-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: diff --git a/sock-shop/components/catalogue-db-svc.yaml b/sock-shop/components/catalogue-db-svc.yaml index fd2da92..683b9ce 100644 --- a/sock-shop/components/catalogue-db-svc.yaml +++ b/sock-shop/components/catalogue-db-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: diff --git a/sock-shop/components/catalogue-deploy.yaml b/sock-shop/components/catalogue-dep.yaml similarity index 58% rename from sock-shop/components/catalogue-deploy.yaml rename to sock-shop/components/catalogue-dep.yaml index 97bb381..cfa66dc 100644 --- a/sock-shop/components/catalogue-deploy.yaml +++ b/sock-shop/components/catalogue-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -17,6 +18,13 @@ spec: containers: - name: catalogue image: weaveworksdemos/catalogue:0.3.5 + resources: + limits: + cpu: 100m + memory: 100Mi + requests: + cpu: 100m + memory: 100Mi ports: - containerPort: 80 securityContext: @@ -28,5 +36,17 @@ spec: add: - NET_BIND_SERVICE readOnlyRootFilesystem: true + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 nodeSelector: beta.kubernetes.io/os: linux diff --git a/sock-shop/components/catalogue-svc.yaml b/sock-shop/components/catalogue-svc.yaml index 7020f42..ed948f5 100644 --- a/sock-shop/components/catalogue-svc.yaml +++ b/sock-shop/components/catalogue-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: diff --git a/sock-shop/components/front-end-deploy.yaml b/sock-shop/components/front-end-dep.yaml similarity index 58% rename from sock-shop/components/front-end-deploy.yaml rename to sock-shop/components/front-end-dep.yaml index da5e2fd..069c5ef 100644 --- a/sock-shop/components/front-end-deploy.yaml +++ b/sock-shop/components/front-end-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -16,11 +17,17 @@ spec: - name: front-end image: weaveworksdemos/front-end:0.3.12 resources: + limits: + cpu: 300m + memory: 1000Mi requests: cpu: 100m - memory: 100Mi + memory: 300Mi ports: - containerPort: 8079 + env: + - name: SESSION_REDIS + value: "true" securityContext: runAsNonRoot: true runAsUser: 10001 @@ -28,5 +35,17 @@ spec: drop: - all readOnlyRootFilesystem: true + livenessProbe: + httpGet: + path: / + port: 8079 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: / + port: 8079 + initialDelaySeconds: 30 + periodSeconds: 3 nodeSelector: beta.kubernetes.io/os: linux diff --git a/sock-shop/components/front-end-svc.yaml b/sock-shop/components/front-end-svc.yaml index 20e6030..5249bb4 100644 --- a/sock-shop/components/front-end-svc.yaml +++ b/sock-shop/components/front-end-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: diff --git a/sock-shop/components/orders-db-deploy.yaml b/sock-shop/components/orders-db-dep.yaml similarity index 99% rename from sock-shop/components/orders-db-deploy.yaml rename to sock-shop/components/orders-db-dep.yaml index 3bff717..30b7181 100644 --- a/sock-shop/components/orders-db-deploy.yaml +++ b/sock-shop/components/orders-db-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: diff --git a/sock-shop/components/orders-db-svc.yaml b/sock-shop/components/orders-db-svc.yaml index a5fa034..7ddd3bb 100644 --- a/sock-shop/components/orders-db-svc.yaml +++ b/sock-shop/components/orders-db-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: diff --git a/sock-shop/components/orders-deploy.yaml b/sock-shop/components/orders-dep.yaml similarity index 69% rename from sock-shop/components/orders-deploy.yaml rename to sock-shop/components/orders-dep.yaml index 56139fd..b31d9ad 100644 --- a/sock-shop/components/orders-deploy.yaml +++ b/sock-shop/components/orders-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -22,6 +23,13 @@ spec: value: zipkin.jaeger.svc.cluster.local - name: JAVA_OPTS value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 200m + memory: 500Mi ports: - containerPort: 80 securityContext: @@ -36,6 +44,18 @@ spec: volumeMounts: - mountPath: /tmp name: tmp-volume + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 volumes: - name: tmp-volume emptyDir: diff --git a/sock-shop/components/orders-svc.yaml b/sock-shop/components/orders-svc.yaml index f00afc6..6be52c4 100644 --- a/sock-shop/components/orders-svc.yaml +++ b/sock-shop/components/orders-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: diff --git a/sock-shop/components/params.libsonnet b/sock-shop/components/params.libsonnet index 302c48d..e3325e6 100644 --- a/sock-shop/components/params.libsonnet +++ b/sock-shop/components/params.libsonnet @@ -6,31 +6,32 @@ components: { // Component-level parameters, defined initially from 'ks prototype use ...' // Each object below should correspond to a component in the components/ directory - "carts-db-deploy": {}, + "carts-db-dep": {}, "carts-db-svc": {}, - "carts-deploy": {}, - "carts-svc": {}, - "catalogue-db-deploy": {}, + "carts-dep": {}, + "catalogue-db-dep": {}, "catalogue-db-svc": {}, - "catalogue-deploy": {}, + "catalogue-dep": {}, "catalogue-svc": {}, - "front-end-deploy": {}, + "front-end-dep": {}, "front-end-svc": {}, - "orders-db-deploy": {}, + "orders-db-dep": {}, "orders-db-svc": {}, - "orders-deploy": {}, + "orders-dep": {}, "orders-svc": {}, - "payment-deploy": {}, + "payment-dep": {}, "payment-svc": {}, - "queue-master-deploy": {}, + "queue-master-dep": {}, "queue-master-svc": {}, - "rabbitmq-deploy": {}, + "rabbitmq-dep": {}, "rabbitmq-svc": {}, - "shipping-deploy": {}, + "session-db-dep": {}, + "session-db-svc": {}, + "shipping-dep": {}, "shipping-svc": {}, - "user-db-deploy": {}, + "user-db-dep": {}, "user-db-svc": {}, - "user-deploy": {}, + "user-dep": {}, "user-svc": {}, }, } diff --git a/sock-shop/components/payment-deploy.yaml b/sock-shop/components/payment-dep.yaml similarity index 58% rename from sock-shop/components/payment-deploy.yaml rename to sock-shop/components/payment-dep.yaml index ecfe66d..4477eea 100644 --- a/sock-shop/components/payment-deploy.yaml +++ b/sock-shop/components/payment-dep.yaml @@ -1,4 +1,4 @@ - +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -18,6 +18,13 @@ spec: containers: - name: payment image: weaveworksdemos/payment:0.4.3 + resources: + limits: + cpu: 100m + memory: 100Mi + requests: + cpu: 99m + memory: 100Mi ports: - containerPort: 80 securityContext: @@ -29,5 +36,17 @@ spec: add: - NET_BIND_SERVICE readOnlyRootFilesystem: true + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 nodeSelector: beta.kubernetes.io/os: linux diff --git a/sock-shop/components/payment-svc.yaml b/sock-shop/components/payment-svc.yaml index da0e49d..dbe8fcc 100644 --- a/sock-shop/components/payment-svc.yaml +++ b/sock-shop/components/payment-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: diff --git a/sock-shop/components/queue-master-dep.yaml b/sock-shop/components/queue-master-dep.yaml new file mode 100644 index 0000000..626e69f --- /dev/null +++ b/sock-shop/components/queue-master-dep.yaml @@ -0,0 +1,48 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: queue-master + labels: + name: queue-master +spec: + replicas: 1 + selector: + matchLabels: + name: queue-master + template: + metadata: + labels: + name: queue-master + spec: + containers: + - name: queue-master + image: weaveworksdemos/queue-master:0.3.1 + env: + - name: ZIPKIN + value: zipkin.jaeger.svc.cluster.local + - name: JAVA_OPTS + value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom + resources: + limits: + cpu: 300m + memory: 500Mi + requests: + cpu: 300m + memory: 500Mi + ports: + - containerPort: 80 + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/components/queue-master-deploy.yaml b/sock-shop/components/queue-master-deploy.yaml deleted file mode 100644 index e32e8f8..0000000 --- a/sock-shop/components/queue-master-deploy.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: queue-master - labels: - name: queue-master -spec: - replicas: 1 - selector: - matchLabels: - name: queue-master - template: - metadata: - labels: - name: queue-master - spec: - containers: - - name: queue-master - image: weaveworksdemos/queue-master:0.3.1 - ports: - - containerPort: 80 - nodeSelector: - beta.kubernetes.io/os: linux diff --git a/sock-shop/components/queue-master-svc.yaml b/sock-shop/components/queue-master-svc.yaml index b96fe31..fa7a6ae 100644 --- a/sock-shop/components/queue-master-svc.yaml +++ b/sock-shop/components/queue-master-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: diff --git a/sock-shop/components/rabbitmq-deploy.yaml b/sock-shop/components/rabbitmq-dep.yaml similarity index 65% rename from sock-shop/components/rabbitmq-deploy.yaml rename to sock-shop/components/rabbitmq-dep.yaml index f8dd7cd..064c6f6 100644 --- a/sock-shop/components/rabbitmq-deploy.yaml +++ b/sock-shop/components/rabbitmq-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -13,12 +14,17 @@ spec: metadata: labels: name: rabbitmq + annotations: + prometheus.io/scrape: "false" spec: containers: - name: rabbitmq - image: rabbitmq:3.6.8 + image: rabbitmq:3.6.8-management ports: + - containerPort: 15672 + name: management - containerPort: 5672 + name: rabbitmq securityContext: capabilities: drop: @@ -29,5 +35,10 @@ spec: - SETUID - DAC_OVERRIDE readOnlyRootFilesystem: true + - name: rabbitmq-exporter + image: kbudde/rabbitmq-exporter + ports: + - containerPort: 9090 + name: exporter nodeSelector: beta.kubernetes.io/os: linux diff --git a/sock-shop/components/rabbitmq-svc.yaml b/sock-shop/components/rabbitmq-svc.yaml index 59e735a..322513c 100644 --- a/sock-shop/components/rabbitmq-svc.yaml +++ b/sock-shop/components/rabbitmq-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: @@ -8,6 +9,11 @@ spec: ports: # the port that this service should serve on - port: 5672 + name: rabbitmq targetPort: 5672 + - port: 9090 + name: exporter + targetPort: exporter + protocol: TCP selector: name: rabbitmq diff --git a/sock-shop/components/session-db-dep.yaml b/sock-shop/components/session-db-dep.yaml new file mode 100644 index 0000000..85cfed9 --- /dev/null +++ b/sock-shop/components/session-db-dep.yaml @@ -0,0 +1,36 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: session-db + labels: + name: session-db +spec: + replicas: 1 + selector: + matchLabels: + name: session-db + template: + metadata: + labels: + name: session-db + annotations: + prometheus.io.scrape: "false" + spec: + containers: + - name: session-db + image: redis:alpine + ports: + - name: redis + containerPort: 6379 + securityContext: + capabilities: + drop: + - all + add: + - CHOWN + - SETGID + - SETUID + readOnlyRootFilesystem: true + nodeSelector: + beta.kubernetes.io/os: linux diff --git a/sock-shop/components/carts-svc.yaml b/sock-shop/components/session-db-svc.yaml similarity index 55% rename from sock-shop/components/carts-svc.yaml rename to sock-shop/components/session-db-svc.yaml index b47fb0e..a792ea4 100644 --- a/sock-shop/components/carts-svc.yaml +++ b/sock-shop/components/session-db-svc.yaml @@ -1,13 +1,14 @@ +--- apiVersion: v1 kind: Service metadata: - name: carts + name: session-db labels: - name: carts + name: session-db spec: ports: # the port that this service should serve on - - port: 80 - targetPort: 80 + - port: 6379 + targetPort: 6379 selector: - name: carts + name: session-db diff --git a/sock-shop/components/shipping-deploy.yaml b/sock-shop/components/shipping-dep.yaml similarity index 69% rename from sock-shop/components/shipping-deploy.yaml rename to sock-shop/components/shipping-dep.yaml index 1849bb5..af8d90b 100644 --- a/sock-shop/components/shipping-deploy.yaml +++ b/sock-shop/components/shipping-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -22,6 +23,13 @@ spec: value: zipkin.jaeger.svc.cluster.local - name: JAVA_OPTS value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom + resources: + limits: + cpu: 300m + memory: 500Mi + requests: + cpu: 300m + memory: 500Mi ports: - containerPort: 80 securityContext: @@ -36,6 +44,18 @@ spec: volumeMounts: - mountPath: /tmp name: tmp-volume + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 volumes: - name: tmp-volume emptyDir: diff --git a/sock-shop/components/shipping-svc.yaml b/sock-shop/components/shipping-svc.yaml index 215dea5..aac156c 100644 --- a/sock-shop/components/shipping-svc.yaml +++ b/sock-shop/components/shipping-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: @@ -11,3 +12,4 @@ spec: targetPort: 80 selector: name: shipping + diff --git a/sock-shop/components/user-db-deploy.yaml b/sock-shop/components/user-db-dep.yaml similarity index 89% rename from sock-shop/components/user-db-deploy.yaml rename to sock-shop/components/user-db-dep.yaml index e3b35ff..41ec058 100644 --- a/sock-shop/components/user-db-deploy.yaml +++ b/sock-shop/components/user-db-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -16,7 +17,8 @@ spec: spec: containers: - name: user-db - image: weaveworksdemos/user-db:0.4.0 + image: weaveworksdemos/user-db:0.3.0 + ports: - name: mongo containerPort: 27017 @@ -37,4 +39,4 @@ spec: emptyDir: medium: Memory nodeSelector: - beta.kubernetes.io/os: linux + beta.kubernetes.io/os: linux \ No newline at end of file diff --git a/sock-shop/components/user-db-svc.yaml b/sock-shop/components/user-db-svc.yaml index 3e36da6..ace9d1a 100644 --- a/sock-shop/components/user-db-svc.yaml +++ b/sock-shop/components/user-db-svc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: @@ -11,3 +12,4 @@ spec: targetPort: 27017 selector: name: user-db + diff --git a/sock-shop/components/user-deploy.yaml b/sock-shop/components/user-dep.yaml similarity index 57% rename from sock-shop/components/user-deploy.yaml rename to sock-shop/components/user-dep.yaml index 0b5cca3..228ad3e 100644 --- a/sock-shop/components/user-deploy.yaml +++ b/sock-shop/components/user-dep.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -17,6 +18,13 @@ spec: containers: - name: user image: weaveworksdemos/user:0.4.7 + resources: + limits: + cpu: 300m + memory: 100Mi + requests: + cpu: 100m + memory: 100Mi ports: - containerPort: 80 env: @@ -31,5 +39,17 @@ spec: add: - NET_BIND_SERVICE readOnlyRootFilesystem: true + livenessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 300 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /health + port: 80 + initialDelaySeconds: 180 + periodSeconds: 3 nodeSelector: - beta.kubernetes.io/os: linux \ No newline at end of file + beta.kubernetes.io/os: linux diff --git a/sock-shop/components/user-svc.yaml b/sock-shop/components/user-svc.yaml index 9bb1a5f..f01c118 100644 --- a/sock-shop/components/user-svc.yaml +++ b/sock-shop/components/user-svc.yaml @@ -1,10 +1,10 @@ +--- apiVersion: v1 kind: Service metadata: name: user labels: name: user - namespace: sock-shop spec: ports: # the port that this service should serve on @@ -12,3 +12,4 @@ spec: targetPort: 80 selector: name: user +