File tree Expand file tree Collapse file tree 9 files changed +241
-2
lines changed Expand file tree Collapse file tree 9 files changed +241
-2
lines changed Original file line number Diff line number Diff line change 1
1
IMAGE_PREFIX := foly/microcalc
2
2
SERVICES := add sub mult div neg mod pow parser
3
3
4
- .PHONY : all build push clean
4
+ .PHONY : all build push clean helm helm-clean
5
5
all : build
6
6
7
7
build :
@@ -23,4 +23,14 @@ clean:
23
23
@make $(addprefix clean-, $(SERVICES ) )
24
24
25
25
clean-% :
26
- @docker rmi " ${IMAGE_PREFIX} -$* " || true
26
+ @docker rmi " ${IMAGE_PREFIX} -$* " || true
27
+
28
+ helm :
29
+ @mkdir -p helm/dist
30
+ @helm serve --repo-path helm/dist &
31
+ @helm package -d helm/dist helm/microcalc
32
+ @helm repo index helm/dist
33
+
34
+ helm-clean :
35
+ @pkill helm
36
+ @rm -rf helm/dist
Original file line number Diff line number Diff line change
1
+ /dist /
Original file line number Diff line number Diff line change
1
+ # Patterns to ignore when building packages.
2
+ # This supports shell glob matching, relative path matching, and
3
+ # negation (prefixed with !). Only one pattern per line.
4
+ .DS_Store
5
+ # Common VCS dirs
6
+ .git/
7
+ .gitignore
8
+ .bzr/
9
+ .bzrignore
10
+ .hg/
11
+ .hgignore
12
+ .svn/
13
+ # Common backup files
14
+ *.swp
15
+ *.bak
16
+ *.tmp
17
+ *~
18
+ # Various IDEs
19
+ .project
20
+ .idea/
21
+ *.tmproj
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ appVersion : " 1.0"
3
+ description : A Helm chart for microcalc application
4
+ name : microcalc
5
+ version : 0.1.0
Original file line number Diff line number Diff line change
1
+ 1. Get the application URL by running these commands:
2
+ {{- if .Values.istioGateway.enabled }}
3
+ {{- range .Values.istioGateway.hosts }}
4
+ http://{{ . }}
5
+ {{- end }}
6
+ {{- else }}
7
+ export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app=microcalc-parser,release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
8
+ echo "Visit http://127.0.0.1:8080 to use your application"
9
+ kubectl port-forward $POD_NAME 8080:8080
10
+ {{- end }}
Original file line number Diff line number Diff line change
1
+ {{- range .Values.opServices }}
2
+ apiVersion : apps/v1
3
+ kind : Deployment
4
+ metadata :
5
+ name : {{ .name }}
6
+ labels :
7
+ app : microcalc-{{ .name }}
8
+ chart : microcalc
9
+ release : {{ $.Release.Name }}
10
+ heritage : {{ $.Release.Service }}
11
+ spec :
12
+ replicas : {{ .replicaCount | default 1 }}
13
+ selector :
14
+ matchLabels :
15
+ app : microcalc-{{ .name }}
16
+ release : {{ $.Release.Name }}
17
+ template :
18
+ metadata :
19
+ labels :
20
+ app : microcalc-{{ .name }}
21
+ release : {{ $.Release.Name }}
22
+ spec :
23
+ containers :
24
+ - name : {{ .name }}
25
+ image : " {{ $.Values.image.repository }}-{{ .name }}:{{ $.Values.image.tag }}"
26
+ imagePullPolicy : {{ $.Values.image.pullPolicy }}
27
+ ports :
28
+ - name : http
29
+ containerPort : {{ .httpPort }}
30
+ protocol : TCP
31
+ # livenessProbe:
32
+ # httpGet:
33
+ # path: /api/v1/status
34
+ # port: http
35
+ # readinessProbe:
36
+ # httpGet:
37
+ # path: /api/v1/status
38
+ # port: http
39
+ {{- if .env }}
40
+ env :
41
+ {{- range $key,$value := .env }}
42
+ - name : {{ quote $key }}
43
+ value : {{ quote $value }}
44
+ {{- end }}
45
+ {{- end }}
46
+
47
+ ---
48
+
49
+ {{ end }}
Original file line number Diff line number Diff line change
1
+ {{- if .Values.istioGateway.enabled -}}
2
+ apiVersion : networking.istio.io/v1alpha3
3
+ kind : Gateway
4
+ metadata :
5
+ name : microcalc
6
+ labels :
7
+ app : microcalc
8
+ chart : microcalc
9
+ release : {{ $.Release.Name }}
10
+ heritage : {{ $.Release.Service }}
11
+ spec :
12
+ selector :
13
+ istio : ingressgateway
14
+ servers :
15
+ - port :
16
+ number : 80
17
+ name : http
18
+ protocol : HTTP
19
+ hosts :
20
+ {{- range .Values.istioGateway.hosts }}
21
+ - {{ . }}
22
+ {{- end }}
23
+ ---
24
+ apiVersion : networking.istio.io/v1alpha3
25
+ kind : VirtualService
26
+ metadata :
27
+ name : microcalc
28
+ labels :
29
+ app : microcalc
30
+ chart : microcalc
31
+ release : {{ $.Release.Name }}
32
+ heritage : {{ $.Release.Service }}
33
+ spec :
34
+ hosts :
35
+ {{- range .Values.istioGateway.hosts }}
36
+ - {{ . }}
37
+ {{- end }}
38
+ gateways :
39
+ - microcalc
40
+ http :
41
+ - match :
42
+ {{ toYaml .Values.istioGateway.match | indent 4 -}}
43
+ route :
44
+ - destination :
45
+ host : parser
46
+ port :
47
+ number : 80
48
+ {{- end }}
Original file line number Diff line number Diff line change
1
+ {{- range .Values.opServices }}
2
+ apiVersion : v1
3
+ kind : Service
4
+ metadata :
5
+ name : {{ .name }}
6
+ labels :
7
+ app : microcalc-{{ .name }}
8
+ chart : microcalc
9
+ release : {{ $.Release.Name }}
10
+ heritage : {{ $.Release.Service }}
11
+ spec :
12
+ selector :
13
+ app : microcalc-{{ .name }}
14
+ release : {{ $.Release.Name }}
15
+ ports :
16
+ - port : 80
17
+ targetPort : http
18
+ protocol : TCP
19
+ name : http
20
+
21
+ ---
22
+
23
+ {{ end }}
Original file line number Diff line number Diff line change
1
+ # Default values for helm.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+
5
+ replicaCount : 1
6
+
7
+ image :
8
+ repository : foly/microcalc
9
+ tag : latest
10
+ pullPolicy : Always
11
+
12
+ istioGateway :
13
+ enabled : true
14
+ match :
15
+ - uri :
16
+ prefix : /
17
+ hosts :
18
+ - your.domain
19
+
20
+ opServices :
21
+ - name : add
22
+ httpPort : 3000
23
+ - name : sub
24
+ httpPort : 8000
25
+ - name : mult
26
+ httpPort : 8080
27
+ - name : div
28
+ httpPort : 5000
29
+ - name : neg
30
+ httpPort : 80
31
+ env :
32
+ ASPNETCORE_MULT_ENDPOINT : ' http://mult/api/v1/mult'
33
+ - name : pow
34
+ httpPort : 3000
35
+ env :
36
+ MULT_ENDPOINT : ' http://mult/api/v1/mult'
37
+ - name : mod
38
+ httpPort : 8080
39
+ env :
40
+ MC_MULT_ENDPOINT : ' http://mult/api/v1/mult'
41
+ MC_DIV_ENDPOINT : ' http://div/api/v1/div'
42
+ MC_SUB_ENDPOINT : ' http://sub/api/v1/sub'
43
+ - name : parser
44
+ httpPort : 8080
45
+ env :
46
+ ADD_HOST : ' add'
47
+ ADD_PORT : 80
48
+ ADD_URI : ' /api/v1/add'
49
+
50
+ SUB_HOST : ' sub'
51
+ SUB_PORT : 80
52
+ SUB_URI : ' /api/v1/sub'
53
+
54
+ DIV_HOST : ' div'
55
+ DIV_PORT : 80
56
+ DIV_URI : ' /api/v1/div'
57
+
58
+ MULT_HOST : ' mult'
59
+ MULT_PORT : 80
60
+ MULT_URI : ' /api/v1/mult'
61
+
62
+ NEG_HOST : ' neg'
63
+ NEG_PORT : 80
64
+ NEG_URI : ' /api/v1/neg'
65
+
66
+ POW_HOST : ' pow'
67
+ POW_PORT : 80
68
+ POW_URI : ' /api/v1/pow'
69
+
70
+ MOD_HOST : ' mod'
71
+ MOD_PORT : 80
72
+ MOD_URI : ' /api/v1/mod'
You can’t perform that action at this time.
0 commit comments