diff --git a/sciencebeam-parser/.helmignore b/sciencebeam-parser/.helmignore new file mode 100644 index 0000000000000000000000000000000000000000..50af0317254197a5a019f4ac2f8ecc223f93f5a7 --- /dev/null +++ b/sciencebeam-parser/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/sciencebeam-parser/Chart.yaml b/sciencebeam-parser/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a7cf0d79cebd745574b36d97bfa9d28eda17f414 --- /dev/null +++ b/sciencebeam-parser/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for ScienceBeam Parser +name: sciencebeam-parser +version: 0.1.0 diff --git a/sciencebeam-parser/templates/NOTES.txt b/sciencebeam-parser/templates/NOTES.txt new file mode 100644 index 0000000000000000000000000000000000000000..b931d7625c985c5f5a7e8b570dd411684be90dd4 --- /dev/null +++ b/sciencebeam-parser/templates/NOTES.txt @@ -0,0 +1,21 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- 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 "sciencebeam-parser-chart.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 "sciencebeam-parser-chart.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "sciencebeam-parser-chart.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + 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 "sciencebeam-parser-chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8070 to use your application" + kubectl port-forward $POD_NAME 8070:8070 +{{- end }} diff --git a/sciencebeam-parser/templates/_helpers.tpl b/sciencebeam-parser/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..b34b218a72c167061bd1f212689a7691be19c25f --- /dev/null +++ b/sciencebeam-parser/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "sciencebeam-parser-chart.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 "sciencebeam-parser-chart.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 -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "sciencebeam-parser-chart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/sciencebeam-parser/templates/deployment.yaml b/sciencebeam-parser/templates/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..22fdbb2eb8f549dfa49d55e973737e83e3e6af71 --- /dev/null +++ b/sciencebeam-parser/templates/deployment.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "sciencebeam-parser-chart.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + helm.sh/chart: {{ include "sciencebeam-parser-chart.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- if .Values.env }} + env: + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: "{{ $value }}" + {{- end }} + {{- end }} + ports: + - name: http + containerPort: 8070 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + readinessProbe: + httpGet: + path: / + port: http + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/sciencebeam-parser/templates/hpa.yaml b/sciencebeam-parser/templates/hpa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..768c46b4dc645b81de7fb5c0396a06e9219ee0c4 --- /dev/null +++ b/sciencebeam-parser/templates/hpa.yaml @@ -0,0 +1,23 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "sciencebeam-parser-chart.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + helm.sh/chart: {{ include "sciencebeam-parser-chart.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "sciencebeam-parser-chart.fullname" . }} + minReplicas: {{ .Values.replicaCount }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetAverageCpuUtilization }} +{{- end }} diff --git a/sciencebeam-parser/templates/ingress.yaml b/sciencebeam-parser/templates/ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5941040286b1c59b7ef6387b56a9c79c67367448 --- /dev/null +++ b/sciencebeam-parser/templates/ingress.yaml @@ -0,0 +1,39 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "sciencebeam-parser-chart.fullname" . -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + helm.sh/chart: {{ include "sciencebeam-parser-chart.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} + {{- end }} +{{- end }} diff --git a/sciencebeam-parser/templates/poddisruptionbudget.yaml b/sciencebeam-parser/templates/poddisruptionbudget.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c293c16037d44d93c78d4516528d1c2e9dbb609f --- /dev/null +++ b/sciencebeam-parser/templates/poddisruptionbudget.yaml @@ -0,0 +1,15 @@ +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ include "sciencebeam-parser-chart.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + helm.sh/chart: {{ include "sciencebeam-parser-chart.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + minAvailable: "50%" diff --git a/sciencebeam-parser/templates/service.yaml b/sciencebeam-parser/templates/service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..132090c19237b0fbb3d7965c7d529c6902d79a18 --- /dev/null +++ b/sciencebeam-parser/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "sciencebeam-parser-chart.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + helm.sh/chart: {{ include "sciencebeam-parser-chart.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/sciencebeam-parser/templates/tests/test-connection.yaml b/sciencebeam-parser/templates/tests/test-connection.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b6ca91596fd440253b37097c1d809cf0c69f6cd4 --- /dev/null +++ b/sciencebeam-parser/templates/tests/test-connection.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "sciencebeam-parser-chart.fullname" . }}-test-connection" + labels: + app.kubernetes.io/name: {{ include "sciencebeam-parser-chart.name" . }} + helm.sh/chart: {{ include "sciencebeam-parser-chart.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "sciencebeam-parser-chart.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/sciencebeam-parser/values.yaml b/sciencebeam-parser/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..131b91aa2df1705790476e635fe8bc5e891d78ff --- /dev/null +++ b/sciencebeam-parser/values.yaml @@ -0,0 +1,55 @@ +# Default values for sciencebeam-parser-chart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: elifesciences/sciencebeam-parser + tag: 0.0.2 + pullPolicy: IfNotPresent + +nameOverride: "" +fullnameOverride: "" + +readinessProbe: + failureThreshold: 600 # with preloading, it might take longer to start the server + +livenessProbe: + failureThreshold: 60 + +service: + type: ClusterIP + port: 8070 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - #host: chart-example.local + paths: [] + + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: + requests: + cpu: 1 + memory: 4Gi + +autoscaling: + enabled: false + maxReplicas: 16 + targetAverageCpuUtilization: 80 # HPA default + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +env: {}