Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit d268676

Browse files
authored
Refactor/bg 2 ingress - DO NOT MERGE (#139)
* temp commit * Add B/G support to poi chart * Fix ingress metadata.name * Add b/g for trips chart * Add B/G to user java api * add B/G to user profile api * Update chart values that should be set in helm upgrade/install * Update changelog * Remove rolling update and maxUnavailable settings in charts. * adding in liveness proves to all charts
1 parent b023556 commit d268676

29 files changed

Lines changed: 651 additions & 103 deletions

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
## [project-title] Changelog
22

3-
<a name="x.y.z"></a>
4-
# x.y.z (yyyy-mm-dd)
3+
<a name="1.1.0"></a>
4+
1.1.0 (04/02/2019)
55

66
*Features*
7-
* ...
7+
- Refactored Blue/Green support in api charts
8+
- Clean up chart parameters
9+
- Change charts to use packages
10+
- Remove Proctor monitoring infrastructure and replace with Bash Curl/PowerShell scripts
811

912
*Bug Fixes*
1013
* ...

apis/poi/charts/mydrive-poi/templates/deployment.yaml renamed to apis/poi/charts/mydrive-poi/templates/deployment.blue.yaml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
1+
{{ if .Values.blue.enabled }}
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
4-
name: "{{ .Values.image.name }}-deploy"
5+
name: "{{ .Values.image.name }}-deploy-blue"
56
labels:
67
deploy: {{ .Values.image.label }}
78
spec:
89
replicas: {{ .Values.replicaCount }}
9-
# strategy:
10-
# type: RollingUpdate
11-
# rollingUpdate:
12-
# maxUnavailable: 0
1310
selector:
1411
matchLabels:
1512
app: {{ .Values.image.label }}
1613
template:
1714
metadata:
1815
labels:
1916
app: {{ .Values.image.label }}
17+
slot: blue
2018
spec:
2119
containers:
22-
- image: "{{ .Values.repository.image }}:{{ .Values.repository.tag }}"
20+
- image: "{{ .Values.repository.image }}:{{ .Values.blue.tag }}"
2321
imagePullPolicy: {{ .Values.repository.pullPolicy }}
2422
name: {{ .Values.image.name }}
25-
# livenessProbe:
26-
# httpGet:
27-
# path: /api/healthcheck/poi
28-
# port: {{ .Values.image.containerPort }}
29-
# initialDelaySeconds: 10
30-
# periodSeconds: 30
31-
# readinessProbe:
32-
# httpGet:
33-
# path: /api/healthcheck/poi
34-
# port: {{ .Values.image.containerPort }}
35-
# initialDelaySeconds: 5
36-
# periodSeconds: 5
23+
livenessProbe:
24+
httpGet:
25+
path: /api/healthcheck/poi
26+
port: {{ .Values.image.containerPort }}
27+
initialDelaySeconds: 10
28+
periodSeconds: 30
29+
readinessProbe:
30+
httpGet:
31+
path: /api/healthcheck/poi
32+
port: {{ .Values.image.containerPort }}
33+
initialDelaySeconds: 5
34+
periodSeconds: 5
3735
ports:
3836
- containerPort: {{ .Values.image.containerPort }}
3937
name: http
@@ -67,4 +65,5 @@ spec:
6765
- name: WEB_PORT
6866
value: '8080'
6967
- name: ASPNETCORE_ENVIRONMENT
70-
value: 'Production'
68+
value: 'Production'
69+
{{ end }}

apis/user-java/charts/mydrive-user-java/templates/deployment.yaml renamed to apis/poi/charts/mydrive-poi/templates/deployment.green.yaml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,37 @@
1+
{{ if .Values.green.enabled }}
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
4-
name: "{{ .Values.image.name }}-deploy"
5+
name: "{{ .Values.image.name }}-deploy-green"
56
labels:
67
deploy: {{ .Values.image.label }}
78
spec:
89
replicas: {{ .Values.replicaCount }}
9-
# strategy:
10-
# type: RollingUpdate
11-
# rollingUpdate:
12-
# maxUnavailable: 0
1310
selector:
1411
matchLabels:
1512
app: {{ .Values.image.label }}
1613
template:
1714
metadata:
1815
labels:
1916
app: {{ .Values.image.label }}
17+
slot: green
2018
spec:
2119
containers:
22-
- image: "{{ .Values.repository.image }}:{{ .Values.repository.tag }}"
20+
- image: "{{ .Values.repository.image }}:{{ .Values.green.tag }}"
2321
imagePullPolicy: {{ .Values.repository.pullPolicy }}
2422
name: {{ .Values.image.name }}
25-
# livenessProbe:
26-
# httpGet:
27-
# path: /api/healthcheck/user-java
28-
# port: {{ .Values.image.containerPort }}
29-
# httpHeaders:
30-
# - name: Accept
31-
# value: application/json
32-
# initialDelaySeconds: 10
33-
# periodSeconds: 30
34-
# readinessProbe:
35-
# httpGet:
36-
# path: /api/healthcheck/user-java
37-
# port: {{ .Values.image.containerPort }}
38-
# httpHeaders:
39-
# - name: Accept
40-
# value: application/json
41-
# initialDelaySeconds: 5
42-
# periodSeconds: 5
23+
livenessProbe:
24+
httpGet:
25+
path: /api/healthcheck/poi
26+
port: {{ .Values.image.containerPort }}
27+
initialDelaySeconds: 10
28+
periodSeconds: 30
29+
readinessProbe:
30+
httpGet:
31+
path: /api/healthcheck/poi
32+
port: {{ .Values.image.containerPort }}
33+
initialDelaySeconds: 5
34+
periodSeconds: 5
4335
ports:
4436
- containerPort: {{ .Values.image.containerPort }}
4537
name: http
@@ -68,3 +60,10 @@ spec:
6860
secretKeyRef:
6961
name: sql
7062
key: sql_dbname
63+
- name: WEB_SERVER_BASE_URI
64+
value: 'http://0.0.0.0'
65+
- name: WEB_PORT
66+
value: '8080'
67+
- name: ASPNETCORE_ENVIRONMENT
68+
value: 'Production'
69+
{{ end }}

apis/poi/charts/mydrive-poi/templates/ingress.yaml renamed to apis/poi/charts/mydrive-poi/templates/ingress.prod.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
apiVersion: extensions/v1beta1
66
kind: Ingress
77
metadata:
8-
name: {{ template "chart.fullname" . }}
8+
name: {{ template "chart.fullname" . }}-prod
99
labels:
1010
app: {{ template "chart.name" . }}
1111
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
@@ -24,7 +24,7 @@ spec:
2424
{{- range $path := .paths }}
2525
- path: {{ $path.path }}
2626
backend:
27-
serviceName: {{ $path.serviceName }}
27+
serviceName: {{ $path.serviceName }}-prod
2828
servicePort: {{ $path.servicePort }}
2929
{{- end -}}
3030
{{- end -}}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $serviceName := include "chart.fullname" . -}}
3+
{{- $servicePort := .Values.service.externalPort -}}
4+
{{- $path := .Values.ingress.path -}}
5+
apiVersion: extensions/v1beta1
6+
kind: Ingress
7+
metadata:
8+
name: {{ template "chart.fullname" . }}-stage
9+
labels:
10+
app: {{ template "chart.name" . }}
11+
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
12+
release: {{ .Release.Name }}
13+
heritage: {{ .Release.Service }}
14+
annotations:
15+
{{- range $key, $value := .Values.ingress.annotations }}
16+
{{ $key }}: {{ $value | quote }}
17+
{{- end }}
18+
spec:
19+
rules:
20+
{{- range $key, $value := .Values.ingress.rules }}
21+
- host: stage{{ $value.host }}
22+
http:
23+
paths:
24+
{{- range $path := .paths }}
25+
- path: {{ $path.path }}
26+
backend:
27+
serviceName: {{ $path.serviceName }}-stage
28+
servicePort: {{ $path.servicePort }}
29+
{{- end -}}
30+
{{- end -}}
31+
{{- if .Values.ingress.tls }}
32+
tls:
33+
{{ toYaml .Values.ingress.tls | indent 4 }}
34+
{{- end -}}
35+
{{- end -}}

