Merge pull request #23 from HideyoshiNakazone/adds-storage-service
Adds Storage Service
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,6 +6,8 @@
|
||||
|
||||
.vscode/
|
||||
|
||||
**/storage-secret.yaml
|
||||
|
||||
**/backend-secret.yaml
|
||||
|
||||
**/frontend-secret.yaml
|
||||
|
||||
@@ -44,6 +44,12 @@ function application_deploy() {
|
||||
deployment.apps/frontend-deployment \
|
||||
-n portfolio;
|
||||
|
||||
kubectl apply -f ./deployment/storage;
|
||||
kubectl wait --for=condition=available \
|
||||
--timeout=600s \
|
||||
deployment.apps/storage-deployment \
|
||||
-n portfolio;
|
||||
|
||||
kubectl apply -f ./deployment/backend;
|
||||
kubectl wait --for=condition=available \
|
||||
--timeout=600s \
|
||||
|
||||
@@ -155,6 +155,12 @@ spec:
|
||||
name: redis-secret
|
||||
key: redis-password
|
||||
|
||||
- name: STORAGE_SERVICE_PATH
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: storage-config
|
||||
key: storage_url
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
8
deployment/storage/storage-config.yaml
Normal file
8
deployment/storage/storage-config.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
namespace: portfolio
|
||||
name: storage-config
|
||||
data:
|
||||
storage_url: storage-service
|
||||
storage_port: "8000"
|
||||
102
deployment/storage/storage.yaml
Normal file
102
deployment/storage/storage.yaml
Normal file
@@ -0,0 +1,102 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
namespace: portfolio
|
||||
name: storage-deployment
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: storage
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: storage
|
||||
spec:
|
||||
containers:
|
||||
- name: storage
|
||||
image: yoshiunfriendly/storage-hideyoshi.com:latest
|
||||
imagePullPolicy: "Always"
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
env:
|
||||
- name: ALLOWED_ORIGINS
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: frontend-secret
|
||||
key: backend_url
|
||||
|
||||
- name: EXPIRES_IN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: backend-secret
|
||||
key: access_token_duration
|
||||
|
||||
- name: SERVER_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: storage-config
|
||||
key: storage_port
|
||||
|
||||
- name: REDIS_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: redis-config
|
||||
key: redis-url
|
||||
|
||||
- name: REDIS_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: redis-config
|
||||
key: redis-port
|
||||
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: redis-secret
|
||||
key: redis-password
|
||||
|
||||
- name: STORAGE_TYPE
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: storage-secret
|
||||
key: storage_type
|
||||
|
||||
- name: AWS_ACCESS_KEY_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: storage-secret
|
||||
key: aws_access_key_id
|
||||
|
||||
- name: AWS_SECRET_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: storage-secret
|
||||
key: aws_access_access_key
|
||||
|
||||
- name: AWS_REGION_NAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: storage-secret
|
||||
key: aws_region_name
|
||||
|
||||
- name: AWS_BUCKET_NAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: storage-secret
|
||||
key: aws_bucket_name
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
namespace: portfolio
|
||||
name: storage-service
|
||||
spec:
|
||||
selector:
|
||||
app: storage
|
||||
ports:
|
||||
- port: 8000
|
||||
protocol: TCP
|
||||
targetPort: 8000
|
||||
type: ClusterIP
|
||||
5
setup.py
5
setup.py
@@ -27,6 +27,11 @@ ENV_VARIABLES = [
|
||||
"POSTGRES_PASSWORD",
|
||||
"POSTGRES_DB",
|
||||
"REDIS_PASSWORD",
|
||||
"STORAGE_TYPE",
|
||||
"AWS_ACCESS_KEY_ID",
|
||||
"AWS_SECRET_ACCESS_KEY",
|
||||
"AWS_REGION_NAME",
|
||||
"AWS_BUCKET_NAME",
|
||||
]
|
||||
|
||||
|
||||
|
||||
12
template/storage/storage-secret.template.yaml
Normal file
12
template/storage/storage-secret.template.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
namespace: portfolio
|
||||
name: storage-secret
|
||||
type: Opaque
|
||||
data:
|
||||
storage_type: $STORAGE_TYPE
|
||||
aws_access_key_id: $AWS_ACCESS_KEY_ID
|
||||
aws_access_access_key: $AWS_SECRET_ACCESS_KEY
|
||||
aws_region_name: $AWS_REGION_NAME
|
||||
aws_bucket_name: $AWS_BUCKET_NAME
|
||||
Reference in New Issue
Block a user