-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitea-persistent-template.yaml
More file actions
284 lines (280 loc) · 7.84 KB
/
gitea-persistent-template.yaml
File metadata and controls
284 lines (280 loc) · 7.84 KB
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
---
apiVersion: v1
kind: Template
labels:
template: gitea-persistent-template
message: |-
Before the Gitea application can be started your cluster administrator must grant the 'anyuid' SCC to the service account you just created:
oc project <your-project>
oc adm policy add-scc-to-user anyuid -z ${APPLICATION_NAME}
If you enable SSH access to Gitea you further have to make sure that the firewall doesn't block access to ${SSH_DOMAIN}:${SSH_PORT}.
The first user registered at ${HTTP_PROTOCOL}:${HTTP_DOMAIN} will have administration privileges in this Gitea instance.
metadata:
annotations:
description: |-
Gitea version control repository server, with persistent storage and optional external database.
NOTE: You must have persistent volumes available in your cluster to use this template.
iconClass: icon-git
openshift.io/display-name: Gitea
openshift.io/documentation-url: https://github.com/go-gitea/gitea/blob/master/docs/content/doc/installation/with-docker.en-us.md
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
openshift.io/provider-display-name: "Reto Gantenbein"
openshift.io/support-url: https://github.com/go-gitea/gitea
tags: "git,version-control,ci-cd"
name: gitea-persistent
objects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: gitea-config
data:
APP_NAME: ${APP_NAME}
RUN_MODE: "prod"
ROOT_URL: ${HTTP_PROTOCOL}://${HTTP_DOMAIN}
DISABLE_SSH: ${DISABLE_SSH}
SSH_DOMAIN: ${SSH_DOMAIN}
SSH_PORT: ${SSH_PORT}
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: 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
resources:
requests:
cpu: 200m
memory: 128Mi
limits:
cpu: ${LIMIT_CPU}m
memory: ${LIMIT_MEMORY}M
restartPolicy: Always
serviceAccount: ${APPLICATION_NAME}
serviceAccountName: ${APPLICATION_NAME}
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}
- 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: Route
metadata:
name: ${APPLICATION_NAME}
spec:
host: ${HTTP_DOMAIN}
port:
targetPort: http
to:
kind: Service
name: ${APPLICATION_NAME}
weight: 100
wildcardPolicy: None
- apiVersion: v1
kind: Secret
metadata:
name: gitea-secret
type: Opaque
stringData:
SECRET_KEY: "`${SECRET_KEY}`"
- apiVersion: v1
kind: Service
metadata:
name: ${APPLICATION_NAME}
spec:
ports:
- name: http
port: 3000
protocol: TCP
targetPort: 3000
selector:
app: ${APPLICATION_NAME}
deploymentconfig: ${APPLICATION_NAME}
- apiVersion: v1
kind: Service
metadata:
name: ${APPLICATION_NAME}-ssh
spec:
ports:
- name: ssh
nodePort: ${SSH_PORT}
port: 22
protocol: TCP
targetPort: 22
selector:
app: ${APPLICATION_NAME}
deploymentconfig: ${APPLICATION_NAME}
sessionAffinity: ClientIP
type: NodePort
- apiVersion: v1
kind: ServiceAccount
metadata:
name: ${APPLICATION_NAME}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitea-data
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: ${STORAGE_CAPACITY}
parameters:
- name: APPLICATION_NAME
displayName: Openshift Application name
value: gitea
- name: GITEA_VERSION
displayName: Gitea Version (docker image tag)
value: "1.6"
- name: APP_NAME
displayName: Application name, used in the page title
value: "Gitea: Git with a cup of tea"
- name: HTTP_DOMAIN
displayName: HTTP domain name
description: Public domain name of this server, used to generate links in the Web UI
value: gitea.192.168.99.100.nip.io
required: true
- name: HTTP_PROTOCOL
displayName: HTTP protocol
description: Protocol used to generate links in the Web UI [http, https]
value: http
required: true
- name: DISABLE_SSH
displayName: Disable SSH
description: Disable SSH feature when NodePort access is not available
value: "false"
- name: SSH_DOMAIN
displayName: SSH domain name
description: Domain name of this server, used for the displayed clone URL in the Web UI
value: gitea-ssh.192.168.99.100.nip.io
required: true
- name: SSH_PORT
displayName: SSH port
description: SSH port displayed in clone URL
value: "30022"
- name: DB_TYPE
displayName: Database type [sqlite3, postgres, mysql, mssql]
value: sqlite3
- name: DB_HOST
displayName: Database host
value: "postgres.svc.local: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}"
- name: LIMIT_CPU
displayName: Container CPU limit in millicores
value: "1000"
- name: LIMIT_MEMORY
displayName: Container memory limit in megabytes
value: "256"