Added k8s stuffs
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-03-31 19:47:12 +02:00
parent 9010db211e
commit 90d34e9835
4 changed files with 71 additions and 0 deletions

15
k8s/configmap.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: input-service
labels:
app: input-service
namespace: birbnetes
data:
SENTRY_DSN: storage-service
RELEASE_ID: luna-k8s
RELEASEMODE: release
MINIO_ENDPOINT: minio-service:9000
MINIO_ACCESS_KEY: birbnetes-minio-access
MINIO_SECRET_KEY: birbnetes-supersecret
MINIO_BUCKET_NAME: birb_noises

27
k8s/deployment.yaml Normal file
View File

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: storage-service
namespace: birbnetes
labels:
app: storage-service
spec:
replicas: 1
selector:
matchLabels:
app: storage-service
strategy:
type: Recreate
template:
metadata:
labels:
app: storage-service
spec:
containers:
- image:
name: registry.kmlabz.com/tormakris/storage-service
envFrom:
- configMapRef:
name: storage-service
ports:
- containerPort: 8000

16
k8s/service.yaml Normal file
View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: storage-service
namespace: birbnetes
labels:
app: storage-service
spec:
ports:
- name: storage-service
port: 8000
targetPort: 8000
protocol: TCP
selector:
app: storage-service
type: ClusterIP

View File

@ -1,5 +1,7 @@
#!/usr/bin/env python3
import os
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from flask import Flask
from werkzeug.middleware.proxy_fix import ProxyFix
@ -9,6 +11,17 @@ from utils import register_all_error_handlers, storage
# import views
from views import ObjectView
# Setup sentry
SENTRY_DSN = os.environ.get("SENTRY_DSN")
if SENTRY_DSN:
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[FlaskIntegration()],
send_default_pii=True,
release=os.environ.get('RELEASE_ID', 'test'),
environment=os.environ.get('RELEASEMODE', 'dev')
)
# create flask app
app = Flask(__name__)
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1)