-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from vany0114/gke
GKE
- Loading branch information
Showing
41 changed files
with
768 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-ef": { | ||
"version": "3.1.2", | ||
"commands": [ | ||
"dotnet-ef" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: default-ingress | ||
annotations: | ||
kubernetes.io/ingress.class: "nginx" | ||
nginx.ingress.kubernetes.io/rewrite-target: /$1 | ||
spec: | ||
rules: | ||
- http: | ||
paths: | ||
- backend: | ||
serviceName: trip | ||
servicePort: 80 | ||
path: /services/trip/(.*) | ||
- backend: | ||
serviceName: invoice | ||
servicePort: 80 | ||
path: /services/invoice/(.*) | ||
- backend: | ||
serviceName: frontend | ||
servicePort: 80 | ||
path: /(.*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# configmap | ||
kubectl delete cm env-config | ||
|
||
# common ingress | ||
kubectl delete ing default-ingress | ||
|
||
# invoice | ||
kubectl delete deploy invoice | ||
kubectl delete svc invoice | ||
kubectl delete hpa invoice | ||
|
||
# trip | ||
kubectl delete deploy trip | ||
kubectl delete hpa trip | ||
kubectl delete svc trip | ||
|
||
# website | ||
kubectl delete deploy frontend | ||
kubectl delete hpa frontend | ||
kubectl delete svc frontend | ||
|
||
#notificatiosn | ||
kubectl delete deploy notifications | ||
kubectl delete hpa notifications | ||
kubectl delete ing notifications | ||
kubectl delete svc notifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# configmap | ||
kubectl apply -f env-config.yaml | ||
|
||
# common ingress | ||
kubectl apply -f default-ingress.yaml | ||
|
||
# invoice | ||
kubectl apply -f invoice\invoice-deployment.yaml | ||
kubectl apply -f invoice\invoice-service.yaml | ||
kubectl apply -f invoice\invoice-hpa.yaml | ||
|
||
# trip | ||
kubectl apply -f trip\trip-deployment.yaml | ||
kubectl apply -f trip\trip-hpa.yaml | ||
kubectl apply -f trip\trip-service.yaml | ||
|
||
# website | ||
kubectl apply -f website\website-deployment.yaml | ||
kubectl apply -f website\website-hpa.yaml | ||
kubectl apply -f website\website-service.yaml | ||
|
||
#notificatiosn | ||
kubectl apply -f notifications\notifications-deployment.yaml | ||
kubectl apply -f notifications\notifications-hpa.yaml | ||
kubectl apply -f notifications\notifications-ingress.yaml | ||
kubectl apply -f notifications\notifications-service.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: env-config | ||
data: | ||
ASPNETCORE_ENVIRONMENT: Production | ||
ConnectionStrings__InvoiceDB: {your invoice db connection string} | ||
ConnectionStrings__WebsiteDB: {your website db connection string} | ||
ConnectionStrings__SignalrBackPlane: {your redis connection string} | ||
EventStoreConfiguration__ConnectionString: {your mongo db connection string} | ||
EventBusConnection: {your service bus connection string} | ||
EventBusUserName: {your rabbitmq user} | ||
EventBusPassword: {your rabbitmq password} | ||
PaymentServiceBaseUrl: {your payment service url} | ||
InvoiceApiSettings__BaseUrl: http://invoice | ||
TripApiSettings__BaseUrl: http://trip | ||
TripApiSettings__NotificationsClientUrl: http://{your load balancer ip}/notifications | ||
TripApiSettings__NotificationsServerUrl: http://notifications | ||
AzureServiceBusEnabled: "false" | ||
IsDeployedOnCluster: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: invoice | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: invoice | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: invoice | ||
spec: | ||
containers: | ||
- name: invoice | ||
image: vany0114/duber.invoice.api | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
memory: "128Mi" | ||
cpu: "100m" | ||
limits: | ||
memory: "256Mi" | ||
cpu: "500m" | ||
envFrom: | ||
- configMapRef: | ||
name: env-config | ||
env: | ||
- name: ReverseProxyPrefix | ||
value: "services/invoice" | ||
livenessProbe: | ||
httpGet: | ||
port: 80 | ||
path: /liveness | ||
initialDelaySeconds: 10 | ||
periodSeconds: 10 | ||
readinessProbe: | ||
httpGet: | ||
path: /readiness | ||
port: 80 | ||
initialDelaySeconds: 30 | ||
periodSeconds: 60 | ||
timeoutSeconds: 5 | ||
ports: | ||
- containerPort: 80 | ||
- name: cloudsql-proxy | ||
image: gcr.io/cloudsql-docker/gce-proxy:1.16 | ||
command: ["/cloud_sql_proxy", | ||
"-instances=<replace for your GC instance SQL name>=tcp:3306", | ||
"-credential_file=/secrets/cloudsql/creadentials.json"] | ||
securityContext: | ||
runAsUser: 2 # non-root user | ||
allowPrivilegeEscalation: false | ||
volumeMounts: | ||
- name: cloudsql-instance-credentials | ||
mountPath: /secrets/cloudsql | ||
readOnly: true | ||
volumes: | ||
- name: cloudsql-instance-credentials | ||
secret: | ||
secretName: cloudsql-instance-credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: invoice | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: invoice | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: invoice | ||
spec: | ||
containers: | ||
- name: invoice | ||
image: vany0114/duber.invoice.api | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
memory: "128Mi" | ||
cpu: "100m" | ||
limits: | ||
memory: "256Mi" | ||
cpu: "500m" | ||
envFrom: | ||
- configMapRef: | ||
name: env-config | ||
env: | ||
- name: ReverseProxyPrefix | ||
value: "services/invoice" | ||
livenessProbe: | ||
httpGet: | ||
port: 80 | ||
path: /liveness | ||
initialDelaySeconds: 10 | ||
periodSeconds: 10 | ||
readinessProbe: | ||
httpGet: | ||
path: /readiness | ||
port: 80 | ||
initialDelaySeconds: 30 | ||
periodSeconds: 60 | ||
timeoutSeconds: 5 | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: autoscaling/v1 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: invoice | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: invoice | ||
minReplicas: 2 | ||
maxReplicas: 4 | ||
targetCPUUtilizationPercentage: 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: invoice | ||
spec: | ||
selector: | ||
app: invoice | ||
ports: | ||
- name: http | ||
protocol: TCP | ||
port: 80 | ||
targetPort: 80 |
43 changes: 43 additions & 0 deletions
43
deploy/k8s/gke/notifications/notifications-deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: notifications | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: notifications | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: notifications | ||
spec: | ||
containers: | ||
- name: notifications | ||
image: vany0114/duber.trip.notifications | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
memory: "128Mi" | ||
cpu: "200m" | ||
limits: | ||
memory: "256Mi" | ||
cpu: "600m" | ||
envFrom: | ||
- configMapRef: | ||
name: env-config | ||
livenessProbe: | ||
httpGet: | ||
port: 80 | ||
path: /liveness | ||
initialDelaySeconds: 10 | ||
periodSeconds: 10 | ||
readinessProbe: | ||
httpGet: | ||
path: /readiness | ||
port: 80 | ||
initialDelaySeconds: 30 | ||
periodSeconds: 60 | ||
timeoutSeconds: 5 | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: autoscaling/v1 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: notifications | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: notifications | ||
minReplicas: 4 | ||
maxReplicas: 5 | ||
targetCPUUtilizationPercentage: 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: notifications | ||
annotations: | ||
kubernetes.io/ingress.class: "nginx" | ||
nginx.ingress.kubernetes.io/affinity: cookie | ||
nginx.ingress.kubernetes.io/session-cookie-path: /notifications/ | ||
nginx.ingress.kubernetes.io/rewrite-target: /$1 | ||
spec: | ||
rules: | ||
- http: | ||
paths: | ||
- backend: | ||
serviceName: notifications | ||
servicePort: 80 | ||
path: /notifications/(.*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: notifications | ||
spec: | ||
selector: | ||
app: notifications | ||
ports: | ||
- name: http | ||
protocol: TCP | ||
port: 80 | ||
targetPort: 80 |
Oops, something went wrong.