This commit is contained in:
		
							
								
								
									
										15
									
								
								k8s/configmap.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								k8s/configmap.yaml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										27
									
								
								k8s/deployment.yaml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										16
									
								
								k8s/service.yaml
									
									
									
									
									
										Normal 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
 | 
				
			||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
#!/usr/bin/env python3
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					import sentry_sdk
 | 
				
			||||||
 | 
					from sentry_sdk.integrations.flask import FlaskIntegration
 | 
				
			||||||
from flask import Flask
 | 
					from flask import Flask
 | 
				
			||||||
from werkzeug.middleware.proxy_fix import ProxyFix
 | 
					from werkzeug.middleware.proxy_fix import ProxyFix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -9,6 +11,17 @@ from utils import register_all_error_handlers, storage
 | 
				
			|||||||
# import views
 | 
					# import views
 | 
				
			||||||
from views import ObjectView
 | 
					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
 | 
					# create flask app
 | 
				
			||||||
app = Flask(__name__)
 | 
					app = Flask(__name__)
 | 
				
			||||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1)
 | 
					app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user