-
Notifications
You must be signed in to change notification settings - Fork 163
/
deployment-agent.yaml
137 lines (137 loc) · 4.46 KB
/
deployment-agent.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "drone.fullname" . }}-agent
namespace: {{ template "drone.namespace" . }}
labels:
app: {{ template "drone.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
component: agent
spec:
selector:
matchLabels:
app: {{ template "drone.name" . }}
release: "{{ .Release.Name }}"
component: agent
replicas: {{ .Values.kubernetes.replicas }}
template:
metadata:
annotations:
checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
{{- if .Values.kubernetes.annotations }}
{{ toYaml .Values.kubernetes.annotations | indent 8 }}
{{- end }}
labels:
app: {{ template "drone.name" . }}
release: "{{ .Release.Name }}"
component: agent
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets: {{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.kubernetes.securityContext }}
securityContext:
{{- toYaml .Values.kubernetes.securityContext | nindent 8 }}
{{- end }}
{{- if .Values.kubernetes.schedulerName }}
schedulerName: "{{ .Values.kubernetes.schedulerName }}"
{{- end }}
{{- if .Values.kubernetes.affinity }}
affinity:
{{ toYaml .Values.kubernetes.affinity | indent 8 }}
{{- end }}
{{- if .Values.kubernetes.nodeSelector }}
nodeSelector:
{{ toYaml .Values.kubernetes.nodeSelector | indent 8 }}
{{- end }}
{{- with .Values.kubernetes.tolerations }}
tolerations:
{{- toYaml . | nindent 6 }}
{{- end }}
serviceAccountName: {{ template "drone.serviceAccountName" . }}
containers:
- name: agent
image: "{{ .Values.images.agent.repository }}:{{ .Values.images.agent.tag }}"
imagePullPolicy: {{ .Values.images.agent.pullPolicy }}
ports:
- name: http
containerPort: 3000
protocol: TCP
env:
- name: DRONE_RPC_PROTO
value: {{ .Values.server.rpcProtocol }}
- name: DRONE_RPC_HOST
value: {{ template "drone.fullname" . }}.{{ template "drone.namespace" . }}:{{ .Values.service.httpPort }}
- name: DRONE_RPC_SECRET
valueFrom:
secretKeyRef:
name: {{ template "drone.fullname" . }}
key: secret
- name: DRONE_RUNNER_ENV_FILE
value: /etc/drone/env
- name: DRONE_NAMESPACE_DEFAULT
value: {{ .Values.kubernetes.namespace }}
{{- range $key, $value := .Values.kubernetes.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
resources:
{{ toYaml .Values.kubernetes.resources | indent 10 }}
{{- if not .Values.dind.enabled }}
securityContext:
privileged: true
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-socket
- name: envfile
mountPath: /etc/drone
{{- with .Values.kubernetes.volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
volumes:
- name: docker-socket
hostPath:
path: /var/run/docker.sock
- name: envfile
secret:
secretName: {{ template "drone.fullname" . }}-envfile
{{- else }}
{{- with .Values.kubernetes.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 10 }}
{{- end }}
- name: dind
image: "{{ .Values.images.dind.repository }}:{{ .Values.images.dind.tag }}"
imagePullPolicy: {{ .Values.images.dind.pullPolicy }}
{{- if .Values.dind.command }}
command: {{ .Values.dind.command }}
{{ end }}
{{- if .Values.dind.args }}
args: {{ .Values.dind.args }}
{{ end }}
env:
- name: DOCKER_DRIVER
value: {{ .Values.dind.driver }}
{{ range $key, $value := .Values.dind.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{ end }}
securityContext:
privileged: true
resources:
{{ toYaml .Values.dind.resources | indent 10 }}
volumeMounts:
- name: docker-graph-storage
mountPath: /var/lib/docker
{{- with .Values.dind.volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
volumes:
- name: docker-graph-storage
emptyDir: {}
{{- end }}
{{- with .Values.kubernetes.volumes }}
{{- toYaml . | nindent 6 }}
{{- end }}