Browse Source

Add sock shop app

pull/2/head
Jesse Suen 6 years ago
parent
commit
49723157a6
No known key found for this signature in database GPG Key ID: 90C911E8A6106562
  1. 4
      sock-shop/.gitignore
  2. 11
      sock-shop/app.yaml
  3. 40
      sock-shop/components/carts-db-deploy.yaml
  4. 13
      sock-shop/components/carts-db-svc.yaml
  5. 44
      sock-shop/components/carts-deploy.yaml
  6. 13
      sock-shop/components/carts-svc.yaml
  7. 29
      sock-shop/components/catalogue-db-deploy.yaml
  8. 13
      sock-shop/components/catalogue-db-svc.yaml
  9. 32
      sock-shop/components/catalogue-deploy.yaml
  10. 13
      sock-shop/components/catalogue-svc.yaml
  11. 32
      sock-shop/components/front-end-deploy.yaml
  12. 14
      sock-shop/components/front-end-svc.yaml
  13. 40
      sock-shop/components/orders-db-deploy.yaml
  14. 13
      sock-shop/components/orders-db-svc.yaml
  15. 44
      sock-shop/components/orders-deploy.yaml
  16. 13
      sock-shop/components/orders-svc.yaml
  17. 36
      sock-shop/components/params.libsonnet
  18. 33
      sock-shop/components/payment-deploy.yaml
  19. 13
      sock-shop/components/payment-svc.yaml
  20. 23
      sock-shop/components/queue-master-deploy.yaml
  21. 15
      sock-shop/components/queue-master-svc.yaml
  22. 33
      sock-shop/components/rabbitmq-deploy.yaml
  23. 13
      sock-shop/components/rabbitmq-svc.yaml
  24. 44
      sock-shop/components/shipping-deploy.yaml
  25. 13
      sock-shop/components/shipping-svc.yaml
  26. 40
      sock-shop/components/user-db-deploy.yaml
  27. 13
      sock-shop/components/user-db-svc.yaml
  28. 35
      sock-shop/components/user-deploy.yaml
  29. 14
      sock-shop/components/user-svc.yaml
  30. 4
      sock-shop/environments/base.libsonnet
  31. 2
      sock-shop/environments/default/globals.libsonnet
  32. 8
      sock-shop/environments/default/main.jsonnet
  33. 17
      sock-shop/environments/default/params.libsonnet

4
sock-shop/.gitignore

@ -0,0 +1,4 @@
/lib
/.ksonnet/registries
/app.override.yaml
/.ks_environment

11
sock-shop/app.yaml

@ -0,0 +1,11 @@
apiVersion: 0.1.0
environments:
default:
destination:
namespace: default
server: https://kubernetes.default.svc
k8sVersion: v1.10.0
path: default
kind: ksonnet.io/app
name: sock-shop
version: 0.0.1

40
sock-shop/components/carts-db-deploy.yaml

@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: carts-db
labels:
name: carts-db
spec:
replicas: 1
selector:
matchLabels:
name: carts-db
template:
metadata:
labels:
name: carts-db
spec:
containers:
- name: carts-db
image: mongo
ports:
- name: mongo
containerPort: 27017
securityContext:
capabilities:
drop:
- all
add:
- CHOWN
- SETGID
- SETUID
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/carts-db-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: carts-db
labels:
name: carts-db
spec:
ports:
# the port that this service should serve on
- port: 27017
targetPort: 27017
selector:
name: carts-db

44
sock-shop/components/carts-deploy.yaml

@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: carts
labels:
name: carts
spec:
replicas: 1
selector:
matchLabels:
name: carts
template:
metadata:
labels:
name: carts
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
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/carts-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: carts
labels:
name: carts
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: carts

29
sock-shop/components/catalogue-db-deploy.yaml

@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: catalogue-db
labels:
name: catalogue-db
spec:
replicas: 1
selector:
matchLabels:
name: catalogue-db
template:
metadata:
labels:
name: catalogue-db
spec:
containers:
- name: catalogue-db
image: weaveworksdemos/catalogue-db:0.3.0
env:
- name: MYSQL_ROOT_PASSWORD
value: fake_password
- name: MYSQL_DATABASE
value: socksdb
ports:
- name: mysql
containerPort: 3306
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/catalogue-db-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: catalogue-db
labels:
name: catalogue-db
spec:
ports:
# the port that this service should serve on
- port: 3306
targetPort: 3306
selector:
name: catalogue-db

32
sock-shop/components/catalogue-deploy.yaml

@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: catalogue
labels:
name: catalogue
spec:
replicas: 1
selector:
matchLabels:
name: catalogue
template:
metadata:
labels:
name: catalogue
spec:
containers:
- name: catalogue
image: weaveworksdemos/catalogue:0.3.5
ports:
- containerPort: 80
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/catalogue-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: catalogue
labels:
name: catalogue
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: catalogue

32
sock-shop/components/front-end-deploy.yaml

@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: front-end
spec:
replicas: 1
selector:
matchLabels:
name: front-end
template:
metadata:
labels:
name: front-end
spec:
containers:
- name: front-end
image: weaveworksdemos/front-end:0.3.12
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 8079
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux

14
sock-shop/components/front-end-svc.yaml

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: front-end
labels:
name: front-end
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8079
nodePort: 30001
selector:
name: front-end

40
sock-shop/components/orders-db-deploy.yaml