apis/poi/charts/mydrive-poi/templates/service.yaml renamed to apis/poi/charts/mydrive-poi/templates/service.prod.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4-
name: 'api-poi-svc'
4+
name: 'api-poi-svc-prod'
55
spec:
66
type: ClusterIP
77
selector:
88
app: {{ .Values.image.label }}
9+
slot: {{ .Values.productionSlot }}
910
ports:
1011
- protocol: TCP
1112
name: {{ .Values.image.name }}http
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: 'api-poi-svc-stage'
5+
spec:
6+
type: ClusterIP
7+
selector:
8+
app: {{ .Values.image.label }}
9+
{{- if eq .Values.productionSlot "blue" }}
10+
slot: green
11+
{{- else }}
12+
slot: blue
13+
{{- end }}
14+
ports:
15+
- protocol: TCP
16+
name: {{ .Values.image.name }}http
17+
port: {{ .Values.service.externalPort }}
18+
targetPort: {{ .Values.image.containerPort }}
19+
- protocol: TCP
20+
name: {{ .Values.image.name }}https
21+
port: 443
22+
targetPort: 443

apis/poi/charts/mydrive-poi/values.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
# Default values for helmv2.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
4+
productionSlot: blue
5+
blue:
6+
enabled: true
7+
tag: latest
8+
9+
green:
10+
enabled: false
11+
tag: latest
412

