Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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: 1.0.6
version: 1.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
Expand Down
4 changes: 4 additions & 0 deletions helm/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
$ kubectl -n {{ .Release.Namespace }} exec deployment/{{ include "mint.prefix" . }}-hasura -c hasura -- \
hasura migrate apply


$ kubectl -n {{ .Release.Namespace }} exec deployment/{{ include "mint.prefix" . }}-mic-api -c mic-api -- \
yarn migrate

# Create metadata
$ kubectl -n {{ .Release.Namespace }} exec deployment/{{ include "mint.prefix" . }}-hasura -c hasura -- \
hasura metadata apply
Expand Down
25 changes: 25 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,31 @@ Create ports
{{- end }}
{{- end }}
{{- end }}

{{- define "helm.mic_api_node_port" -}}
{{- if .Values.service.type }}
{{- if eq .Values.service.type "NodePort" }}
{{- if .Values.service.port }}
{{- add .Values.service.port 6 }}
{{- else }}
{{- add 30000 6 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

{{- define "helm.mic_ui_node_port" -}}
{{- if .Values.service.type }}
{{- if eq .Values.service.type "NodePort" }}
{{- if .Values.service.port }}
{{- add .Values.service.port 7 }}
{{- else }}
{{- add 30000 7 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Return the proper Storage Class
{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }}
Expand Down
59 changes: 59 additions & 0 deletions helm/templates/ingress-mic-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{- if .Values.components.mic_api.ingress.enabled -}}
{{- $fullName := include "mint.prefix" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.components.mic_api.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.components.mic_api.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.components.mic_api.ingress.annotations "kubernetes.io/ingress.class" .Values.components.data_catalog.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-mic-api
{{- with .Values.components.mic_api.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.components.mic_api.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.components.mic_api.ingress.className }}
{{- end }}
{{- if .Values.components.mic_api.ingress.tls }}
tls:
{{- range .Values.components.mic_api.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.components.mic_api.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-mic-api
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}-mic-api
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
59 changes: 59 additions & 0 deletions helm/templates/ingress-mic-ui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{- if .Values.components.mic_ui.ingress.enabled -}}
{{- $fullName := include "mint.prefix" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.components.mic_ui.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.components.mic_ui.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.components.mic_ui.ingress.annotations "kubernetes.io/ingress.class" .Values.components.data_catalog.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-mic-ui
{{- with .Values.components.mic_ui.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.components.mic_ui.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.components.mic_ui.ingress.className }}
{{- end }}
{{- if .Values.components.mic_ui.ingress.tls }}
tls:
{{- range .Values.components.mic_ui.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.components.mic_ui.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-mic-ui
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}-mic-ui
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
117 changes: 117 additions & 0 deletions helm/templates/mic-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "mint.prefix" . }}-mic-api
namespace: {{ .Release.Namespace }}
labels:
{{- include "helm.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- name: "http"
port: 80
targetPort: 3000
{{ if eq .Values.service.type "NodePort" }}
nodePort: {{ include "helm.mic_api_node_port" . }}
{{ end }}
protocol: TCP
- name: "postgres"
port: 5432
targetPort: 5432
protocol: TCP
selector:
app: {{ include "mint.prefix" . }}-mic-api
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mint.prefix" . }}-mic-api
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "mint.prefix" . }}-mic-api
template:
metadata:
labels:
app: {{ include "mint.prefix" . }}-mic-api
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: mic-api
{{- with .Values.components.mic_api }}
image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .image.pullPolicy }}
{{- end }}
ports:
- name: http
containerPort: 3000
protocol: TCP
env:
- name: DB_HOST
value: {{ include "mint.prefix" $ }}-mic-api
- name: DB_PORT
value: "5432"
- name: DB_NAME
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-mic-api-db-secrets
key: database
- name: DB_USER
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-mic-api-db-secrets
key: username
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-mic-api-db-secrets
key: password
- name: mic-api-db
{{- with .Values.components.mic_api_db }}
image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .image.pullPolicy }}
{{- end }}
resources: {}
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: mic-api-db
ports:
- name: postgres
containerPort: 5432
protocol: TCP
env:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-mic-api-db-secrets
key: database
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-mic-api-db-secrets
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-mic-api-db-secrets
key: password
volumes:
- name: mic-api-db
{{- if .Values.components.mic_api_db.persistence.enabled }}
persistentVolumeClaim:
{{- if .Values.components.mic_api_db.persistence.existingClaim }}
claimName: {{ .Values.components.mic_api_db.persistence.existingClaim }}
{{- else }}
claimName: {{ include "mint.prefix" . }}-mic-api-db
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
37 changes: 37 additions & 0 deletions helm/templates/mic-ui-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "mint.prefix" . }}-mic-ui-config-map
namespace: {{ .Release.Namespace }}
data:
config.js: |
window.REACT_APP_AIRFLOW_API = {{.Values.components.mic_ui.image.environment.airflow_url | quote }}
// model catalog url
{{- if .Values.components.model_catalog_api.enabled }}
{{- if eq .Values.service.type "NodePort" }}
window.REACT_APP_MODEL_CATALOG_API = "http://localhost:{{ include "helm.model_catalog_api_node_port" . }}/{{ .Values.components.model_catalog_api.api_version }}";
{{- else if eq .Values.service.type "ClusterIP" }}
{{- with .Values.components.model_catalog_api }}
{{- if .enabled }}
window.REACT_APP_MODEL_CATALOG_API = "http{{ if .ingress.tls }}s{{ end }}://{{ with (first .ingress.hosts ) }}{{ .host }}{{ end }}/{{ .api_version }}";
{{- end }}
{{- end }}
{{- end }}
{{- end }}
// mic api url
{{- if .Values.components.mic_ui.image.environment.api_url }}
window.REACT_APP_MIC_API = {{ .Values.components.mic_ui.image.environment.api_url | quote }};
{{- else }}
{{- if eq .Values.service.type "NodePort" }}
{{- if .Values.components.mic_api.enabled }}
window.REACT_APP_MIC_API = "http://localhost:{{ include "helm.mic_api_node_port" . }}";
{{- end }}
{{- else if eq .Values.service.type "ClusterIP" }}
{{- with .Values.components.mic_api }}
{{- if .enabled }}
window.REACT_APP_MIC_API = "http{{ if .ingress.tls }}s{{ end }}://{{ with (first .ingress.hosts ) }}{{ .host }}{{ end }}";
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Loading