@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: orders-db
labels:
name: orders-db
spec:
replicas: 1
selector:
matchLabels:
name: orders-db
template:
metadata:
labels:
name: orders-db
spec:
containers:
- name: orders-db
image: mongo
ports:
- name: mongo
containerPort: 27017
securityContext:
capabilities:
drop:
- all
add:
- CHOWN
- SETGID
- SETUID
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/orders-db-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: orders-db
labels:
name: orders-db
spec:
ports:
# the port that this service should serve on
- port: 27017
targetPort: 27017
selector:
name: orders-db

44
sock-shop/components/orders-deploy.yaml

@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: orders
labels:
name: orders
spec:
replicas: 1
selector:
matchLabels:
name: orders
template:
metadata:
labels:
name: orders
spec:
containers:
- name: orders
image: weaveworksdemos/orders:0.4.7
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
ports:
- containerPort: 80
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/orders-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: orders
labels:
name: orders
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: orders

36
sock-shop/components/params.libsonnet

@ -0,0 +1,36 @@
{
global: {
// User-defined global parameters; accessible to all component and environments, Ex:
// replicas: 4,
},
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-svc": {},
"carts-deploy": {},
"carts-svc": {},
"catalogue-db-deploy": {},
"catalogue-db-svc": {},
"catalogue-deploy": {},
"catalogue-svc": {},
"front-end-deploy": {},
"front-end-svc": {},
"orders-db-deploy": {},
"orders-db-svc": {},
"orders-deploy": {},
"orders-svc": {},
"payment-deploy": {},
"payment-svc": {},
"queue-master-deploy": {},
"queue-master-svc": {},
"rabbitmq-deploy": {},
"rabbitmq-svc": {},
"shipping-deploy": {},
"shipping-svc": {},
"user-db-deploy": {},
"user-db-svc": {},
"user-deploy": {},
"user-svc": {},
},
}

33
sock-shop/components/payment-deploy.yaml

@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: payment
labels:
name: payment
spec:
replicas: 1
selector:
matchLabels:
name: payment
template:
metadata:
labels:
name: payment
spec:
containers:
- name: payment
image: weaveworksdemos/payment:0.4.3
ports:
- containerPort: 80
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/payment-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: payment
labels:
name: payment
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: payment

23
sock-shop/components/queue-master-deploy.yaml

@ -0,0 +1,23 @@
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

15
sock-shop/components/queue-master-svc.yaml

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: queue-master
labels:
name: queue-master
annotations:
prometheus.io/path: "/prometheus"
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: queue-master

33
sock-shop/components/rabbitmq-deploy.yaml

@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq
labels:
name: rabbitmq
spec:
replicas: 1
selector:
matchLabels:
name: rabbitmq
template:
metadata:
labels:
name: rabbitmq
spec:
containers:
- name: rabbitmq
image: rabbitmq:3.6.8
ports:
- containerPort: 5672
securityContext:
capabilities:
drop:
- all
add:
- CHOWN
- SETGID
- SETUID
- DAC_OVERRIDE
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/rabbitmq-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
labels:
name: rabbitmq
spec:
ports:
# the port that this service should serve on
- port: 5672
targetPort: 5672
selector:
name: rabbitmq

44
sock-shop/components/shipping-deploy.yaml

@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: shipping
labels:
name: shipping
spec:
replicas: 1
selector:
matchLabels:
name: shipping
template:
metadata:
labels:
name: shipping
spec:
containers:
- name: shipping
image: weaveworksdemos/shipping:0.4.8
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
ports:
- containerPort: 80
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/shipping-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: shipping
labels:
name: shipping
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: shipping

40
sock-shop/components/user-db-deploy.yaml

@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: user-db
labels:
name: user-db
spec:
replicas: 1
selector:
matchLabels:
name: user-db
template:
metadata:
labels:
name: user-db
spec:
containers:
- name: user-db
image: weaveworksdemos/user-db:0.4.0
ports:
- name: mongo
containerPort: 27017
securityContext:
capabilities:
drop:
- all
add:
- CHOWN
- SETGID
- SETUID
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux

13
sock-shop/components/user-db-svc.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: user-db
labels:
name: user-db
spec:
ports:
# the port that this service should serve on
- port: 27017
targetPort: 27017
selector:
name: user-db

35
sock-shop/components/user-deploy.yaml

@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: user
labels:
name: user
spec:
replicas: 1
selector:
matchLabels:
name: user
template:
metadata:
labels:
name: user
spec:
containers:
- name: user
image: weaveworksdemos/user:0.4.7
ports:
- containerPort: 80
env:
- name: MONGO_HOST
value: user-db:27017
securityContext:
runAsNonRoot: true
runAsUser: 10001
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux

14
sock-shop/components/user-svc.yaml

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: user
labels:
name: user
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
name: user

4
sock-shop/environments/base.libsonnet

@ -0,0 +1,4 @@
local components = std.extVar("__ksonnet/components");
components + {
// Insert user-specified overrides here.
}

2
sock-shop/environments/default/globals.libsonnet

@ -0,0 +1,2 @@
{
}

8
sock-shop/environments/default/main.jsonnet

@ -0,0 +1,8 @@
local base = import "base.libsonnet";
// uncomment if you reference ksonnet-lib
// local k = import "k.libsonnet";
base + {
// Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n")
// "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"})
}

17
sock-shop/environments/default/params.libsonnet

@ -0,0 +1,17 @@
local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet";
local envParams = params + {
components +: {
// Insert component parameter overrides here. Ex:
// guestbook +: {
// name: "guestbook-dev",
// replicas: params.global.replicas,
// },
},
};
{
components: {
[x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components)
},
}
Loading…
Cancel
Save