513
replicaCount: 2
614
repository:
7-
image: acrreplace.azurecr.io/devopsoh/imagereplace
15+
# Fully qualified path to image in ACR (Ex. youracr.azureacr.io/devopsoh/poi-build).
16+
# See deployment scripts in https://github.com/Azure-Samples/openhack-devops-proctor for example usage.
17+
image:
818
tag: latest
919
pullPolicy: Always
1020
image:
@@ -19,7 +29,8 @@ ingress:
1929
kubernetes.io/ingress.class: traefik
2030
rules:
2131
endpoint:
22-
host: changeme
32+
#fqdn of your exposed application (found in ohteamvalues file)
33+
host:
2334
paths:
2435
- path: /api/poi
2536
serviceName: api-poi-svc
@@ -32,7 +43,7 @@ ingress:
3243
servicePort: 80
3344
- path: /swagger/docs/poi
3445
serviceName: api-poi-svc
35-
servicePort: 80
46+
servicePort: 80
3647
tls: []
3748
# - secretName: chart-example-tls
3849
# hosts:

apis/trips/charts/mydrive-trips/templates/deployment.yaml renamed to apis/trips/charts/mydrive-trips/templates/deployment.blue.yaml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
1+
{{- if .Values.ingress.enabled -}}
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
4-
name: "{{ .Values.image.name }}-deploy"
5+
name: "{{ .Values.image.name }}-deploy-blue"
56
labels:
67
deploy: {{ .Values.image.label }}
78
spec:
89
replicas: {{ .Values.replicaCount }}
9-
# strategy:
10-
# type: RollingUpdate
11-
# rollingUpdate:
12-
# maxUnavailable: 0
1310
selector:
1411
matchLabels:
1512
app: {{ .Values.image.label }}
1613
template:
1714
metadata:
1815
labels:
1916
app: {{ .Values.image.label }}
17+
slot: blue
2018
spec:
2119
containers:
22-
- image: "{{ .Values.repository.image }}:{{ .Values.repository.tag }}"
20+
- image: "{{ .Values.repository.image }}:{{ .Values.blue.tag }}"
2321
imagePullPolicy: {{ .Values.repository.pullPolicy }}
2422
name: {{ .Values.image.name }}
25-
# livenessProbe:
26-
# httpGet:
27-
# path: /api/healthcheck/trips
28-
# port: {{ .Values.image.containerPort }}
29-
# initialDelaySeconds: 10
30-
# periodSeconds: 30
31-
# readinessProbe:
32-
# httpGet:
33-
# path: /api/healthcheck/trips
34-
# port: {{ .Values.image.containerPort }}
35-
# initialDelaySeconds: 5
36-
# periodSeconds: 5
23+
livenessProbe:
24+
httpGet:
25+
path: /api/healthcheck/trips
26+
port: {{ .Values.image.containerPort }}
27+
initialDelaySeconds: 10
28+
periodSeconds: 30
29+
readinessProbe:
30+
httpGet:
31+
path: /api/healthcheck/trips
32+
port: {{ .Values.image.containerPort }}
33+
initialDelaySeconds: 5
34+
periodSeconds: 5
3735
ports:
3836
- containerPort: {{ .Values.image.containerPort }}
3937
name: http
@@ -70,3 +68,4 @@ spec:
7068
value: {{ .Values.env.webServerBaseUri }}
7169
- name: DEBUG_LOGGING
7270
value: 'true'
71+
{{ end }}

0 commit comments

Comments
 (0)