forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-gitserver.yaml
183 lines (168 loc) · 6.34 KB
/
test-gitserver.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
apiVersion: v1
kind: Template
labels:
template: gitserver
metadata:
name: gitserver
parameters:
- name: ROUTE_SUFFIX
required: true
objects:
# The gitserver is deployed as a singleton pod and uses a very small amount
# of resources. It can host or transiently serve Git repositories, as well
# as automatically integrate with builds in a namespace.
- apiVersion: v1
kind: DeploymentConfig
metadata:
name: gitserver
labels:
app: gitserver
spec:
replicas: 1 # the gitserver is not HA and should not be scaled past 1
selector:
run-container: gitserver
template:
metadata:
labels:
run-container: gitserver
spec:
containers:
- name: gitserver
image: openshift/origin-gitserver
serviceAccountName: gitserver
readinessProbe:
tcpSocket:
port: 8080
ports:
- containerPort: 8080
env:
# Each environment variable matching GIT_INITIAL_CLONE_* will
# be cloned when the process starts; failures will be logged.
# <name> must be [A-Z0-9_\-\.], the cloned directory name will
# be lowercased. If the name is invalid the pod will halt. If
# the repository already exists on disk, it will be updated
# from the remote.
#
- name: GIT_INITIAL_CLONE_1
value: https://github.com/openshift/ruby-hello-world.git;ruby-hello-world
# The namespace of the pod is required for implicit config
# (passing '-' to AUTOLINK_KUBECONFIG or REQUIRE_SERVER_AUTH)
# and can also be used to target a specific namespace.
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
# The URL that builds must use to access the Git repositories
# stored in this app.
# TOOD: support HTTPS
- name: PUBLIC_URL
value: http://gitserver.$(POD_NAMESPACE).svc.cluster.local:8080
# The directory to store Git repositories in. If not backed
# by a persistent volume, repositories will be lost when
# deployments occur. Use INITIAL_GIT_CLONE and AUTOLINK_*
# to remove the need to use a persistent volume.
- name: GIT_HOME
value: /var/lib/git
# The directory to use as the default hook directory for any
# cloned or autolinked directories.
- name: HOOK_PATH
value: /var/lib/git-hooks
# Authentication and authorization
# If 'yes', clients may push to the server with git push.
- name: ALLOW_GIT_PUSH
value: "yes"
# If 'yes', clients may set hooks via the API. However, unless
# the Git home is backed by a persistent volume, any deployment
# will result in the hooks being lost.
- name: ALLOW_GIT_HOOKS
value: "yes"
# If 'yes', clients can create new git repositories on demand
# by pushing. If the data on disk is not backed by a persistent
# volume, the Git repo will be deleted if the deployment is
# updated.
- name: ALLOW_LAZY_CREATE
value: "yes"
# If 'yes', clients can pull without being authenticated.
- name: ALLOW_ANON_GIT_PULL
# Provides the path to a kubeconfig file in the image that
# should be used to authorize against the server. The value
# '-' will use the pod's service account.
# May not be used in combination with REQUIRE_GIT_AUTH
#- name: REQUIRE_SERVER_AUTH
# value: "-"
# The namespace to check authorization against when
# REQUIRE_SERVICE_AUTH is used. Users must have 'get' on
# 'pods' to pull and 'create' on 'pods' to push.
- name: AUTH_NAMESPACE
value: $(POD_NAMESPACE)
# Require BASIC authentication with a username and password
# to push or pull.
# May not be used in combination with REQUIRE_SERVER_AUTH
- name: REQUIRE_GIT_AUTH
value: gituser:gituserpassword
# Autolinking:
#
# The gitserver can automatically clone Git repositories
# associated with a build config and replace the URL with
# a link to the repo on PUBLIC_URL. The default post-receive
# hook on the cloned repo will then trigger a build. You
# may customize the hook with AUTOLINK_HOOK (path to hook).
# To autolink, the account the pod runs under must have 'edit'
# on the AUTOLINK_NAMESPACE:
#
# oc policy add-role-to-user \
# system:serviceaccount:${namespace}:gitserver edit
#
# Links are checked every time the pod starts.
# The location to read auth configuration from for autolinking.
# If '-', use the service account token to link. The account
# represented by this config must have the edit role on the
# namespace.
#- name: AUTOLINK_KUBECONFIG
# value: "-"
# The namespace to autolink
#- name: AUTOLINK_NAMESPACE
# value: $(POD_NAMESPACE)
# The path to a script in the image to use as the default
# post-receive hook - only set during link, so has no effect
# on cloned repositories. See the "hooks" directory in the
# image for examples.
#- name: AUTOLINK_HOOK
# The master service host is not signed with the service IP
# so we override with the consistent DNS name. Required for
# connections to the server.
- name: KUBERNETES_SERVICE_HOST
value: kubernetes.default
volumeMounts:
- mountPath: /var/lib/git/
name: git
volumes:
- name: git
triggers:
- type: ConfigChange
# The gitserver service is required for DNS resolution
- apiVersion: v1
kind: Service
metadata:
name: gitserver
labels:
app: gitserver
spec:
ports:
- port: 8080
targetPort: 8080
selector:
run-container: gitserver
- apiVersion: v1
kind: Route
metadata:
name: gitserver
labels:
app: gitserver
spec:
host: gitserver.${ROUTE_SUFFIX}
tls:
termination: edge
to:
kind: Service
name: gitserver