diff --git a/Dockerfile b/Dockerfile index e5892e2..0538c94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM python:3.10.9-slim as build COPY ./pyproject.toml ./poetry.lock / -RUN pip install poetry +RUN pip install poetry poetry-plugin-export RUN poetry export -f requirements.txt --output requirements.txt --without-hashes diff --git a/chart/python-template/.helmignore b/chart/python-template/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/chart/python-template/.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/chart/python-template/Chart.yaml b/chart/python-template/Chart.yaml deleted file mode 100644 index f3a04f2..0000000 --- a/chart/python-template/Chart.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v1 -name: document-tokenizer -description: A Helm chart for Kubernetes -version: 0.0.1 -appVersion: 0.0.1 diff --git a/chart/python-template/templates/NOTES.txt b/chart/python-template/templates/NOTES.txt deleted file mode 100644 index e69de29..0000000 diff --git a/chart/python-template/templates/_helpers.tpl b/chart/python-template/templates/_helpers.tpl deleted file mode 100644 index cdf5b43..0000000 --- a/chart/python-template/templates/_helpers.tpl +++ /dev/null @@ -1,90 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "document-tokenizer.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 "document-tokenizer.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 -}} - -{{- define "document-tokenizer.common.labels" -}} -app.kubernetes.io/name: {{ include "document-tokenizer.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "document-tokenizer.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Redis ha name -*/}} -{{- define "document-tokenizer.redis-ha.fullname" -}} -{{- if .Values.redisha.fullnameOverride -}} -{{- .Values.redisha.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.redisha.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 environment variables -*/}} -{{- define "document-tokenizer.env.config" -}} -REST_PORT: "80" - -{{- range $key, $val := .Values.env }} -{{ printf "%s: %s" $key (quote $val) }} -{{- end }} -{{- end -}} - -{{/* -Create the name of the service account to use -*/}} -{{- define "document-tokenizer.serviceAccountName" -}} -{{- if .Values.serviceAccount.create -}} - {{ default (include "document-tokenizer.fullname" .) .Values.serviceAccount.name }} -{{- else -}} - {{ default "default" .Values.serviceAccount.name }} -{{- end -}} -{{- end -}} - -{{/* -Create secret environment variables -*/}} -{{- define "document-tokenizer.env.secret" -}} -{{- range $key, $val := .Values.secrets }} -{{ printf "%s: %s" $key (b64enc $val | quote) }} -{{ end -}} -{{- end -}} - -{{- define "document-tokenizer.full.labels" -}} -{{ include "document-tokenizer.common.labels" . }} -helm.sh/chart: {{ include "document-tokenizer.chart" . }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end -}} \ No newline at end of file diff --git a/chart/python-template/templates/configMap.yaml b/chart/python-template/templates/configMap.yaml deleted file mode 100644 index 3a65708..0000000 --- a/chart/python-template/templates/configMap.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "document-tokenizer.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "document-tokenizer.name" . }} - helm.sh/chart: {{ include "document-tokenizer.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -data: {{ include "document-tokenizer.env.config" . | nindent 2 }} \ No newline at end of file diff --git a/chart/python-template/templates/deployment.yaml b/chart/python-template/templates/deployment.yaml deleted file mode 100644 index 6f7ca77..0000000 --- a/chart/python-template/templates/deployment.yaml +++ /dev/null @@ -1,62 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "document-tokenizer.fullname" . }} - labels: - {{- include "document-tokenizer.full.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - {{ include "document-tokenizer.common.labels" . | nindent 6 }} - template: - metadata: - labels: - {{ include "document-tokenizer.common.labels" . | nindent 8 }} - annotations: - checksum/config: {{ include "document-tokenizer.env.config" . | sha256sum | quote }} - checksum/secret: {{ include "document-tokenizer.env.secret" . | sha256sum | quote }} - {{- with .Values.podAnnotations }} - {{- toYaml . | nindent 8 }} - {{- end }} - spec: - {{- if or .Values.imagePullSecrets .Values.secrets.dockerCredentials }} - imagePullSecrets: - {{- with .Values.imagePullSecrets }} - {{ toYaml . | nindent 8 }} - {{- end }} - {{- if .Values.secrets.dockerCredentials }} - - name: {{ template "document-tokenizer.fullname" . }}-docker-secret - {{- end }} - {{- end }} - terminationGracePeriodSeconds: 90 - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - envFrom: - - configMapRef: - name: {{ include "document-tokenizer.fullname" . }} - - secretRef: - name: {{ include "document-tokenizer.fullname" . }} - {{- if .Values.envFrom }} - {{- toYaml .Values.envFrom | nindent 12 }} - {{- end }} - ports: - - name: http - containerPort: 80 - protocol: TCP - 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/chart/python-template/templates/hpa.yaml b/chart/python-template/templates/hpa.yaml deleted file mode 100644 index a848233..0000000 --- a/chart/python-template/templates/hpa.yaml +++ /dev/null @@ -1,18 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "document-tokenizer.fullname" . }} - labels: - {{- include "document-tokenizer.common.labels" . | nindent 4 }} - helm.sh/chart: {{ template "document-tokenizer.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "document-tokenizer.fullname" . }} - minReplicas: {{ default .Values.replicaCount .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: {{- toYaml .Values.autoscaling.metrics | nindent 4 }} -{{- end }} diff --git a/chart/python-template/templates/ingress.yaml b/chart/python-template/templates/ingress.yaml deleted file mode 100644 index fe3ceee..0000000 --- a/chart/python-template/templates/ingress.yaml +++ /dev/null @@ -1,55 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "document-tokenizer.fullname" . -}} -{{- $ingressPath := .Values.ingress.path -}} -{{- if semverCompare ">=1.22-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 }} - labels: - {{- include "document-tokenizer.full.labels" . | nindent 4 }} -{{- with .Values.ingress.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if semverCompare ">=1.22-0" .Capabilities.KubeVersion.GitVersion }} - ingressClassName: {{ .Values.ingress.ingressClassName }} -{{- end }} -{{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} -{{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host }} - http: - paths: - {{- range .paths }} - - path: {{ . }} - {{- if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: ImplementationSpecific - backend: - service: - name: {{ $fullName }} - port: - name: http - {{- else }} - backend: - serviceName: {{ $fullName }} - servicePort: http - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/chart/python-template/templates/secrets-docker.yaml b/chart/python-template/templates/secrets-docker.yaml deleted file mode 100644 index 5219e7c..0000000 --- a/chart/python-template/templates/secrets-docker.yaml +++ /dev/null @@ -1,9 +0,0 @@ -{{- if .Values.secrets.dockerCredentials }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ template "document-tokenizer.fullname" . }}-docker-secret -type: kubernetes.io/dockerconfigjson -data: - .dockerconfigjson: {{ toJson .Values.secrets.dockerCredentials | b64enc | quote }} -{{- end }} diff --git a/chart/python-template/templates/secrets.yaml b/chart/python-template/templates/secrets.yaml deleted file mode 100644 index e40a20c..0000000 --- a/chart/python-template/templates/secrets.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: Secret -type: Opaque -metadata: - name: {{ include "document-tokenizer.fullname" . }} - labels: - {{- include "document-tokenizer.full.labels" . | nindent 4 }} -data: {{ include "document-tokenizer.env.secret" . | nindent 2 }} \ No newline at end of file diff --git a/chart/python-template/templates/service.yaml b/chart/python-template/templates/service.yaml deleted file mode 100644 index 80e3624..0000000 --- a/chart/python-template/templates/service.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "document-tokenizer.fullname" . }} - labels: - {{- include "document-tokenizer.full.labels" . | nindent 4 }} -spec: - {{- if eq (lower .Values.service.type) "headless" }} - type: ClusterIP - clusterIP: None - {{- else }} - type: {{ .Values.service.type }} - {{- end }} - ports: - - port: 80 - targetPort: http - protocol: TCP - name: http - selector: - {{- include "document-tokenizer.common.labels" . | nindent 4 }} diff --git a/chart/python-template/templates/serviceaccount.yaml b/chart/python-template/templates/serviceaccount.yaml deleted file mode 100644 index 48048b3..0000000 --- a/chart/python-template/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "document-tokenizer.serviceAccountName" . }} - labels: - {{- include "document-tokenizer.common.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/chart/python-template/values.yaml b/chart/python-template/values.yaml deleted file mode 100644 index 80bad75..0000000 --- a/chart/python-template/values.yaml +++ /dev/null @@ -1,55 +0,0 @@ -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -nodeSelector: {} -tolerations: [] -affinity: {} - -serviceAccount: - create: true - annotations: {} - -image: - repository: docker.wiseflow.io/k8s/document-tokenizer - pullPolicy: IfNotPresent - -podAnnotations: {} - -service: - annotations: {} - type: headless - port: 80 - -ingress: - enabled: false - annotations: - hosts: [] - tls: [] - -replicaCount: 1 - -resources: {} - -disruptionBudget: - enabled: true - maxUnavailable: 1 - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 1 - metrics: - - type: Resource - resource: - name: cpu - targetAverageUtilization: 50 - -env: - MYSQL_PORT: 26257 - MYSQL_USER: "document-tokenizer" - MYSQL_NAME: "document-tokenizer" - -secrets: {} - -envFrom: []