Skip to content

Commit

Permalink
fixing HELM to align metabase with versioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp committed Dec 8, 2023
1 parent de15c57 commit 2bef740
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 130 deletions.
3 changes: 0 additions & 3 deletions charts/nr-metabase/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ version: 0.47.9
# It is recommended to use it with quotes.
appVersion: "v0.47.9" # aligned with metabase version. ALso update the global values appversion, there is no way to pass to
dependencies:
- name: metabase
condition: metabase.enabled
version: 0.1.0
- name: database
condition: database.enabled
version: 0.1.0
Expand Down
23 changes: 0 additions & 23 deletions charts/nr-metabase/charts/metabase/.helmignore

This file was deleted.

24 changes: 0 additions & 24 deletions charts/nr-metabase/charts/metabase/Chart.yaml

This file was deleted.

62 changes: 0 additions & 62 deletions charts/nr-metabase/charts/metabase/templates/_helpers.tpl

This file was deleted.

62 changes: 62 additions & 0 deletions charts/nr-metabase/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,65 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}


{{/*
Expand the name of the chart.
*/}}
{{- define "metabase.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 "metabase.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-%s" .Release.Name .Chart.Name .Values.global.zone | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{- define "metabase.route" -}}
{{- if .Values.metabase.routeOverride }}
{{- .Values.metabase.routeOverride }}
{{- else }}
{{- printf "%s-metabase-%s-%s.%s" .Release.Name .Values.global.zone .Release.Namespace .Values.global.domain }}
{{- end }}
{{- end }}

{{/*
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "metabase.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "metabase.labels" -}}
helm.sh/chart: {{ include "metabase.chart" . }}
{{ include "metabase.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app: {{ include "metabase.fullname" . }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "metabase.selectorLabels" -}}
app.kubernetes.io/name: {{ include "metabase.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}


Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ metadata:
labels:
{{- include "metabase.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- if not .Values.metabase.autoscaling.enabled }}
replicas: {{ .Values.metabase.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "metabase.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
{{- with .Values.metabase.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "metabase.selectorLabels" . | nindent 8 }}
spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- toYaml .Values.metabase.podSecurityContext | nindent 8 }}
containers:
- name: {{ include "metabase.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "image-registry.openshift-image-registry.svc:5000/{{.Release.Namespace}}/{{ include "metabase.fullname" . }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- toYaml .Values.metabase.securityContext | nindent 12 }}
image: "image-registry.openshift-image-registry.svc:5000/{{.Release.Namespace}}/{{ include "metabase.fullname" . }}:{{ .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.metabase.image.pullPolicy }}
env:
- name: MB_DB_DBNAME
valueFrom:
Expand Down Expand Up @@ -65,7 +65,7 @@ spec:
value: strong
ports:
- name: http
containerPort: {{ .Values.service.targetPort }}
containerPort: {{ .Values.metabase.service.targetPort }}
protocol: TCP
livenessProbe:
httpGet:
Expand All @@ -84,17 +84,17 @@ spec:
timeoutSeconds: 3
failureThreshold: 50
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- toYaml .Values.metabase.resources | nindent 12 }}

{{- with .Values.nodeSelector }}
{{- with .Values.metabase.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
{{- with .Values.metabase.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
{{- with .Values.metabase.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ spec:
lookupPolicy:
local: false
tags:
- name: "{{ .Values.global.appVersion }}"
- name: "{{ .Chart.AppVersion }}"
from:
kind: DockerImage
name: "{{ .Values.image.repository }}:{{ .Values.global.appVersion }}"
name: "{{ .Values.metabase.image.repository }}:{{ .Chart.AppVersion }}"
referencePolicy:
type: Local
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ metadata:
labels:
{{- include "metabase.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
type: {{ .Values.metabase.service.type }}
ports:
- port: {{ .Values.service.port }}
- port: {{ .Values.metabase.service.port }}
targetPort: http
protocol: TCP
name: http
Expand Down
2 changes: 0 additions & 2 deletions charts/nr-metabase/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ metabase:
image:
repository: ghcr.io/bcgov/nr-metabase/metabase
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: 'v0.47.2'
containerPort: 3000
environment: production
service:
Expand Down

0 comments on commit 2bef740

Please sign in to comment.