-
Notifications
You must be signed in to change notification settings - Fork 17
Add helm chart #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add helm chart #227
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,43 @@ | ||||||
| # Ralph Helm Chart | ||||||
|
|
||||||
| This is the helm chart used to deploy ralph application. | ||||||
|
|
||||||
| All default values are in `values.yaml`. | ||||||
|
|
||||||
| ⚠️ This helm chart is still under active development and is not suitable for production use. | ||||||
|
|
||||||
| ## Review manifest | ||||||
|
|
||||||
| To generate and review your manifest, under `./src/helm` run the following command: | ||||||
| ``` | ||||||
| $ helm template . | ||||||
| ``` | ||||||
|
|
||||||
| ## Deploy chart | ||||||
| ### Requirements | ||||||
| * Helm | ||||||
| * Needed Kubernetes context selected | ||||||
|
|
||||||
|
|
||||||
| ### Environments | ||||||
|
|
||||||
| Please note that with Helm, you can extend the values files. There is no need to copy/paste all the default values and you can replace a value by setting it in your env file. | ||||||
|
|
||||||
| You can add an environment values file under the root of the chart, _e.g._ `dev-values.yaml` and set only needed customizations. | ||||||
|
|
||||||
|
|
||||||
| This chart use the file `vaul.yaml` to set the mandatory secrets for the application | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ### How to | ||||||
|
|
||||||
| Under `./src/helm` | ||||||
|
|
||||||
| ``` | ||||||
| $ helm upgrade --install RELEASE_NAME ralph/. --values ralph/dev-values.yaml | ||||||
| ``` | ||||||
|
|
||||||
| Tips: | ||||||
|
waelctl marked this conversation as resolved.
|
||||||
|
|
||||||
| * use `--values` to pass an env values file to extend and/or replace the default values | ||||||
| * `--set var=value` to replace one var/value | ||||||
| * `--dry-run` to verify your manifest before deploying | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: v2 | ||
| name: ralph | ||
| description: A Helm chart for Ralph | ||
|
|
||
| # A chart can be either an 'application' or a 'library' chart. | ||
| # | ||
| # Application charts are a collection of templates that can be packaged into versioned archives | ||
| # to be deployed. | ||
| # | ||
| # Library charts provide useful utilities or functions for the chart developer. They're included as | ||
| # a dependency of application charts to inject those utilities and functions into the rendering | ||
| # pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
| type: application | ||
|
|
||
| # This is the chart version. This version number should be incremented each time you make changes | ||
| # to the chart and its templates, including the app version. | ||
| # Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
| version: 0.1.0 | ||
|
|
||
| # This is the version number of the application being deployed. This version number should be | ||
| # incremented each time you make changes to the application. Versions are not expected to | ||
| # follow Semantic Versioning. They should reflect the version the application is using. | ||
| # It is recommended to use it with quotes. | ||
| appVersion: "3.0.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "ralph.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). | ||
| If release name contains chart name it will be used as a full name. | ||
| */}} | ||
| {{- define "ralph.fullname" -}} | ||
| {{- if .Values.fullnameOverride }} | ||
| {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- $name := default .Chart.Name .Values.nameOverride }} | ||
| {{- if contains $name .Release.Name }} | ||
| {{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
jmaupetit marked this conversation as resolved.
|
||
|
|
||
| {{/* | ||
| Create chart name and version as used by the chart label. | ||
| */}} | ||
| {{- define "ralph.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "ralph.labels" -}} | ||
| helm.sh/chart: {{ include "ralph.chart" . }} | ||
| {{ include "ralph.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Selector labels | ||
| */}} | ||
| {{- define "ralph.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "ralph.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| app: ralph | ||
| service: app | ||
| {{- end }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| {{- if .Values.ralph_cronjobs }} | ||
| {{- range $job := .Values.ralph_cronjobs }} | ||
| {{- with $ -}} | ||
| --- | ||
| apiVersion: batch/v1 | ||
| kind: CronJob | ||
| metadata: | ||
| name: "ralph-job-{{ $job.name }}" | ||
| namespace: {{ .Values.namespace }} | ||
| labels: | ||
| {{- include "ralph.labels" . | nindent 4 }} | ||
| type: job | ||
| spec: | ||
| schedule: {{ $job.schedule | quote }} | ||
| successfulJobsHistoryLimit: 2 | ||
| concurrencyPolicy: Forbid | ||
| failedJobsHistoryLimit: 1 | ||
| suspend: false | ||
| jobTemplate: | ||
| spec: | ||
| template: | ||
| metadata: | ||
| name: "ralph-job-{{ $job.name }}" | ||
| labels: | ||
| {{- include "ralph.labels" . | nindent 12 }} | ||
| type: job | ||
| spec: | ||
| restartPolicy: Never | ||
| {{- with .Values.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| securityContext: | ||
| {{- toYaml .Values.securityContext | nindent 12 }} | ||
| containers: | ||
| - name: "ralph-job-{{ $job.name }}" | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
| command: | ||
| - bash | ||
| - "-c" | ||
| {{- with $job.command }} | ||
| {{ toYaml . | nindent 16 }} | ||
| {{- end }} | ||
| env: | ||
| - name: RALPH_APP_DIR | ||
| value: "/app/.ralph" | ||
| envFrom: | ||
| - secretRef: | ||
| name: {{ .Values.ralph.secret_name }} | ||
| volumeMounts: | ||
| - name: ralph-v-history | ||
| mountPath: /app/.ralph | ||
| {{- if .Values.ralph.elastic.mount_ca_secret }} | ||
| - name: es-ca-certificate | ||
| mountPath: /usr/local/share/ca-certificates/ | ||
| {{- end }} | ||
| - name: lrs-auth | ||
| mountPath: /var/run/ralph/ | ||
| volumes: | ||
| - name: ralph-v-history | ||
| persistentVolumeClaim: | ||
| claimName: ralph-pvc-history | ||
| {{- if .Values.ralph.elastic.mount_ca_secret }} | ||
| - name: es-ca-certificate | ||
| secret: | ||
| secretName: {{ .Values.ralph.elastic.ca_secret_name }} | ||
| {{- end }} | ||
| - name: lrs-auth | ||
| secret: | ||
| secretName: {{ .Values.ralph_lrs.auth_secret_name }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{ include "ralph.fullname" . }} | ||
| namespace: {{ .Values.namespace }} | ||
| labels: | ||
| {{- include "ralph.labels" . | nindent 4 }} | ||
| spec: | ||
| {{- if not .Values.autoscaling.enabled }} | ||
| replicas: {{ .Values.replicaCount }} | ||
| {{- end }} | ||
| selector: | ||
| matchLabels: | ||
| {{- include "ralph.selectorLabels" . | nindent 6 }} | ||
| template: | ||
| metadata: | ||
| {{- with .Values.podAnnotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| labels: | ||
| {{- include "ralph.selectorLabels" . | nindent 8 }} | ||
| spec: | ||
| {{- with .Values.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| securityContext: | ||
| {{- toYaml .Values.securityContext | nindent 8 }} | ||
| containers: | ||
| - name: {{ .Chart.Name }} | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
| command: | ||
| {{- toYaml .Values.ralph_lrs.command | nindent 12 }} | ||
| resources: | ||
| {{- toYaml .Values.resources | nindent 12 }} | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /__heartbeat__ | ||
| port: {{ .Values.ralph_lrs.port }} | ||
| httpHeaders: | ||
| - name: Host | ||
| value: "lrs.{{ .Values.namespace }}.{{ .Values.ralph_lrs.domain_name }}" | ||
| initialDelaySeconds: 15 | ||
| periodSeconds: 30 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /__lbheartbeat__ | ||
| port: {{ .Values.ralph_lrs.port }} | ||
| httpHeaders: | ||
| - name: Host | ||
| value: "lrs.{{ .Values.namespace }}.{{ .Values.ralph_lrs.domain_name }}" | ||
| initialDelaySeconds: 5 | ||
| periodSeconds: 5 | ||
| env: | ||
| - name: RALPH_APP_DIR | ||
| value: "/app/.ralph" | ||
| - name: RALPH_AUTH_FILE | ||
| value: "/var/run/ralph/auth.json" | ||
| - name: RALPH_BACKENDS__DATABASE__ES__CLIENT_OPTIONS__ca_certs | ||
| value: "/usr/local/share/ca-certificates/es-cluster.pem" | ||
|
Comment on lines
+61
to
+62
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned yesterday, this can be improved thanks to a |
||
| envFrom: | ||
| - secretRef: | ||
| name: {{ .Values.ralph.secret_name }} | ||
| volumeMounts: | ||
| - name: ralph-v-history | ||
| mountPath: /app/.ralph | ||
| {{- if .Values.ralph.elastic.mount_ca_secret }} | ||
| - name: es-ca-certificate | ||
| mountPath: /usr/local/share/ca-certificates/ | ||
| {{- end }} | ||
| - name: lrs-auth | ||
| mountPath: /var/run/ralph/ | ||
| volumes: | ||
| - name: ralph-v-history | ||
| persistentVolumeClaim: | ||
| claimName: ralph-pvc-history | ||
| {{- if .Values.ralph.elastic.mount_ca_secret }} | ||
| - name: es-ca-certificate | ||
| secret: | ||
| secretName: {{ .Values.ralph.elastic.ca_secret_name }} | ||
| {{- end }} | ||
| - name: lrs-auth | ||
| secret: | ||
| secretName: {{ .Values.ralph_lrs.auth_secret_name }} | ||
| {{- with .Values.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.affinity }} | ||
| affinity: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.tolerations }} | ||
| tolerations: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| {{- if .Values.autoscaling.enabled }} | ||
| apiVersion: autoscaling/v2beta1 | ||
| kind: HorizontalPodAutoscaler | ||
| metadata: | ||
| name: {{ include "ralph.fullname" . }} | ||
| labels: | ||
| {{- include "ralph.labels" . | nindent 4 }} | ||
| spec: | ||
| scaleTargetRef: | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| name: {{ include "ralph.fullname" . }} | ||
| minReplicas: {{ .Values.autoscaling.minReplicas }} | ||
| maxReplicas: {{ .Values.autoscaling.maxReplicas }} | ||
| metrics: | ||
| {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
| - type: Resource | ||
| resource: | ||
| name: cpu | ||
| targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
| {{- end }} | ||
| {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
| - type: Resource | ||
| resource: | ||
| name: memory | ||
| targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| {{- if .Values.ingress.enabled -}} | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: Ingress | ||
| metadata: | ||
| name: "ralph-app-{{ .Values.ralph.prefix }}" | ||
| labels: | ||
| {{- include "ralph.labels" . | nindent 4 }} | ||
| {{- with .Values.ingress.annotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| ingressClassName: {{ .Values.ingress.className }} | ||
| tls: | ||
| - hosts: | ||
| - {{ .Values.ralph_lrs.host | quote }} | ||
| secretName: "ralph-app-tls-{{ .Values.ralph.prefix }}" | ||
| rules: | ||
| - host: {{ .Values.ralph_lrs.host | quote }} | ||
| http: | ||
| paths: | ||
| - path: / | ||
| pathType: Prefix | ||
| backend: | ||
| service: | ||
| name: "ralph-app-{{ .Values.ralph.prefix }}" | ||
| port: | ||
| number: {{ .Values.ralph_lrs.port }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| apiVersion: v1 | ||
| kind: PersistentVolumeClaim | ||
| metadata: | ||
| name: ralph-pvc-history | ||
| namespace: {{ .Values.namespace }} | ||
| labels: | ||
| {{- include "ralph.labels" . | nindent 4 }} | ||
| spec: | ||
| accessModes: | ||
| - {{ .Values.ralph.volume_history.access_modes }} | ||
| resources: | ||
| requests: | ||
| storage: {{ .Values.ralph.volume_history.size }} | ||
| storageClassName: {{ .Values.ralph.volume_history.storage_class }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.