Advertisement
Guest User

Untitled

a guest
Feb 15th, 2017
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.00 KB | None | 0 0
  1. apiVersion: extensions/v1beta1
  2. kind: Deployment
  3. metadata:
  4. name: gitlab
  5. namespace: gitlab
  6. spec:
  7. replicas: 1
  8. template:
  9. metadata:
  10. labels:
  11. name: gitlab
  12. app: gitlab
  13. annotations:
  14. scheduler.alpha.kubernetes.io/affinity: >
  15. {
  16. "nodeAffinity": {
  17. "requiredDuringSchedulingIgnoredDuringExecution": {
  18. "nodeSelectorTerms": [
  19. {
  20. "matchExpressions": [
  21. {
  22. "key": "cloud.google.com/gke-preemptible",
  23. "operator": "DoesNotExist"
  24. }
  25. ]
  26. }
  27. ]
  28. }
  29. }
  30. }
  31. spec:
  32. containers:
  33. - name: gitlab
  34. image: gitlab/gitlab-ce:8.16.2-ce.0
  35. imagePullPolicy: IfNotPresent
  36. command: ["/bin/bash","-c"]
  37. args: ["apt-get update &&
  38. apt-get install -y make libmysqlclient-dev build-essential g++ &&
  39. echo 'ABOUT TO INSTALL mysql2 gem...' &&
  40. cd /opt/gitlab/embedded/bin/ &&
  41. ./gem install mysql2 -- --with-mysql-lib=/usr/lib64/mysql &&
  42. echo 'ABOUT TO ECHO...' &&
  43. echo '---
  44. BUNDLE_RETRY: \"5\"
  45. BUNDLE_PATH: \"/opt/gitlab/embedded/service/gem\"
  46. BUNDLE_JOBS: \"9\"
  47. BUNDLE_WITHOUT: \"development:test:postgres\"
  48. BUNDLE_DISABLE_SHARED_GEMS: \"true\"' >
  49. /opt/gitlab/embedded/service/gitlab-rails/.bundle/config &&
  50. echo 'ABOUT TO INSTALL BUNDLE...' &&
  51. cd /opt/gitlab/embedded/service/gitlab-rails &&
  52. /opt/gitlab/embedded/bin/bundle install &&
  53. echo 'ABOUT TO PATCH..' &&
  54. patch -p1 -d /opt/gitlab/embedded/service/gitlab-rails < /patches/fix-git-hooks.patch && sed -i \"s/environment ({'GITLAB_ROOT_PASSWORD' => initial_root_password }) if initial_root_password/environment ({'GITLAB_ROOT_PASSWORD' => initial_root_password, 'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN' => node['gitlab']['gitlab-rails']['initial_shared_runners_registration_token'] })/g\" /opt/gitlab/embedded/cookbooks/gitlab/recipes/database_migrations.rb && exec /assets/wrapper"]
  55. env:
  56. - name: GITLAB_EXTERNAL_SCHEME
  57. valueFrom:
  58. configMapKeyRef:
  59. name: gitlab-config
  60. key: external_scheme
  61. - name: GITLAB_EXTERNAL_HOSTNAME
  62. valueFrom:
  63. configMapKeyRef:
  64. name: gitlab-config
  65. key: external_hostname
  66. - name: GITLAB_REGISTRY_EXTERNAL_SCHEME
  67. valueFrom:
  68. configMapKeyRef:
  69. name: gitlab-config
  70. key: registry_external_scheme
  71. - name: GITLAB_REGISTRY_EXTERNAL_HOSTNAME
  72. valueFrom:
  73. configMapKeyRef:
  74. name: gitlab-config
  75. key: registry_external_hostname
  76. - name: GITLAB_MATTERMOST_EXTERNAL_SCHEME
  77. valueFrom:
  78. configMapKeyRef:
  79. name: gitlab-config
  80. key: mattermost_external_scheme
  81. - name: GITLAB_MATTERMOST_EXTERNAL_HOSTNAME
  82. valueFrom:
  83. configMapKeyRef:
  84. name: gitlab-config
  85. key: mattermost_external_hostname
  86. - name: MYSQL_USER
  87. valueFrom:
  88. secretKeyRef:
  89. name: cloudsql
  90. key: username
  91. - name: MYSQL_PASSWORD
  92. valueFrom:
  93. secretKeyRef:
  94. name: cloudsql
  95. key: password
  96. - name: MYSQL_DB
  97. valueFrom:
  98. configMapKeyRef:
  99. name: gitlab-config
  100. key: mysql_db
  101. - name: MYSQL_IP
  102. valueFrom:
  103. configMapKeyRef:
  104. name: gitlab-config
  105. key: mysql_ip
  106. - name: GITLAB_INITIAL_SHARED_RUNNERS_REGISTRATION_TOKEN
  107. valueFrom:
  108. secretKeyRef:
  109. name: gitlab-secrets
  110. key: initial_shared_runners_registration_token
  111. - name: MATTERMOST_APP_UID
  112. valueFrom:
  113. configMapKeyRef:
  114. name: gitlab-config
  115. key: mattermost_app_uid
  116. - name: MATTERMOST_APP_SECRET
  117. valueFrom:
  118. secretKeyRef:
  119. name: gitlab-secrets
  120. key: mattermost_app_secret
  121. - name: GITLAB_OMNIBUS_CONFIG
  122. value: |
  123. external_url "#{ENV['GITLAB_EXTERNAL_SCHEME']}://#{ENV['GITLAB_EXTERNAL_HOSTNAME']}"
  124. registry_external_url "#{ENV['GITLAB_REGISTRY_EXTERNAL_SCHEME']}://#{ENV['GITLAB_REGISTRY_EXTERNAL_HOSTNAME']}"
  125. mattermost_external_url "#{ENV['GITLAB_MATTERMOST_EXTERNAL_SCHEME']}://#{ENV['GITLAB_MATTERMOST_EXTERNAL_HOSTNAME']}"
  126.  
  127. gitlab_rails['initial_shared_runners_registration_token'] = ENV['GITLAB_INITIAL_SHARED_RUNNERS_REGISTRATION_TOKEN']
  128.  
  129. nginx['enable'] = false
  130. registry_nginx['enable'] = false
  131. mattermost_nginx['enable'] = false
  132.  
  133. gitlab_workhorse['listen_network'] = 'tcp'
  134. gitlab_workhorse['listen_addr'] = '0.0.0.0:8005'
  135.  
  136. mattermost['service_address'] = '0.0.0.0'
  137. mattermost['service_port'] = '8065'
  138.  
  139. registry['registry_http_addr'] = '0.0.0.0:8105'
  140.  
  141. postgresql['enable'] = false
  142. gitlab_rails['db_adapter'] = 'mysql2'
  143. gitlab_rails['db_host'] = ENV['MYSQL_IP']
  144. gitlab_rails['db_port'] = '3306'
  145. gitlab_rails['db_encoding'] = 'utf8'
  146. gitlab_rails['db_password'] = ENV['MYSQL_PASSWORD']
  147. gitlab_rails['db_username'] = ENV['MYSQL_USER']
  148. gitlab_rails['db_database'] = ENV['MYSQL_DB']
  149.  
  150. redis['enable'] = false
  151. gitlab_rails['redis_host'] = 'gitlab-redis'
  152.  
  153. mattermost['file_directory'] = '/gitlab-data/mattermost';
  154. mattermost['sql_driver_name'] = 'mysql';
  155. mattermost['sql_data_source'] = "user=#{ENV['MYSQL_USER']} host=#{ENV['MYSQL_IP']} port=3306 dbname=mattermost_production password=#{ENV['MYSQL_PASSWORD']} sslmode=disable";
  156. mattermost['gitlab_enable'] = true;
  157. mattermost['gitlab_secret'] = ENV['MATTERMOST_APP_SECRET'];
  158. mattermost['gitlab_id'] = ENV['MATTERMOST_APP_UID'];
  159. mattermost['gitlab_scope'] = '';
  160. mattermost['gitlab_auth_endpoint'] = "#{ENV['GITLAB_EXTERNAL_SCHEME']}://#{ENV['GITLAB_EXTERNAL_HOSTNAME']}/oauth/authorize";
  161. mattermost['gitlab_token_endpoint'] = "#{ENV['GITLAB_EXTERNAL_SCHEME']}://#{ENV['GITLAB_EXTERNAL_HOSTNAME']}/oauth/token";
  162. mattermost['gitlab_user_api_endpoint'] = "#{ENV['GITLAB_EXTERNAL_SCHEME']}://#{ENV['GITLAB_EXTERNAL_HOSTNAME']}/api/v3/user"
  163.  
  164. manage_accounts['enable'] = true
  165. manage_storage_directories['manage_etc'] = false
  166.  
  167. gitlab_shell['auth_file'] = '/gitlab-data/ssh/authorized_keys'
  168. git_data_dir '/gitlab-data/git-data'
  169. gitlab_rails['shared_path'] = '/gitlab-data/shared'
  170. gitlab_rails['uploads_directory'] = '/gitlab-data/uploads'
  171. gitlab_ci['builds_directory'] = '/gitlab-data/builds'
  172. gitlab_rails['registry_path'] = '/gitlab-registry'
  173.  
  174. prometheus['enable'] = true
  175. node_exporter['enable'] = true
  176. - name: GITLAB_POST_RECONFIGURE_SCRIPT
  177. value: |
  178. /opt/gitlab/bin/gitlab-rails runner -e production 'Doorkeeper::Application.where(uid: ENV["MATTERMOST_APP_UID"], secret: ENV["MATTERMOST_APP_SECRET"], redirect_uri: "#{ENV["GITLAB_MATTERMOST_EXTERNAL_SCHEME"]}://#{ENV["GITLAB_MATTERMOST_EXTERNAL_HOSTNAME"]}/signup/gitlab/complete\r\n#{ENV["GITLAB_MATTERMOST_EXTERNAL_SCHEME"]}://#{ENV["GITLAB_MATTERMOST_EXTERNAL_HOSTNAME"]}/login/gitlab/complete", name: "GitLab Mattermost").first_or_create;'
  179. ports:
  180. - name: registry
  181. containerPort: 8105
  182. - name: mattermost
  183. containerPort: 8065
  184. - name: workhorse
  185. containerPort: 8005
  186. - name: ssh
  187. containerPort: 22
  188. - name: prometheus
  189. containerPort: 9090
  190. - name: node-exporter
  191. containerPort: 9100
  192. volumeMounts:
  193. - name: config
  194. mountPath: /etc/gitlab
  195. - name: data
  196. mountPath: /gitlab-data
  197. - name: registry
  198. mountPath: /gitlab-registry
  199. - name: patches
  200. mountPath: /patches
  201. readOnly: true
  202. - name: cloudsql-oauth-credentials
  203. mountPath: /secrets/cloudsql
  204. readOnly: true
  205. - name: gitlab-secrets
  206. mountPath: /gitlab-secrets
  207. readOnly: true
  208. - name: ssl-certs
  209. mountPath: /etc/ssl/certs
  210. - name: cloudsql
  211. mountPath: /cloudsql
  212. livenessProbe:
  213. httpGet:
  214. path: /help
  215. port: 8005
  216. initialDelaySeconds: 1800 #180
  217. timeoutSeconds: 1500 # 15
  218. readinessProbe:
  219. httpGet:
  220. path: /help
  221. port: 8005
  222. initialDelaySeconds: 1500 # 15
  223. timeoutSeconds: 1
  224. - image: b.gcr.io/cloudsql-docker/gce-proxy:1.06
  225. name: cloudsql-proxy
  226. command: ["/cloud_sql_proxy", "--dir=/cloudsql",
  227. "-instances=[INSTANCE_CONNECTION_NAME]=tcp:3306",
  228. "-credential_file=/secrets/cloudsql/credentials.json"]
  229. volumes:
  230. - name: data
  231. persistentVolumeClaim:
  232. claimName: gitlab-rails-storage
  233. - name: registry
  234. persistentVolumeClaim:
  235. claimName: gitlab-registry-storage
  236. - name: config
  237. persistentVolumeClaim:
  238. claimName: gitlab-config-storage
  239. - name: patches
  240. configMap:
  241. name: gitlab-patches
  242. - name: cloudsql-oauth-credentials
  243. secret:
  244. secretName: cloudsql-oauth-credentials
  245. - name: ssl-certs
  246. hostPath:
  247. path: /etc/ssl/certs
  248. - name: cloudsql
  249. emptyDir:
  250. - name: gitlab-secrets
  251. secret:
  252. secretName: gitlab-secrets
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement