Skip to content

Commit

Permalink
Add deployment files
Browse files Browse the repository at this point in the history
  • Loading branch information
srisco committed Jun 2, 2020
1 parent 36b01e3 commit f8b9f38
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 0 deletions.
60 changes: 60 additions & 0 deletions deploy/yaml/oscar-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: oscar
namespace: oscar
labels:
app: oscar
spec:
selector:
matchLabels:
app: oscar
replicas: 1
template:
metadata:
labels:
app: oscar
spec:
serviceAccountName: oscar-sa
containers:
- name: oscar
image: "srisco/oscar:2.0.0-preview"
imagePullPolicy: Always
securityContext:
readOnlyRootFilesystem: true
runAsUser: 10001
livenessProbe:
httpGet:
path: /health
port: 8080
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /health
port: 8080
timeoutSeconds: 5
env:
- name: OSCAR_USERNAME
value: admin
- name: OSCAR_PASSWORD
value: password
- name: MINIO_ACCESS_KEY
value: minio
- name: MINIO_SECRET_KEY
value:
- name: MINIO_TLS_VERIFY
value: "false"
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
requests:
cpu: 200m
memory: 256Mi
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
nodeSelector:
node-role.kubernetes.io/master: ''
16 changes: 16 additions & 0 deletions deploy/yaml/oscar-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
namespace: oscar
name: oscar
annotations:
#nginx.ingress.kubernetes.io/rewrite-target: /
kubernetes.io/ingress.class: nginx
spec:
rules:
- http:
paths:
- backend:
serviceName: oscar
servicePort: 8080
path: /
10 changes: 10 additions & 0 deletions deploy/yaml/oscar-namespaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

apiVersion: v1
kind: Namespace
metadata:
name: oscar
---
apiVersion: v1
kind: Namespace
metadata:
name: oscar-svc
52 changes: 52 additions & 0 deletions deploy/yaml/oscar-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: oscar-sa
namespace: oscar
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: oscar-controller
namespace: oscar-svc
rules:
- apiGroups:
- ""
resources:
- pods
- pods/log
- podtemplates
- configmaps
verbs:
- get
- list
- watch
- create
- delete
- update
- apiGroups:
- batch
resources:
- jobs
verbs:
- get
- list
- watch
- create
- delete
- deletecollection
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: oscar-controller-binding
namespace: oscar-svc
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: oscar-controller
subjects:
- kind: ServiceAccount
name: oscar-sa
namespace: oscar
13 changes: 13 additions & 0 deletions deploy/yaml/oscar-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: oscar
namespace: oscar
spec:
ports:
- name: endpoint
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: oscar
11 changes: 11 additions & 0 deletions deploy/yaml/oscar-volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: oscar-pvc
namespace: oscar-svc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
24 changes: 24 additions & 0 deletions deploy/yaml/populate-oscar-volume-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: batch/v1
kind: Job
metadata:
name: populate-volume-job
namespace: oscar-svc
spec:
template:
spec:
containers:
- name: download
image: busybox
command: ["/bin/sh", "-c"]
args: ["wget https://github.com/grycap/faas-supervisor/releases/download/1.2.4-beta1/supervisor -O /data/supervisor \
&& chmod +x /data/supervisor \
&& wget https://github.com/openfaas/faas/releases/download/0.18.10/fwatchdog -O /data/fwatchdog \
&& chmod +x /data/fwatchdog"]
volumeMounts:
- name: oscar-vol
mountPath: /data
restartPolicy: Never
volumes:
- name: oscar-vol
persistentVolumeClaim:
claimName: oscar-pvc

0 comments on commit f8b9f38

Please sign in to comment.