From 668fcdf724b04bd7d3cf271f55ba8be420859d25 Mon Sep 17 00:00:00 2001 From: Quentin Rousseau Date: Mon, 3 Apr 2017 15:30:39 -0700 Subject: [PATCH] Add GitLab-EE (Enterprise Edition) 9.0.0 (#854) * Add GitLab-EE (Enterprise Edition) 9.0.0 - Synced with GitLab-CE 9.0.0 version 0.1.6 * Update Community Edition to Enterprise Edition in README.md --- stable/gitlab-ee/.helmignore | 21 ++++ stable/gitlab-ee/Chart.yaml | 18 ++++ stable/gitlab-ee/README.md | 67 ++++++++++++ stable/gitlab-ee/requirements.lock | 9 ++ stable/gitlab-ee/requirements.yaml | 7 ++ stable/gitlab-ee/templates/NOTES.txt | 53 +++++++++ stable/gitlab-ee/templates/_helpers.tpl | 32 ++++++ stable/gitlab-ee/templates/configmap.yaml | 33 ++++++ stable/gitlab-ee/templates/data-pvc.yaml | 18 ++++ stable/gitlab-ee/templates/deployment.yaml | 118 +++++++++++++++++++++ stable/gitlab-ee/templates/etc-pvc.yaml | 18 ++++ stable/gitlab-ee/templates/secrets.yaml | 19 ++++ stable/gitlab-ee/templates/svc.yaml | 23 ++++ stable/gitlab-ee/values.yaml | 101 ++++++++++++++++++ 14 files changed, 537 insertions(+) create mode 100644 stable/gitlab-ee/.helmignore create mode 100755 stable/gitlab-ee/Chart.yaml create mode 100644 stable/gitlab-ee/README.md create mode 100644 stable/gitlab-ee/requirements.lock create mode 100644 stable/gitlab-ee/requirements.yaml create mode 100644 stable/gitlab-ee/templates/NOTES.txt create mode 100644 stable/gitlab-ee/templates/_helpers.tpl create mode 100644 stable/gitlab-ee/templates/configmap.yaml create mode 100644 stable/gitlab-ee/templates/data-pvc.yaml create mode 100644 stable/gitlab-ee/templates/deployment.yaml create mode 100644 stable/gitlab-ee/templates/etc-pvc.yaml create mode 100644 stable/gitlab-ee/templates/secrets.yaml create mode 100644 stable/gitlab-ee/templates/svc.yaml create mode 100644 stable/gitlab-ee/values.yaml diff --git a/stable/gitlab-ee/.helmignore b/stable/gitlab-ee/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/gitlab-ee/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/stable/gitlab-ee/Chart.yaml b/stable/gitlab-ee/Chart.yaml new file mode 100755 index 0000000000..422c742cf4 --- /dev/null +++ b/stable/gitlab-ee/Chart.yaml @@ -0,0 +1,18 @@ +name: gitlab-ee +version: 0.1.6 +description: GitLab Enterprise Edition +keywords: +- git +- ci +- deploy +- issue tracker +- code review +- wiki +home: https://about.gitlab.com +sources: +- https://hub.docker.com/r/gitlab/gitlab-ee/ +- https://docs.gitlab.com/omnibus/ +icon: https://gitlab.com/uploads/group/avatar/6543/gitlab-logo-square.png +maintainers: +- name: Quentin Rousseau + email: contact@quent.in diff --git a/stable/gitlab-ee/README.md b/stable/gitlab-ee/README.md new file mode 100644 index 0000000000..5ce654424d --- /dev/null +++ b/stable/gitlab-ee/README.md @@ -0,0 +1,67 @@ +# GitLab Enterprise Edition + +[GitLab Enterprise Edition](https://about.gitlab.com/) is an application to code, test, and deploy code together. It provides Git repository management with fine grained access controls, code reviews, issue tracking, activity feeds, wikis, and continuous integration. + +## Introduction + +This chart stands up a GitLab Enterprise Edition install. This includes: + +- A [GitLab Omnibus](https://docs.gitlab.com/omnibus/) Pod +- Redis +- Postgresql + +## Prerequisites + +- _At least_ 3 GB of RAM available on your cluster, in chunks of 1 GB +- Kubernetes 1.4+ with Beta APIs enabled +- PV provisioner support in the underlying infrastructure +- The ability to point a DNS entry or URL at your GitLab install + +## Installing the Chart + +To install the chart with the release name `my-release` run: + +```bash +$ helm install --name my-release \ + --set externalUrl=http://your-domain.com/ stable/gitlab-ee +``` + +Note that you _must_ pass in externalUrl, or you'll end up with a non-functioning release. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```bash +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +Refer to [values.yaml](values.yaml) for the full run-down on defaults. These are a mixture of Kubernetes and GitLab-related directives. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install --name my-release \ + --set externalUrl=http://your-domain.com/,gitlabRootPassword=pass1234 \ + stable/gitlab-ee +``` + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install --name my-release -f values.yaml stable/gitlab-ee +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Persistence + +By default, persistence of GitLab data and configuration happens using PVCs. If you know that you'll need a larger amount of space, make _sure_ to look at the `persistence` section in [values.yaml](values.yaml). + +> *"If you disable persistence, the contents of your volume(s) will only last as long as the Pod does. Upgrading or changing certain settings may lead to data loss without persistence."* diff --git a/stable/gitlab-ee/requirements.lock b/stable/gitlab-ee/requirements.lock new file mode 100644 index 0000000000..13dab54920 --- /dev/null +++ b/stable/gitlab-ee/requirements.lock @@ -0,0 +1,9 @@ +dependencies: +- name: redis + repository: https://kubernetes-charts.storage.googleapis.com/ + version: 0.4.6 +- name: postgresql + repository: https://kubernetes-charts.storage.googleapis.com/ + version: 0.6.0 +digest: sha256:29a72c03bd64cb59eecbaadd8bec8df5802208e57c05dbacbfb86fe8d3bfb597 +generated: 2017-03-23T13:20:30.948223656-07:00 diff --git a/stable/gitlab-ee/requirements.yaml b/stable/gitlab-ee/requirements.yaml new file mode 100644 index 0000000000..5b2bb59395 --- /dev/null +++ b/stable/gitlab-ee/requirements.yaml @@ -0,0 +1,7 @@ +dependencies: +- name: redis + version: 0.4.6 + repository: https://kubernetes-charts.storage.googleapis.com/ +- name: postgresql + version: 0.6.0 + repository: https://kubernetes-charts.storage.googleapis.com/ diff --git a/stable/gitlab-ee/templates/NOTES.txt b/stable/gitlab-ee/templates/NOTES.txt new file mode 100644 index 0000000000..edbb164edb --- /dev/null +++ b/stable/gitlab-ee/templates/NOTES.txt @@ -0,0 +1,53 @@ +{{- if default "" .Values.externalUrl }} +1. Get your GitLab URL by running: + +{{- if contains "NodePort" .Values.serviceType }} + + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP/ + +{{- else if contains "LoadBalancer" .Values.serviceType }} + + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + Watch the status with: 'kubectl get svc -w {{ template "fullname" . }}' + + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP/ +{{- else if contains "ClusterIP" .Values.serviceType }} + + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}") + echo http://127.0.0.1:8080/ + kubectl port-forward $POD_NAME 8080:80 +{{- end }} + +{{- if default "" .Values.gitlabRootPassword }} + +2. Login as the root user: + + Username: root + Password: {{ .Values.gitlabRootPassword }} +{{ else }} + +2. Set your admin user's password on your first visit to your install. Then + login as: + + Username: root + Password: +{{- end }} + +3. Point a DNS entry at your install to ensure that your specified + external URL is reachable: + + {{ default "UNSPECIFIED" .Values.externalUrl }} + +{{- else -}} +############################################################################## +## WARNING: You did not specify an externalUrl in your 'helm install' call. ## +############################################################################## + +This deployment will be incomplete until you provide the URL that your +GitLab install will be reachable to your users under: + + helm upgrade {{ .Release.Name }} \ + --set externalUrl=http://your-domain.com stable/gitlab-ee +{{- end -}} diff --git a/stable/gitlab-ee/templates/_helpers.tpl b/stable/gitlab-ee/templates/_helpers.tpl new file mode 100644 index 0000000000..82671a790e --- /dev/null +++ b/stable/gitlab-ee/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified postgresql name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "postgresql.fullname" -}} +{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified redis name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "redis.fullname" -}} +{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/stable/gitlab-ee/templates/configmap.yaml b/stable/gitlab-ee/templates/configmap.yaml new file mode 100644 index 0000000000..d8f4770cee --- /dev/null +++ b/stable/gitlab-ee/templates/configmap.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + ## This is used by GitLab Omnibus as the primary means of configuration. + ## ref: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template + ## + gitlab_omnibus_config: | + external_url ENV['EXTERNAL_URL']; + root_pass = ENV['GITLAB_ROOT_PASSWORD']; + gitlab_rails['initial_root_password'] = root_pass unless root_pass.to_s == ''; + postgresql['enable'] = false; + gitlab_rails['db_host'] = ENV['DB_HOST']; + gitlab_rails['db_password'] = ENV['DB_PASSWORD']; + gitlab_rails['db_username'] = ENV['DB_USER']; + gitlab_rails['db_database'] = ENV['DB_DATABASE']; + redis['enable'] = false; + gitlab_rails['redis_host'] = ENV['REDIS_HOST']; + gitlab_rails['redis_password'] = ENV['REDIS_PASSWORD']; + unicorn['worker_processes'] = 2; + manage_accounts['enable'] = true; + manage_storage_directories['manage_etc'] = false; + gitlab_shell['auth_file'] = '/gitlab-data/ssh/authorized_keys'; + git_data_dir '/gitlab-data/git-data'; + gitlab_rails['shared_path'] = '/gitlab-data/shared'; + gitlab_rails['uploads_directory'] = '/gitlab-data/uploads'; + gitlab_ci['builds_directory'] = '/gitlab-data/builds'; diff --git a/stable/gitlab-ee/templates/data-pvc.yaml b/stable/gitlab-ee/templates/data-pvc.yaml new file mode 100644 index 0000000000..2c8624a5e9 --- /dev/null +++ b/stable/gitlab-ee/templates/data-pvc.yaml @@ -0,0 +1,18 @@ +{{- if .Values.persistence.gitlabData.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "fullname" . }}-data + annotations: + {{- if .Values.persistence.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} + {{- else }} + volume.alpha.kubernetes.io/storage-class: default + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.gitlabData.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.gitlabData.size | quote }} +{{- end }} diff --git a/stable/gitlab-ee/templates/deployment.yaml b/stable/gitlab-ee/templates/deployment.yaml new file mode 100644 index 0000000000..0db21741cb --- /dev/null +++ b/stable/gitlab-ee/templates/deployment.yaml @@ -0,0 +1,118 @@ +{{- if default "" .Values.externalUrl }} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + replicas: 1 + template: + metadata: + labels: + app: {{ template "fullname" . }} + spec: + containers: + - name: {{ template "fullname" . }} + image: {{ .Values.image }} + imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} + env: + ## General GitLab Configs + ## + # This is a free-form env var that GitLab Omnibus uses to configure + # everything. We're passing this in from a configmap and pulling some + # of the values from the env vars defined below. This is done to + # avoid leaving secrets visible in kubectl. + - name: GITLAB_OMNIBUS_CONFIG + valueFrom: + configMapKeyRef: + name: {{ template "fullname" . }} + key: gitlab_omnibus_config + - name: GITLAB_ROOT_PASSWORD + {{- if default "" .Values.gitlabRootPassword }} + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: gitlab-root-password + {{ end }} + - name: EXTERNAL_URL + value: {{ default "" .Values.externalUrl | quote }} + ## DB configuration + ## + - name: DB_HOST + value: {{ template "postgresql.fullname" . }} + - name: DB_USER + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: db-user + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: db-password + - name: DB_DATABASE + value: {{ .Values.postgresql.postgresDatabase | quote }} + ## Redis configuration + ## + - name: REDIS_HOST + value: {{ template "redis.fullname" . }} + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: redis-password + ports: + - name: ssh + containerPort: 22 + - name: http + containerPort: 80 + - name: https + containerPort: 443 + livenessProbe: + httpGet: + path: /help + port: http + # This pod takes a very long time to start up. Be cautious when + # lowering this value to avoid Pod death during startup. + initialDelaySeconds: 200 + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 10 + readinessProbe: + httpGet: + path: /help + port: http + initialDelaySeconds: 30 + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + volumeMounts: + - name: gitlab-etc + mountPath: /etc/gitlab + - name: gitlab-data + mountPath: /gitlab-data + resources: +{{ toYaml .Values.resources | indent 10 }} + volumes: + - name: gitlab-etc + {{- if .Values.persistence.gitlabEtc.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }}-etc + {{- else }} + emptyDir: {} + {{- end }} + - name: gitlab-data + {{- if .Values.persistence.gitlabData.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }}-data + {{- else }} + emptyDir: {} + {{- end }} +{{ else }} +{{ end }} diff --git a/stable/gitlab-ee/templates/etc-pvc.yaml b/stable/gitlab-ee/templates/etc-pvc.yaml new file mode 100644 index 0000000000..d1f835e3d6 --- /dev/null +++ b/stable/gitlab-ee/templates/etc-pvc.yaml @@ -0,0 +1,18 @@ +{{- if .Values.persistence.gitlabEtc.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "fullname" . }}-etc + annotations: + {{- if .Values.persistence.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} + {{- else }} + volume.alpha.kubernetes.io/storage-class: default + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.gitlabEtc.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.gitlabEtc.size | quote }} +{{- end }} diff --git a/stable/gitlab-ee/templates/secrets.yaml b/stable/gitlab-ee/templates/secrets.yaml new file mode 100644 index 0000000000..f76ba8e69c --- /dev/null +++ b/stable/gitlab-ee/templates/secrets.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + {{- if default "" .Values.gitlabRootPassword }} + # Defaulting to a non-sensical value to silence b64enc warning. We'll never + # actually use this default due to the if statement. + gitlab-root-password: {{ default "ignore" .Values.gitlabRootPassword | b64enc | quote }} + {{ end }} + db-user: {{ .Values.postgresql.postgresUser | b64enc | quote }} + db-password: {{ .Values.postgresql.postgresPassword | b64enc | quote }} + redis-password: {{ .Values.redis.redisPassword | b64enc | quote }} diff --git a/stable/gitlab-ee/templates/svc.yaml b/stable/gitlab-ee/templates/svc.yaml new file mode 100644 index 0000000000..f60e573969 --- /dev/null +++ b/stable/gitlab-ee/templates/svc.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + type: {{ .Values.serviceType }} + ports: + - name: ssh + port: {{ .Values.sshPort | int }} + targetPort: ssh + - name: http + port: {{ .Values.httpPort | int }} + targetPort: http + - name: https + port: {{ .Values.httpsPort | int }} + targetPort: https + selector: + app: {{ template "fullname" . }} diff --git a/stable/gitlab-ee/values.yaml b/stable/gitlab-ee/values.yaml new file mode 100644 index 0000000000..f96c74d2f6 --- /dev/null +++ b/stable/gitlab-ee/values.yaml @@ -0,0 +1,101 @@ +## GitLab EE image +## ref: https://hub.docker.com/r/gitlab/gitlab-ee/tags/ +## +image: gitlab/gitlab-ee:9.0.0-ee.0 + +## Specify a imagePullPolicy +## 'Always' if imageTag is 'latest', else set to 'IfNotPresent' +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## +# imagePullPolicy: + +## The URL (with protocol) that your users will use to reach the install. +## ref: https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab +## +#externalUrl: http://your-domain.com/ + +## Change the initial default admin password if set. If not set, you'll be +## able to set it when you first visit your install. +## +#gitlabRootPassword: "" + +## For minikube, set this to NodePort, elsewhere use LoadBalancer +## ref: http://kubernetes.io/docs/user-guide/services/#publishing-services---service-types +## +serviceType: LoadBalancer + +## Configure external service ports +## ref: http://kubernetes.io/docs/user-guide/services/ +sshPort: 22 +httpPort: 80 +httpsPort: 443 + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + ## GitLab requires a good deal of resources. We have split out Postgres and + ## redis, which helps some. Refer to the guidelines for larger installs. + ## ref: https://docs.gitlab.com/ee/install/requirements.html#hardware-requirements + requests: + memory: 1Gi + cpu: 500m + limits: + memory: 2Gi + cpu: 1 + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## ref: https://docs.gitlab.com/ee/install/requirements.html#storage +## +persistence: + ## This volume persists generated configuration files, keys, and certs. + ## + gitlabEtc: + enabled: true + size: 1Gi + ## If defined, volume.beta.kubernetes.io/storage-class: + ## Default: volume.alpha.kubernetes.io/storage-class: default + ## + # storageClass: + accessMode: ReadWriteOnce + ## This volume is used to store git data and other project files. + ## ref: https://docs.gitlab.com/omnibus/settings/configuration.html#storing-git-data-in-an-alternative-directory + ## + gitlabData: + enabled: true + size: 10Gi + ## If defined, volume.beta.kubernetes.io/storage-class: + ## Default: volume.alpha.kubernetes.io/storage-class: default + ## + # storageClass: + accessMode: ReadWriteOnce + +## Configuration values for the postgresql dependency. +## ref: https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md +## +postgresql: + # 9.6 is the newest supported version for the GitLab container + imageTag: "9.6" + cpu: 1000m + memory: 1Gi + + postgresUser: gitlab + postgresPassword: gitlab + postgresDatabase: gitlab + + persistence: + size: 10Gi + +## Configuration values for the redis dependency. +## ref: https://github.com/kubernetes/charts/blob/master/stable/redis/README.md +## +redis: + redisPassword: "gitlab" + + resources: + requests: + memory: 1Gi + + persistence: + size: 10Gi