diff --git a/charts/nr-metabase/Chart.yaml b/charts/nr-metabase/Chart.yaml index df848eb..5ab49da 100644 --- a/charts/nr-metabase/Chart.yaml +++ b/charts/nr-metabase/Chart.yaml @@ -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 diff --git a/charts/nr-metabase/charts/metabase/.helmignore b/charts/nr-metabase/charts/metabase/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/charts/nr-metabase/charts/metabase/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# 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 -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/charts/nr-metabase/charts/metabase/Chart.yaml b/charts/nr-metabase/charts/metabase/Chart.yaml deleted file mode 100644 index 7b39c17..0000000 --- a/charts/nr-metabase/charts/metabase/Chart.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v2 -name: metabase -description: A Helm chart for Kubernetes - -# 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: "0.1.0" diff --git a/charts/nr-metabase/charts/metabase/templates/_helpers.tpl b/charts/nr-metabase/charts/metabase/templates/_helpers.tpl deleted file mode 100644 index bb8257c..0000000 --- a/charts/nr-metabase/charts/metabase/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -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.routeOverride }} -{{- .Values.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 }} - - diff --git a/charts/nr-metabase/templates/_helpers.tpl b/charts/nr-metabase/templates/_helpers.tpl index 5fcafd9..c070824 100644 --- a/charts/nr-metabase/templates/_helpers.tpl +++ b/charts/nr-metabase/templates/_helpers.tpl @@ -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 }} + + diff --git a/charts/nr-metabase/charts/metabase/templates/deployment.yaml b/charts/nr-metabase/templates/metabase/deployment.yaml similarity index 80% rename from charts/nr-metabase/charts/metabase/templates/deployment.yaml rename to charts/nr-metabase/templates/metabase/deployment.yaml index 764ee50..36a3cc2 100644 --- a/charts/nr-metabase/charts/metabase/templates/deployment.yaml +++ b/charts/nr-metabase/templates/metabase/deployment.yaml @@ -5,15 +5,15 @@ 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 }} @@ -21,13 +21,13 @@ spec: {{- 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: @@ -65,7 +65,7 @@ spec: value: strong ports: - name: http - containerPort: {{ .Values.service.targetPort }} + containerPort: {{ .Values.metabase.service.targetPort }} protocol: TCP livenessProbe: httpGet: @@ -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 }} diff --git a/charts/nr-metabase/charts/metabase/templates/is.yaml b/charts/nr-metabase/templates/metabase/is.yaml similarity index 70% rename from charts/nr-metabase/charts/metabase/templates/is.yaml rename to charts/nr-metabase/templates/metabase/is.yaml index 23c3fb0..8631944 100644 --- a/charts/nr-metabase/charts/metabase/templates/is.yaml +++ b/charts/nr-metabase/templates/metabase/is.yaml @@ -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 diff --git a/charts/nr-metabase/charts/metabase/templates/route.yaml b/charts/nr-metabase/templates/metabase/route.yaml similarity index 100% rename from charts/nr-metabase/charts/metabase/templates/route.yaml rename to charts/nr-metabase/templates/metabase/route.yaml diff --git a/charts/nr-metabase/charts/metabase/templates/service.yaml b/charts/nr-metabase/templates/metabase/service.yaml similarity index 75% rename from charts/nr-metabase/charts/metabase/templates/service.yaml rename to charts/nr-metabase/templates/metabase/service.yaml index 7927600..1090ccf 100644 --- a/charts/nr-metabase/charts/metabase/templates/service.yaml +++ b/charts/nr-metabase/templates/metabase/service.yaml @@ -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 diff --git a/charts/nr-metabase/values.yaml b/charts/nr-metabase/values.yaml index b3690a6..07214ab 100644 --- a/charts/nr-metabase/values.yaml +++ b/charts/nr-metabase/values.yaml @@ -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: