Commit aa73de15 authored by Jens Langhammer's avatar Jens Langhammer

add grpc deployment to helm

parent e0eb65f3
Pipeline #3873 failed with stage
in 1 minute and 28 seconds
......@@ -104,11 +104,11 @@ package-installer:
- /^version/.*$/
# Manual tasks
build-protos:
stage: manual
script:
- python -m grpc_tools.protoc -I=. --python_out=p2/grpc/ --grpc_python_out=p2/grpc/ protos/*
- protoc -I=. protos/*.proto --go_out=plugins=grpc:tier0/internal/
# - sed -i -E 's/^\(import.*_pb2\)/from . \1/' p2/grpc/protos/*.py
only:
- never
# build-protos:
# stage: manual
# script:
# - python -m grpc_tools.protoc -I=. --python_out=p2/grpc/ --grpc_python_out=p2/grpc/ protos/*
# - protoc -I=. protos/*.proto --go_out=plugins=grpc:tier0/internal/
# # - sed -i -E 's/^\(import.*_pb2\)/from . \1/' p2/grpc/protos/*.py
# only:
# - never
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ include "p2.fullname" . }}-grpc
labels:
app.kubernetes.io/name: {{ include "p2.name" . }}
helm.sh/chart: {{ include "p2.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.deployment.grpcInstances }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "p2.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "p2.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
k8s.p2.io/component: grpc
spec:
securityContext:
fsGroup: 100
volumes:
- name: config-volume
configMap:
name: {{ include "p2.fullname" . }}-config
- name: media-storage
persistentVolumeClaim:
claimName: {{ include "p2.fullname" . }}-pvc-app-storage
containers:
- name: {{ .Chart.Name }}
image: "docker.beryju.org/p2/server:{{ .Values.image.tag }}"
imagePullPolicy: IfNotPresent
command: ["/bin/sh","-c"]
args: ["./manage.py migrate && ./manage.py grpc"]
ports:
- name: grpc
containerPort: 50051
protocol: TCP
volumeMounts:
- mountPath: /etc/p2
name: config-volume
- mountPath: /storage
name: media-storage
resources:
requests:
cpu: 50m
memory: 100M
limits:
cpu: 100m
memory: 200M
apiVersion: v1
kind: Service
metadata:
name: {{ include "p2.fullname" . }}-grpc
labels:
app.kubernetes.io/name: {{ include "p2.name" . }}
helm.sh/chart: {{ include "p2.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
k8s.p2.io/component: grpc
spec:
type: ClusterIP
ports:
- port: 50051
targetPort: grpc
protocol: TCP
name: grpc
selector:
app.kubernetes.io/name: {{ include "p2.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
k8s.p2.io/component: grpc
......@@ -21,6 +21,7 @@ deployment:
webInstances: 2
workerInstances: 1
tier0Instances: 2
grpcInstances: 1
postgresql:
postgresqlUsername: p2
......
......@@ -28,7 +28,7 @@ def serve_forever():
)
reflection.enable_server_reflection(service_names, server)
server.add_insecure_port('127.0.0.1:50051')
server.add_insecure_port('[::]:50051')
server.start()
LOGGER.debug('Successfully started grpc server on port 50051')
while True:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment