From c2207adfe32a9b362851b96619c1889ab7b32672 Mon Sep 17 00:00:00 2001 From: Tsuribori Date: Sun, 21 Feb 2021 15:10:40 +0200 Subject: [PATCH 1/2] Initial chart structure --- chart/mangadexathome/.helmignore | 23 +++++ chart/mangadexathome/Chart.yaml | 24 +++++ chart/mangadexathome/README.md | 7 ++ chart/mangadexathome/templates/NOTES.txt | 22 +++++ chart/mangadexathome/templates/_helpers.tpl | 62 +++++++++++++ chart/mangadexathome/templates/configmap.yaml | 90 +++++++++++++++++++ chart/mangadexathome/templates/hpa.yaml | 28 ++++++ chart/mangadexathome/templates/service.yaml | 15 ++++ .../templates/serviceaccount.yaml | 12 +++ .../mangadexathome/templates/statefulset.yaml | 82 +++++++++++++++++ .../templates/tests/test-connection.yaml | 15 ++++ chart/mangadexathome/values.yaml | 75 ++++++++++++++++ 12 files changed, 455 insertions(+) create mode 100644 chart/mangadexathome/.helmignore create mode 100644 chart/mangadexathome/Chart.yaml create mode 100644 chart/mangadexathome/README.md create mode 100644 chart/mangadexathome/templates/NOTES.txt create mode 100644 chart/mangadexathome/templates/_helpers.tpl create mode 100644 chart/mangadexathome/templates/configmap.yaml create mode 100644 chart/mangadexathome/templates/hpa.yaml create mode 100644 chart/mangadexathome/templates/service.yaml create mode 100644 chart/mangadexathome/templates/serviceaccount.yaml create mode 100644 chart/mangadexathome/templates/statefulset.yaml create mode 100644 chart/mangadexathome/templates/tests/test-connection.yaml create mode 100644 chart/mangadexathome/values.yaml diff --git a/chart/mangadexathome/.helmignore b/chart/mangadexathome/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/chart/mangadexathome/.helmignore @@ -0,0 +1,23 @@ +# 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/mangadexathome/Chart.yaml b/chart/mangadexathome/Chart.yaml new file mode 100644 index 0000000..c458e1c --- /dev/null +++ b/chart/mangadexathome/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: mangadexathome +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: "1.16.0" diff --git a/chart/mangadexathome/README.md b/chart/mangadexathome/README.md new file mode 100644 index 0000000..ff87b23 --- /dev/null +++ b/chart/mangadexathome/README.md @@ -0,0 +1,7 @@ +# Helm Chart for ... + +### About scaling + +Trying to inrease the `replicaCount` or turning on autoscaling is +probably not a good idea, as multiple clients that look identical +but do not share state will probably cause problems. diff --git a/chart/mangadexathome/templates/NOTES.txt b/chart/mangadexathome/templates/NOTES.txt new file mode 100644 index 0000000..e6b2c4b --- /dev/null +++ b/chart/mangadexathome/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 }}{{ .path }} + {{- 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 "mangadexathome.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 "mangadexathome.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "mangadexathome.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 "mangadexathome.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 +{{- end }} diff --git a/chart/mangadexathome/templates/_helpers.tpl b/chart/mangadexathome/templates/_helpers.tpl new file mode 100644 index 0000000..959a206 --- /dev/null +++ b/chart/mangadexathome/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "mangadexathome.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 "mangadexathome.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 "mangadexathome.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "mangadexathome.labels" -}} +helm.sh/chart: {{ include "mangadexathome.chart" . }} +{{ include "mangadexathome.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "mangadexathome.selectorLabels" -}} +app.kubernetes.io/name: {{ include "mangadexathome.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "mangadexathome.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "mangadexathome.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/chart/mangadexathome/templates/configmap.yaml b/chart/mangadexathome/templates/configmap.yaml new file mode 100644 index 0000000..8d5fd5d --- /dev/null +++ b/chart/mangadexathome/templates/configmap.yaml @@ -0,0 +1,90 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "mangadexathome.fullname" . }}-configmap + labels: + {{- include "mangadexathome.labels" . | nindent 4 }} +stringData: + settings.yaml: | + # ⢸⣿⣿⣿⣿⠃⠄⢀⣴⡾⠃⠄⠄⠄⠄⠄⠈⠺⠟⠛⠛⠛⠛⠻⢿⣿⣿⣿⣿⣶⣤⡀⠄ + # ⢸⣿⣿⣿⡟⢀⣴⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣸⣿⣿⣿⣿⣿⣿⣿⣷ + # ⢸⣿⣿⠟⣴⣿⡿⡟⡼⢹⣷⢲⡶⣖⣾⣶⢄⠄⠄⠄⠄⠄⢀⣼⣿⢿⣿⣿⣿⣿⣿⣿⣿ + # ⢸⣿⢫⣾⣿⡟⣾⡸⢠⡿⢳⡿⠍⣼⣿⢏⣿⣷⢄⡀⠄⢠⣾⢻⣿⣸⣿⣿⣿⣿⣿⣿⣿ + # ⡿⣡⣿⣿⡟⡼⡁⠁⣰⠂⡾⠉⢨⣿⠃⣿⡿⠍⣾⣟⢤⣿⢇⣿⢇⣿⣿⢿⣿⣿⣿⣿⣿ + # ⣱⣿⣿⡟⡐⣰⣧⡷⣿⣴⣧⣤⣼⣯⢸⡿⠁⣰⠟⢀⣼⠏⣲⠏⢸⣿⡟⣿⣿⣿⣿⣿⣿ + # ⣿⣿⡟⠁⠄⠟⣁⠄⢡⣿⣿⣿⣿⣿⣿⣦⣼⢟⢀⡼⠃⡹⠃⡀⢸⡿⢸⣿⣿⣿⣿⣿⡟ + # ⣿⣿⠃⠄⢀⣾⠋⠓⢰⣿⣿⣿⣿⣿⣿⠿⣿⣿⣾⣅⢔⣕⡇⡇⡼⢁⣿⣿⣿⣿⣿⣿⢣ + # ⣿⡟⠄⠄⣾⣇⠷⣢⣿⣿⣿⣿⣿⣿⣿⣭⣀⡈⠙⢿⣿⣿⡇⡧⢁⣾⣿⣿⣿⣿⣿⢏⣾ + # ⣿⡇⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢻⠇⠄⠄⢿⣿⡇⢡⣾⣿⣿⣿⣿⣿⣏⣼⣿ + # ⣿⣷⢰⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣧⣀⡄⢀⠘⡿⣰⣿⣿⣿⣿⣿⣿⠟⣼⣿⣿ + # ⢹⣿⢸⣿⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣭⣉⣤⣿⢈⣼⣿⣿⣿⣿⣿⣿⠏⣾⣹⣿⣿ + # ⢸⠇⡜⣿⡟⠄⠄⠄⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟⣱⣻⣿⣿⣿⣿⣿⠟⠁⢳⠃⣿⣿⣿ + # ⠄⣰⡗⠹⣿⣄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⠟⣅⣥⣿⣿⣿⣿⠿⠋⠄⠄⣾⡌⢠⣿⡿⠃ + # ⠜⠋⢠⣷⢻⣿⣿⣶⣾⣿⣿⣿⣿⠿⣛⣥⣾⣿⠿⠟⠛⠉⠄⠄ + # + # MangaDex@Home configuration file + # We are pleased to have you here + # May fate stay the night with you! + + + # The size in mebibytes of the cache + # You can use megabytes instead in a pinch, + # but just know the two are **NOT** the same. + max_cache_size_in_mebibytes: {{ .Values.customConfig.cacheSize }} + + # Optional settings for fancy geoip analytics + metrics_settings: + # whether to enable geoip metrics + enable_geoip: false + # if geoip metrics are enabled, a license is required + # see https://dev.maxmind.com/geoip/geoip2/geolite2/ + geoip_license_key: none + + + server_settings: + # The client secret + # Keep this secret at all costs :P + secret: {{ .Values.customConfig.secret | quote }} + # The port for the webserver to listen on + # 443 is recommended for maximum appeal + port: {{ .Values.customConfig.containerPort }} + # This controls the value the server receives + # for your uplaod speed + # Keep this as 0 to use the one currently stored + # in the server, or set this higher if needed + # This does not affect `max_kilobits_per_second` in any way + external_max_kilobits_per_second: 0 + + + # Stuff that you probably don't need to change + + # The maximum egress rate of the webserver + # Setting this to 0 disables the limiter + # Setting this too low can have adverse effects + # This does not affect `external_max_kilobits_per_second` in any way + max_kilobits_per_second: 0 + # The external port to broadcast to the backend + # Keep this at 0 unless you know what you're doing + # 0 means broadcast the same value as `port` + external_port: {{ .Values.service.port }} + # How long to wait for the graceful shutdown (Ctrl-C or SIGINT) + # This is rounded to a multiple of 5 seconds + graceful_shutdown_wait_seconds: 60 + # The external hostname to listen on + # Keep this at 0.0.0.0 unless you know what you're doing + hostname: 0.0.0.0 + # The external ip to broadcast to the webserver + # The default of null means the backend will infer it + # from where it was sent from, which may fail in the + # presence of multiple IPs + external_ip: ~ + # Maximum mebibytes per hour of images to server + # Setting this to 0 disables the limiter + max_mebibytes_per_hour: 0 + # Number of threads for Netty worker pool + # Don't touch this if you don't have elevated + # load levels or are hitting <100 rqps + # 0 defaults to (2 * your available processors) + # https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Runtime.html#availableProcessors() + threads: 0 + diff --git a/chart/mangadexathome/templates/hpa.yaml b/chart/mangadexathome/templates/hpa.yaml new file mode 100644 index 0000000..3c48510 --- /dev/null +++ b/chart/mangadexathome/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "mangadexathome.fullname" . }} + labels: + {{- include "mangadexathome.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: StatefulSet + name: {{ include "mangadexathome.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/chart/mangadexathome/templates/service.yaml b/chart/mangadexathome/templates/service.yaml new file mode 100644 index 0000000..69a99c5 --- /dev/null +++ b/chart/mangadexathome/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "mangadexathome.fullname" . }} + labels: + {{- include "mangadexathome.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.customConfig.containerPort }} + protocol: TCP + name: http + selector: + {{- include "mangadexathome.selectorLabels" . | nindent 4 }} diff --git a/chart/mangadexathome/templates/serviceaccount.yaml b/chart/mangadexathome/templates/serviceaccount.yaml new file mode 100644 index 0000000..da92bf5 --- /dev/null +++ b/chart/mangadexathome/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "mangadexathome.serviceAccountName" . }} + labels: + {{- include "mangadexathome.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/chart/mangadexathome/templates/statefulset.yaml b/chart/mangadexathome/templates/statefulset.yaml new file mode 100644 index 0000000..c3b2d91 --- /dev/null +++ b/chart/mangadexathome/templates/statefulset.yaml @@ -0,0 +1,82 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "mangadexathome.fullname" . }} + labels: + {{- include "mangadexathome.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + serviceName: {{ include "mangadexathome.fullname" . }} + selector: + matchLabels: + {{- include "mangadexathome.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "mangadexathome.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "mangadexathome.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: config + secret: + secretName: {{ include "mangadexathome.fullname" . }}-configmap + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.customConfig.containerPort }} + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: config + mountPath: /mangahome/settings.yaml + subPath: settings.yaml + - name: {{ include "mangadexathome.fullname" . }}-volume + mountPath: /mangahome/data + command: ["/bin/sh"] + args: [ + "-c", + "java \ + -Dfile-level=off \ + -Dstdout-level=info \ + -jar mangadex_at_home.jar \ + --cache /mangahome/data/images/ \ + --database /mangahome/data/" + ] + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumeClaimTemplates: + - metadata: + name: {{ include "mangadexathome.fullname" . }}-volume + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: {{ .Values.customConfig.volumeSize }} diff --git a/chart/mangadexathome/templates/tests/test-connection.yaml b/chart/mangadexathome/templates/tests/test-connection.yaml new file mode 100644 index 0000000..6a381e3 --- /dev/null +++ b/chart/mangadexathome/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "mangadexathome.fullname" . }}-test-connection" + labels: + {{- include "mangadexathome.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "mangadexathome.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/chart/mangadexathome/values.yaml b/chart/mangadexathome/values.yaml new file mode 100644 index 0000000..34b6820 --- /dev/null +++ b/chart/mangadexathome/values.yaml @@ -0,0 +1,75 @@ +# Default values for mangadexathome. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "registry.gitlab.com/mangadex-pub/mangadex_at_home" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" # Set MangaDex@Home version used + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +customConfig: # Configuration + volumeSize: 2048Mi # Size of PVC + cacheSize: 2000 # Max size of cache IN MEBIBYTES + containerPort: 443 # The port the container listens on + secret: "" # Your MangaDex@Home secret key + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: NodePort + port: 32443 # Port exposed to the internet + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +ingress: + enabled: false + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} From ecda833f248c25da7e56e7c28bcdb936ea286e05 Mon Sep 17 00:00:00 2001 From: Tsuribori Date: Sun, 21 Feb 2021 17:10:46 +0200 Subject: [PATCH 2/2] Make it usable --- chart/mangadexathome/README.md | 21 +++++++++++++++++-- chart/mangadexathome/templates/configmap.yaml | 4 ++-- chart/mangadexathome/templates/service.yaml | 1 + .../mangadexathome/templates/statefulset.yaml | 3 +++ chart/mangadexathome/values.yaml | 20 ++++++++++-------- 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/chart/mangadexathome/README.md b/chart/mangadexathome/README.md index ff87b23..2e2fb0e 100644 --- a/chart/mangadexathome/README.md +++ b/chart/mangadexathome/README.md @@ -1,7 +1,24 @@ -# Helm Chart for ... +# Helm Chart for MangaDex@Home + +Based on the `docker-compose.yml` file (without Grafana and Prometheus). + +### Configuration + +Essential configuration can be done in `values.yaml`. Other settings can be edited in `templates/configmap.yaml`. + +### About architecture + +The container is deployed as a `StatefulSet` with a PVC attached for cache storage (`templates/statefulset.yaml`). +Settings are injected as a `Secret` (`templates/configmap.yaml`). +The endpoint is exposed through a `NodePort` to the internet (`templates/service.yaml`). + +### Install + +`helm install mangadex .` + ### About scaling Trying to inrease the `replicaCount` or turning on autoscaling is -probably not a good idea, as multiple clients that look identical +probably not a good idea, as multiple clients that look identical to the remote server but do not share state will probably cause problems. diff --git a/chart/mangadexathome/templates/configmap.yaml b/chart/mangadexathome/templates/configmap.yaml index 8d5fd5d..27debd7 100644 --- a/chart/mangadexathome/templates/configmap.yaml +++ b/chart/mangadexathome/templates/configmap.yaml @@ -77,7 +77,7 @@ stringData: # The default of null means the backend will infer it # from where it was sent from, which may fail in the # presence of multiple IPs - external_ip: ~ + # external_ip: {{ .Values.customConfig.externalIP | quote }} # Maximum mebibytes per hour of images to server # Setting this to 0 disables the limiter max_mebibytes_per_hour: 0 @@ -86,5 +86,5 @@ stringData: # load levels or are hitting <100 rqps # 0 defaults to (2 * your available processors) # https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Runtime.html#availableProcessors() - threads: 0 + # threads: 0 # Currently fails diff --git a/chart/mangadexathome/templates/service.yaml b/chart/mangadexathome/templates/service.yaml index 69a99c5..fd9f31d 100644 --- a/chart/mangadexathome/templates/service.yaml +++ b/chart/mangadexathome/templates/service.yaml @@ -8,6 +8,7 @@ spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} + nodePort: {{ .Values.service.port }} targetPort: {{ .Values.customConfig.containerPort }} protocol: TCP name: http diff --git a/chart/mangadexathome/templates/statefulset.yaml b/chart/mangadexathome/templates/statefulset.yaml index c3b2d91..298de9d 100644 --- a/chart/mangadexathome/templates/statefulset.yaml +++ b/chart/mangadexathome/templates/statefulset.yaml @@ -50,6 +50,9 @@ spec: subPath: settings.yaml - name: {{ include "mangadexathome.fullname" . }}-volume mountPath: /mangahome/data + env: + - name: JAVA_TOOL_OPTIONS + value: {{ .Values.customConfig.javaOptions | quote }} command: ["/bin/sh"] args: [ "-c", diff --git a/chart/mangadexathome/values.yaml b/chart/mangadexathome/values.yaml index 34b6820..d825350 100644 --- a/chart/mangadexathome/values.yaml +++ b/chart/mangadexathome/values.yaml @@ -15,10 +15,12 @@ nameOverride: "" fullnameOverride: "" customConfig: # Configuration - volumeSize: 2048Mi # Size of PVC - cacheSize: 2000 # Max size of cache IN MEBIBYTES + volumeSize: 40Gi # Size of PVC + cacheSize: 40000 # Max size of cache IN MEBIBYTES containerPort: 443 # The port the container listens on secret: "" # Your MangaDex@Home secret key + javaOptions: "-Xms1G -Xmx1G -XX:+UseShenandoahGC -Xss512K" + # externalIP: "" # This setting currently fails serviceAccount: # Specifies whether a service account should be created @@ -44,19 +46,19 @@ securityContext: {} service: type: NodePort - port: 32443 # Port exposed to the internet + port: 32443 # Port exposed to internet resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little # resources, such as Minikube. If you do want to specify resources, uncomment the following # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + #limits: + # cpu: 100m + # memory: 256Mi + #requests: + # cpu: 100m + # memory: 256Mi ingress: enabled: false