/
gitea-persistent-template.yaml
245 lines (245 loc) · 6.11 KB
/
gitea-persistent-template.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
apiVersion: v1
kind: Template
metadata:
name: Gitea
annotations:
openshift.io/display-name: "Gitea repository manager (Persistent)"
description: Gitea with external database
openshift.io/long-description: >-
This template defines resources to operate a Gitea installation, including
config map, secret, persistent volume claim, deployment configuration, service and route
iconClass: "icon-git"
tags: "git"
parameters:
- name: APPLICATION_NAME
displayName: Openshift Application name
value: gitea
- name: GITEA_VERSION
displayName: Gitea Version (docker image tag)
value: "1.5"
- name: APP_NAME
displayName: Application name, used in the page title
value: "Gitea: Git with a cup of tea"
- name: HOSTNAME
displayName: Hostname
description: Hostname use to generate links in the web ui
value: gitea.192.168.99.100.nip.io
required: true
- name: SSH_DOMAIN
displayName: SSH domain
description: Domain name of this server, used for the displayed clone URL in Gitea’s UI
value: gitea-ssh.192.168.99.100.nip.io
required: true
- name: DISABLE_SSH
displayName: Disable SSH
description: Disable SSH feature when it’s not available
value: "false"
- name: DB_TYPE
displayName: Database type [mysql, postgres, mssql, sqlite3]
value: postgres
- name: DB_HOST
displayName: Database host
value: "192.168.99.1:5432"
- name: DB_NAME
displayName: Database name
value: gitea
- name: DB_USER
displayName: Database username
value: gitea
- name: DB_PASSWD
displayName: Database password
value: gitea
- name: DISABLE_REGISTRATION
displayName: Disable registration
description: Disable registration, after which only admin can create accounts for users
value: "false"
- name: REQUIRE_SIGNIN_VIEW
displayName: Require sign in
description: Enable this to force users to log in to view any page
value: "false"
- name: STORAGE_CAPACITY
displayName: Data volume capacity
value: "1G"
- name: SECRET_KEY
displayName: Global secret key
generate: expression
from: "[a-zA-Z0-9]{65}"
labels:
template: gitea-persistent
app: "${APP_NAME}"
objects:
- apiVersion: v1
kind: ServiceAccount
metadata:
name: ${APPLICATION_NAME}
- apiVersion: v1
kind: ConfigMap
metadata:
name: gitea-config
data:
APP_NAME: ${APP_NAME}
RUN_MODE: "prod"
SSH_DOMAIN: ${SSH_DOMAIN}
DISABLE_SSH: ${DISABLE_SSH}
ROOT_URL: http://${HOSTNAME}
DB_TYPE: ${DB_TYPE}
DB_HOST: ${DB_HOST}
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWD: ${DB_PASSWD}
INSTALL_LOCK: "true"
DISABLE_REGISTRATION: ${DISABLE_REGISTRATION}
REQUIRE_SIGNIN_VIEW: ${REQUIRE_SIGNIN_VIEW}
- apiVersion: v1
kind: Secret
metadata:
name: gitea-secret
type: Opaque
stringData:
SECRET_KEY: "`${SECRET_KEY}`"
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitea-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: ${STORAGE_CAPACITY}
- kind: ImageStream
apiVersion: v1
metadata:
name: ${APPLICATION_NAME}
spec:
tags:
- name: ${GITEA_VERSION}
from:
kind: DockerImage
name: docker.io/gitea/gitea:${GITEA_VERSION}
annotations:
description: The Gitea git server docker image
tags: git
version: ${GITEA_VERSION}
- apiVersion: v1
kind: DeploymentConfig
metadata:
name: ${APPLICATION_NAME}
spec:
replicas: 1
selector:
app: ${APPLICATION_NAME}
deploymentconfig: ${APPLICATION_NAME}
strategy:
type: Rolling
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
template:
metadata:
labels:
app: ${APPLICATION_NAME}
deploymentconfig: ${APPLICATION_NAME}
spec:
containers:
- name: ${APPLICATION_NAME}
image: ${APPLICATION_NAME}:${GITEA_VERSION}
imagePullPolicy: Always
envFrom:
- secretRef:
name: gitea-secret
- configMapRef:
name: gitea-config
ports:
- containerPort: 22
protocol: TCP
- containerPort: 3000
protocol: TCP
volumeMounts:
- name: gitea-data
mountPath: /data/
- name: gitea-empty
mountPath: /data/gitea/conf/
readinessProbe:
httpGet:
path: /
port: 3000
scheme: HTTP
initialDelaySeconds: 3
timeoutSeconds: 1
periodSeconds: 20
successThreshold: 1
failureThreshold: 10
livenessProbe:
httpGet:
path: /
port: 3000
scheme: HTTP
initialDelaySeconds: 20
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
restartPolicy: Always
volumes:
- name: gitea-data
persistentVolumeClaim:
claimName: gitea-data
- name: gitea-empty
emptyDir: {}
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- ${APPLICATION_NAME}
from:
kind: ImageStreamTag
name: ${APPLICATION_NAME}:${GITEA_VERSION}
- apiVersion: v1
kind: Service
metadata:
name: ${APPLICATION_NAME}
spec:
ports:
- name: ssh
port: 22
protocol: TCP
targetPort: 22
- name: http
port: 3000
protocol: TCP
targetPort: 3000
selector:
app: ${APPLICATION_NAME}
deploymentconfig: gitea
- apiVersion: v1
kind: Route
metadata:
name: ${APPLICATION_NAME}-http
spec:
host: ${HOSTNAME}
port:
targetPort: http
to:
kind: Service
name: ${APPLICATION_NAME}
weight: 100
wildcardPolicy: None
- apiVersion: v1
kind: Route
metadata:
name: ${APPLICATION_NAME}-ssh
spec:
host: ${SSH_DOMAIN}
port:
targetPort: ssh
to:
kind: Service
name: ${APPLICATION_NAME}
weight: 100
wildcardPolicy: None