Skip to content

Commit ee43502

Browse files
committed
[helm] feat: add helm hellok8s resource yaml.
1 parent 781a623 commit ee43502

6 files changed

Lines changed: 42 additions & 10 deletions

File tree

hello-helm/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Dockerfile
2+
FROM golang:1.16-buster AS builder
3+
RUN mkdir /src
4+
ADD . /src
5+
WORKDIR /src
6+
7+
RUN go env -w GO111MODULE=auto
8+
RUN go build -o main .
9+
10+
FROM gcr.io/distroless/base-debian10
11+
12+
WORKDIR /
13+
14+
COPY --from=builder /src/main /main
15+
EXPOSE 3000
16+
ENTRYPOINT ["/main"]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v1
22
kind: ConfigMap
33
metadata:
4-
name: hellok8s-config
4+
name: {{ .Values.application.name }}-config
55
data:
6-
DB_URL: "http://DB_ADDRESS_DEV"
6+
DB_URL: {{ .Values.application.hellok8s.database.url }}
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: hellok8s-deployment
4+
name: {{ .Values.application.name }}-deployment
55
spec:
6-
replicas: 3
6+
replicas: {{ .Values.application.hellok8s.replicas }}
77
selector:
88
matchLabels:
99
app: hellok8s
@@ -13,11 +13,20 @@ spec:
1313
app: hellok8s
1414
spec:
1515
containers:
16-
- image: guangzhengli/hellok8s:v4
16+
- image: {{ .Values.application.hellok8s.image }}
1717
name: hellok8s-container
1818
env:
1919
- name: DB_URL
2020
valueFrom:
2121
configMapKeyRef:
22-
name: hellok8s-config
23-
key: DB_URL
22+
name: {{ .Values.application.name }}-config
23+
key: DB_URL
24+
- name: DB_PASSWORD
25+
valueFrom:
26+
secretKeyRef:
27+
name: {{ .Values.application.name }}-secret
28+
key: DB_PASSWORD
29+
- name: NAMESPACE
30+
value: {{ .Release.Namespace }}
31+
- name: MESSAGE
32+
value: {{ .Values.application.hellok8s.message }}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# hellok8s-secret.yaml
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ .Values.application.name }}-secret
6+
data:
7+
DB_PASSWORD: {{ .Values.application.hellok8s.database.password | b64enc }}

hello-helm/templates/ingress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: networking.k8s.io/v1
22
kind: Ingress
33
metadata:
4-
name: hello-ingress
4+
name: {{ .Values.application.name }}-ingress
55
annotations:
66
# We are defining this annotation to prevent nginx
77
# from redirecting requests to `https` for now

hello-helm/templates/nginx-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: nginx-deployment
55
spec:
6-
replicas: 2
6+
replicas: {{ .Values.application.nginx.replicas }}
77
selector:
88
matchLabels:
99
app: nginx
@@ -13,5 +13,5 @@ spec:
1313
app: nginx
1414
spec:
1515
containers:
16-
- image: nginx
16+
- image: {{ .Values.application.nginx.image }}
1717
name: nginx-container

0 commit comments

Comments
 (0)