diff --git a/chart/.gitignore b/chart/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e6b3ed643d846953e94118ea579d3ee30eda8c9e --- /dev/null +++ b/chart/.gitignore @@ -0,0 +1 @@ +charts/* diff --git a/chart/.gitlab-ci.yml b/chart/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..cb02d24e16543c7e51d00909e639238dfc3541e8 --- /dev/null +++ b/chart/.gitlab-ci.yml @@ -0,0 +1,19 @@ +image: registry.gitlab.com/charts/alpine-helm + +stages: + - test + - release + +lint: + stage: test + script: + - helm lint . + except: + - master + +release-chart: + stage: release + script: + - curl --fail --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.com/api/v4/projects/2860651/trigger/pipeline + only: + - master diff --git a/chart/.helmignore b/chart/.helmignore new file mode 100644 index 0000000000000000000000000000000000000000..f0c13194444163d1cba5c67d9e79231a62bc8f44 --- /dev/null +++ b/chart/.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/chart/CONTRIBUTING.md b/chart/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..589986f81fb88cbe8fb80647b6eb2bc1e1cfd89a --- /dev/null +++ b/chart/CONTRIBUTING.md @@ -0,0 +1,26 @@ +## Contributing + +Thank you for your interest in contributing to this GitLab project! We welcome +all contributions. By participating in this project, you agree to abide by the +[code of conduct](#code-of-conduct). + + +## Developer Certificate of Origin + License + +By contributing to GitLab B.V., You accept and agree to the following terms and +conditions for Your present and future Contributions submitted to GitLab B.V. +Except for the license granted herein to GitLab B.V. and recipients of software +distributed by GitLab B.V., You reserve all right, title, and interest in and to +Your Contributions. All Contributions are subject to the following DCO + License +terms. + +[DCO + License](https://gitlab.com/gitlab-org/dco/blob/master/README.md) + +_This notice should stay as the first item in the CONTRIBUTING.md file._ + +## Code of conduct + +We want to create a welcoming environment for everyone who is interested +in contributing. Please visit our [Code of Conduct +page](https://about.gitlab.com/contributing/code-of-conduct) to learn +more about our committment to an open and welcoming environment. diff --git a/chart/Chart.yaml b/chart/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e5a69ecced84fb1bd091df2e2ec36e438aa9348d --- /dev/null +++ b/chart/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +description: GitLab's Auto-deploy Helm Chart +name: auto-deploy-app +version: 0.2.9 +icon: https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-square.png diff --git a/chart/LICENSE b/chart/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a90ea939517d05f44eb4196dcdaba0f57aab15f2 --- /dev/null +++ b/chart/LICENSE @@ -0,0 +1,19 @@ +Copyright GitLab B.V. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/chart/README.md b/chart/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c396cf2081a82e131e0e283429b0600261f122bd --- /dev/null +++ b/chart/README.md @@ -0,0 +1,54 @@ +# GitLab's Auto-deploy Helm Chart + +## Requirements + +- Helm `2.9.0` and above is required in order support `"helm.sh/hook-delete-policy": before-hook-creation` for migrations + +## Configuration + +| Parameter | Description | Default | +| --- | --- | --- | +| replicaCount | | `1` | +| image.repository | | `gitlab.example.com/group/project` | +| image.tag | | `stable` | +| image.pullPolicy | | `Always` | +| image.secrets | | `[name: gitlab-registry]` | +| podAnnotations | Pod annotations | `{}` | +| application.track | | `stable` | +| application.tier | | `web` | +| application.migrateCommand | If present, this variable will run as a shell command within an application Container as a Helm pre-upgrade Hook. Intended to run migration commands. | `nil` | +| application.initializeCommand | If present, this variable will run as shall command within an application Container as a Helm post-install Hook. Intended to run database initialization commands. | `nil` | +| application.secretName | Pass in the name of a Secret which the deployment will [load all key-value pairs from the Secret as environment variables](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables) in the application container. | `nil` | +| application.secretChecksum | Pass in the checksum of the secrets referenced by `application.secretName`. | `nil` | +| hpa.enabled | If true, enables horizontal pod autoscaler. A resource request is also required to be set, such as `resources.requests.cpu: 200m`.| `false` | +| hpa.minReplicas | | `1` | +| hpa.maxReplicas | | `5` | +| hpa.targetCPUUtilizationPercentage | Percentage threshold when HPA begins scaling out pods | `80` | +| gitlab.app | GitLab project slug. | `nil` | +| gitlab.env | GitLab environment slug. | `nil` | +| gitlab.envName | GitLab environment name. | `nil` | +| gitlab.envURL | GitLab environment URL. | `nil` | +| service.enabled | | `true` | +| service.annotations | Service annotations | `{}` | +| service.name | | `web` | +| service.type | | `ClusterIP` | +| service.url | | `http://my.host.com/` | +| service.additionalHosts | If present, this list will add additional hostnames to the server configuration. | `nil` | +| service.commonName | If present, this will define the ssl certificate common name to be used by CertManager. `service.url` and `service.additionalHosts` will be added as Subject Alternative Names (SANs) | `nil` | +| service.externalPort | | `5000` | +| service.internalPort | | `5000` | +| ingress.tls.enabled | If true, enables SSL | `true` | +| ingress.tls.secretName | Name of the secret used to terminate SSL traffic | `""` | +| ingress.annotations | Ingress annotations | `{kubernetes.io/tls-acme: "true", kubernetes.io/ingress.class: "nginx"}` | +| livenessProbe.path | Path to access on the HTTP server on periodic probe of container liveness. | `/` | +| livenessProbe.scheme | Scheme to access the HTTP server (HTTP or HTTPS). | `HTTP` | +| livenessProbe.initialDelaySeconds | # of seconds after the container has started before liveness probes are initiated. | `15` | +| livenessProbe.timeoutSeconds | # of seconds after which the liveness probe times out. | `15` | +| readinessProbe.path | Path to access on the HTTP server on periodic probe of container readiness. | `/` | +| readinessProbe.scheme | Scheme to access the HTTP server (HTTP or HTTPS). | `HTTP` | +| readinessProbe.initialDelaySeconds | # of seconds after the container has started before readiness probes are initiated. | `5` | +| readinessProbe.timeoutSeconds | # of seconds after which the readiness probe times out. | `3` | +| postgresql.enabled | | `true` | +| podDisruptionBudget.enabled | | `false` | +| podDisruptionBudget.maxUnavailable | | `1` | +| podDisruptionBudget.minAvailable | If present, this variable will configure minAvailable in the PodDisruptionBudget. :warning: if you have `replicaCount: 1` and `podDisruptionBudget.minAvailable: 1` `kubectl drain` will be blocked. | `nil` | diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef42bbda93bc99a87ed5b4cd0ba6c86497be815 --- /dev/null +++ b/chart/templates/NOTES.txt @@ -0,0 +1,5 @@ +{{- if .Values.service.enabled -}} +Application should be accessible at: {{ .Values.service.url }} +{{- else -}} +Application will be accessible at: {{ .Values.service.url }} when you deploy stable track. +{{- end -}} diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..913145e6ae42383d3f2810a035fc750dd1b0c7b4 --- /dev/null +++ b/chart/templates/_helpers.tpl @@ -0,0 +1,33 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 24 | 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 | trimSuffix "-app" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "appname" -}} +{{- $releaseName := default .Release.Name .Values.releaseOverride -}} +{{- printf "%s" $releaseName | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "trackableappname" -}} +{{- $trackableName := printf "%s-%s" (include "appname" .) .Values.application.track -}} +{{- $trackableName | trimSuffix "-stable" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Get a hostname from URL +*/}} +{{- define "hostname" -}} +{{- . | trimPrefix "http://" | trimPrefix "https://" | trimSuffix "/" | quote -}} +{{- end -}} diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0e9474472f73440d41032de90387177ae3f850ac --- /dev/null +++ b/chart/templates/deployment.yaml @@ -0,0 +1,124 @@ +{{- if not .Values.application.initializeCommand -}} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "trackableappname" . }} + annotations: + {{ if .Values.gitlab.app }}app.gitlab.com/app: {{ .Values.gitlab.app | quote }}{{ end }} + {{ if .Values.gitlab.env }}app.gitlab.com/env: {{ .Values.gitlab.env | quote }}{{ end }} + labels: + app: {{ template "appname" . }} + track: "{{ .Values.application.track }}" + tier: "{{ .Values.application.tier }}" + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + annotations: + checksum/application-secrets: "{{ .Values.application.secretChecksum }}" + {{ if .Values.gitlab.app }}app.gitlab.com/app: {{ .Values.gitlab.app | quote }}{{ end }} + {{ if .Values.gitlab.env }}app.gitlab.com/env: {{ .Values.gitlab.env | quote }}{{ end }} +{{- if .Values.podAnnotations }} +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + labels: + app: {{ template "appname" . }} + track: "{{ .Values.application.track }}" + tier: "{{ .Values.application.tier }}" + release: {{ .Release.Name }} + spec: + imagePullSecrets: +{{ toYaml .Values.image.secrets | indent 10 }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.application.secretName }} + envFrom: + - secretRef: + name: {{ .Values.application.secretName }} + {{- end }} + env: + - name: DATABASE_URL + value: {{ .Values.application.database_url | quote }} + - name: GITLAB_ENVIRONMENT_NAME + value: {{ .Values.gitlab.envName }} + - name: GITLAB_ENVIRONMENT_URL + value: {{ .Values.gitlab.envURL }} + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: REDIS_SERVICE_NAME + value: {{ template "fullname" . }}-redis + ports: + - name: "{{ .Values.service.name }}" + containerPort: {{ .Values.service.internalPort }} + livenessProbe: + httpGet: + path: {{ .Values.livenessProbe.path }} + port: {{ .Values.service.internalPort }} + scheme: {{ .Values.livenessProbe.scheme }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + readinessProbe: + httpGet: + path: {{ .Values.readinessProbe.path }} + port: {{ .Values.service.internalPort }} + scheme: {{ .Values.readinessProbe.scheme }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + resources: +{{ toYaml .Values.resources | indent 12 }} +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "trackableappname" . }}-redis + annotations: + {{ if .Values.gitlab.app }}app.gitlab.com/app: {{ .Values.gitlab.app | quote }}{{ end }} + {{ if .Values.gitlab.env }}app.gitlab.com/env: {{ .Values.gitlab.env | quote }}{{ end }} + labels: + app: {{ template "appname" . }}-redis + track: "{{ .Values.application.track }}" + tier: "{{ .Values.application.tier }}" + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "appname" . }}-redis + track: "{{ .Values.application.track }}" + tier: "{{ .Values.application.tier }}" + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }}-redis + image: "redis:latest" + ports: + - containerPort: 6379 + livenessProbe: + exec: + command: + - sh + - -c + - redis-cli ping + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + readinessProbe: + exec: + command: + - sh + - -c + - redis-cli ping + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + resources: +{{ toYaml .Values.resources | indent 12 }} +{{- end -}} \ No newline at end of file diff --git a/chart/templates/hpa.yaml b/chart/templates/hpa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f4cb3adea3b5813a5d3f2b5a30eb82fe84d6a0c1 --- /dev/null +++ b/chart/templates/hpa.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.hpa.enabled .Values.resources.requests -}} +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "appname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + scaleTargetRef: + kind: Deployment + name: {{ template "appname" . }} + apiVersion: apps/v1beta1 + minReplicas: {{ .Values.hpa.minReplicas }} + maxReplicas: {{ .Values.hpa.maxReplicas }} + targetCPUUtilizationPercentage: {{ .Values.hpa.targetCPUUtilizationPercentage }} +{{- end -}} diff --git a/chart/templates/ingress.yaml b/chart/templates/ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8a1633c095e92dc9e0a21f38d824bf09bf286426 --- /dev/null +++ b/chart/templates/ingress.yaml @@ -0,0 +1,51 @@ +{{- if .Values.service.enabled -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "appname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version| replace "+" "_" }}" + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- if .Values.ingress.annotations }} + annotations: +{{ toYaml .Values.ingress.annotations | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls.enabled }} + tls: + - hosts: +{{- if .Values.service.commonName }} + - {{ template "hostname" .Values.service.commonName }} +{{- end }} + - {{ template "hostname" .Values.service.url }} +{{- if .Values.service.additionalHosts }} +{{- range $host := .Values.service.additionalHosts }} + - {{ $host }} +{{- end -}} +{{- end }} + secretName: {{ .Values.ingress.tls.secretName | default (printf "%s-tls" (include "fullname" .)) }} +{{- end }} + rules: + - host: {{ template "hostname" .Values.service.url }} + http: + &httpRule + paths: + - path: / + backend: + serviceName: {{ template "fullname" . }} + servicePort: {{ .Values.service.externalPort }} +{{- if .Values.service.commonName }} + - host: {{ template "hostname" .Values.service.commonName }} + http: + <<: *httpRule +{{- end -}} +{{- if .Values.service.additionalHosts }} +{{- range $host := .Values.service.additionalHosts }} + - host: {{ $host }} + http: + <<: *httpRule +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/chart/templates/pdb.yaml b/chart/templates/pdb.yaml new file mode 100644 index 0000000000000000000000000000000000000000..69bb2ed738e404493b6a450eb4244872409113a1 --- /dev/null +++ b/chart/templates/pdb.yaml @@ -0,0 +1,22 @@ +{{- if .Values.podDisruptionBudget.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "appname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: +{{- if .Values.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} +{{- end }} +{{- if .Values.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} +{{- end }} + selector: + matchLabels: + app: {{ template "appname" . }} + release: {{ .Release.Name }} +{{- end }} diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3013a2ebca6f7d58cdc684c85ec637d2e6850c73 --- /dev/null +++ b/chart/templates/service.yaml @@ -0,0 +1,43 @@ +{{- if .Values.service.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} +{{- if .Values.service.annotations }} + annotations: +{{ toYaml .Values.service.annotations | indent 4 }} +{{- end }} + labels: + app: {{ template "appname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app: {{ template "appname" . }} + tier: "{{ .Values.application.tier }}" +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }}-redis + labels: + app: {{ template "appname" . }}-redis + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + ports: + - port: 6379 + targetPort: 6379 + protocol: TCP + selector: + app: {{ template "appname" . }}-redis + tier: "{{ .Values.application.tier }}" +{{- end -}} diff --git a/chart/templates/worker-deployment.yaml b/chart/templates/worker-deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..56618eec2cee83eec798e7a1f6c96531188a285c --- /dev/null +++ b/chart/templates/worker-deployment.yaml @@ -0,0 +1,82 @@ +{{- if and (not .Values.application.initializeCommand) .Values.workers -}} +apiVersion: v1 +kind: List +items: +{{- range $workerName, $workerConfig := .Values.workers }} +- apiVersion: extensions/v1beta1 + kind: Deployment + metadata: + name: {{ template "trackableappname" $ }}-{{ $workerName }} + annotations: + {{ if $.Values.gitlab.app }}app.gitlab.com/app: {{ $.Values.gitlab.app | quote }}{{ end }} + {{ if $.Values.gitlab.env }}app.gitlab.com/env: {{ $.Values.gitlab.env | quote }}{{ end }} + labels: + track: "{{ $.Values.application.track }}" + tier: worker + chart: "{{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}" + release: {{ $.Release.Name }} + heritage: {{ $.Release.Service }} + spec: + replicas: {{ $workerConfig.replicaCount }} + template: + metadata: + annotations: + checksum/application-secrets: "{{ $.Values.application.secretChecksum }}" + {{ if $.Values.gitlab.app }}app.gitlab.com/app: {{ $.Values.gitlab.app | quote }}{{ end }} + {{ if $.Values.gitlab.env }}app.gitlab.com/env: {{ $.Values.gitlab.env | quote }}{{ end }} + {{- if $.Values.podAnnotations }} + {{ toYaml $.Values.podAnnotations | indent 10 }} + {{- end }} + labels: + track: "{{ $.Values.application.track }}" + tier: worker + release: {{ $.Release.Name }} + spec: + imagePullSecrets: + {{ toYaml $.Values.image.secrets | indent 12 }} + terminationGracePeriodSeconds: {{ $workerConfig.terminationGracePeriodSeconds }} + containers: + - name: {{ $.Chart.Name }}-{{ $workerName }} + image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}" + command: + {{- range $workerConfig.command }} + - {{ . }} + {{- end }} + imagePullPolicy: {{ $.Values.image.pullPolicy }} + {{- if $.Values.application.secretName }} + envFrom: + - secretRef: + name: {{ $.Values.application.secretName }} + {{- end }} + env: + - name: DATABASE_URL + value: {{ $.Values.application.database_url | quote }} + - name: GITLAB_ENVIRONMENT_NAME + value: {{ $.Values.gitlab.envName }} + livenessProbe: + httpGet: + path: {{ $.Values.livenessProbe.path }} + port: {{ $.Values.service.internalPort }} + scheme: {{ $.Values.livenessProbe.scheme }} + initialDelaySeconds: {{ $.Values.livenessProbe.initialDelaySeconds }} + timeoutSeconds: {{ $.Values.livenessProbe.timeoutSeconds }} + readinessProbe: + httpGet: + path: {{ $.Values.readinessProbe.path }} + port: {{ $.Values.service.internalPort }} + scheme: {{ $.Values.readinessProbe.scheme }} + initialDelaySeconds: {{ $.Values.readinessProbe.initialDelaySeconds }} + timeoutSeconds: {{ $.Values.readinessProbe.timeoutSeconds }} + {{- if $workerConfig.preStopCommand }} + lifecycle: + preStop: + exec: + command: + {{- range $workerConfig.preStopCommand }} + - {{ . }} + {{- end }} + {{- end }} + resources: + {{ toYaml $.Values.resources | indent 14 }} +{{- end -}} +{{- end -}} diff --git a/chart/values.yaml b/chart/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a53604d4c971be8f529cc2737c4883113be16ec8 --- /dev/null +++ b/chart/values.yaml @@ -0,0 +1,87 @@ +# Default values for chart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +image: + repository: gitlab.example.com/group/project + tag: stable + pullPolicy: Always + secrets: + - name: gitlab-registry +podAnnotations: {} +application: + track: stable + tier: web + migrateCommand: + initializeCommand: + secretName: + secretChecksum: +hpa: + enabled: false + minReplicas: 1 + maxReplicas: 5 + targetCPUUtilizationPercentage: 80 +gitlab: + app: + env: + envName: + envURL: +service: + enabled: true + annotations: {} + name: web + type: ClusterIP + url: http://my.host.com/ + additionalHosts: + commonName: + externalPort: 5000 + internalPort: 5000 +ingress: + tls: + enabled: true + secretName: "" + annotations: + kubernetes.io/tls-acme: "true" + kubernetes.io/ingress.class: "nginx" +livenessProbe: + path: "/" + initialDelaySeconds: 15 + timeoutSeconds: 15 + scheme: "HTTP" +readinessProbe: + path: "/" + initialDelaySeconds: 5 + timeoutSeconds: 3 + scheme: "HTTP" +postgresql: + enabled: true +resources: +# limits: +# cpu: 100m +# memory: 128Mi + requests: +# cpu: 100m +# memory: 128Mi + +## Configure PodDisruptionBudget +## ref: https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ +# +podDisruptionBudget: + enabled: false + # minAvailable: 1 + maxUnavailable: 1 + +workers: + # worker: + # replicaCount: 1 + # terminationGracePeriodSeconds: 60 + # command: + # - /bin/herokuish + # - procfile + # - start + # - worker + # preStopCommand: + # - /bin/herokuish + # - procfile + # - start + # - stop_worker diff --git a/service-configs/start.sh b/service-configs/start.sh index 1c9857581afb225eeffec8829112ec053dd7708c..7e57f29c09e740f2e23ace96794f721211c2427f 100755 --- a/service-configs/start.sh +++ b/service-configs/start.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Set the redis hostname +sed -i "s/REDIS_HOST=/REDIS_HOST=${REDIS_SERVICE_NAME}.${POD_NAMESPACE}/g" .env + /etc/init.d/php7.3-fpm start /etc/init.d/nginx start