Skip to content

Commit

Permalink
feat: add helm-chart for nmr-predict
Browse files Browse the repository at this point in the history
  • Loading branch information
NishaSharma14 committed May 15, 2023
1 parent 507263d commit bc05009
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 65 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
apiVersion: v2
name: rdkit-catridge-postgres
description: Deprecated
deprecated: true
name: nmr-predict
description: A Helm chart for nmr-predict service.
maintainers:
- name: Nisha Sharma
email: nisha.sharma@uni-jena.de

# A chart can be either an 'application' or a 'library' chart.
#
Expand All @@ -16,7 +18,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: 0.1.2
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "rdkit-catridge-postgres.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nmr-predict.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "rdkit-catridge-postgres.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "rdkit-catridge-postgres.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nmr-predict.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nmr-predict.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "rdkit-catridge-postgres.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nmr-predict.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "rdkit-catridge-postgres.name" -}}
{{- define "nmr-predict.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ 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 "rdkit-catridge-postgres.fullname" -}}
{{- define "nmr-predict.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "rdkit-catridge-postgres.chart" -}}
{{- define "nmr-predict.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "rdkit-catridge-postgres.labels" -}}
helm.sh/chart: {{ include "rdkit-catridge-postgres.chart" . }}
{{ include "rdkit-catridge-postgres.selectorLabels" . }}
{{- define "nmr-predict.labels" -}}
helm.sh/chart: {{ include "nmr-predict.chart" . }}
{{ include "nmr-predict.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "rdkit-catridge-postgres.selectorLabels" -}}
app.kubernetes.io/name: {{ include "rdkit-catridge-postgres.name" . }}
{{- define "nmr-predict.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nmr-predict.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "rdkit-catridge-postgres.serviceAccountName" -}}
{{- define "nmr-predict.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "rdkit-catridge-postgres.fullname" .) .Values.serviceAccount.name }}
{{- default (include "nmr-predict.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "rdkit-catridge-postgres.fullname" . }}
name: {{ include "nmr-predict.fullname" . }}
labels:
{{- include "rdkit-catridge-postgres.labels" . | nindent 4 }}
{{- include "nmr-predict.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "rdkit-catridge-postgres.selectorLabels" . | nindent 6 }}
{{- include "nmr-predict.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "rdkit-catridge-postgres.selectorLabels" . | nindent 8 }}
{{- include "nmr-predict.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "rdkit-catridge-postgres.serviceAccountName" . }}
serviceAccountName: {{ include "nmr-predict.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
- name: {{ .Values.image.name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "rdkit-catridge-postgres.fullname" . }}
name: {{ include "nmr-predict.fullname" . }}
labels:
{{- include "rdkit-catridge-postgres.labels" . | nindent 4 }}
{{- include "nmr-predict.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "rdkit-catridge-postgres.fullname" . }}
name: {{ include "nmr-predict.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "rdkit-catridge-postgres.fullname" . -}}
{{- $fullName := include "nmr-predict.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
Expand All @@ -17,7 +17,7 @@ kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "rdkit-catridge-postgres.labels" . | nindent 4 }}
{{- include "nmr-predict.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
15 changes: 15 additions & 0 deletions charts/nmr-predict/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "nmr-predict.fullname" . }}
labels:
{{- include "nmr-predict.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
protocol: TCP
name: http
selector:
{{- include "nmr-predict.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "rdkit-catridge-postgres.serviceAccountName" . }}
name: {{ include "nmr-predict.serviceAccountName" . }}
labels:
{{- include "rdkit-catridge-postgres.labels" . | nindent 4 }}
{{- include "nmr-predict.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
15 changes: 15 additions & 0 deletions charts/nmr-predict/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "nmr-predict.fullname" . }}-test-connection"
labels:
{{- include "nmr-predict.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "nmr-predict.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Default values for rdkit-catridge-postgres.
# Default values for nmr-predict.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: nginx
pullPolicy: IfNotPresent
repository: nmr-predict
repository: europe-west3-docker.pkg.dev/nmrxiv/nmrxiv-dev/nmr-predict-dev
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: ""
tag: latest

imagePullSecrets: []
nameOverride: ""
Expand Down
15 changes: 0 additions & 15 deletions charts/rdkit-catridge-postgres/templates/service.yaml

This file was deleted.

This file was deleted.

0 comments on commit bc05009

Please sign in to comment.