diff --git a/charts/drone-tm/Chart.lock b/charts/drone-tm/Chart.lock new file mode 100644 index 000000000..df71dfe38 --- /dev/null +++ b/charts/drone-tm/Chart.lock @@ -0,0 +1,12 @@ +dependencies: +- name: postgresql + repository: oci://registry-1.docker.io/bitnamicharts + version: 15.2.2 +- name: minio + repository: https://charts.min.io + version: 5.1.0 +- name: redis + repository: oci://registry-1.docker.io/bitnamicharts + version: 18.1.0 +digest: sha256:9299a363000374084bc7e53b5fccf4134373a4a8830c396f7c2ae2d3c211f646 +generated: "2025-08-26T19:21:52.983129-03:00" diff --git a/charts/drone-tm/Chart.yaml b/charts/drone-tm/Chart.yaml new file mode 100644 index 000000000..b5b7b0ada --- /dev/null +++ b/charts/drone-tm/Chart.yaml @@ -0,0 +1,26 @@ +apiVersion: v2 +name: drone-tm +description: Drone Tasking Manager - coordinated drone mapping +version: "0.1.0" +appVersion: "2025.3.2" +maintainers: + - email: sysadmin@hotosm.org + name: HOTOSM +home: https://github.com/hotosm/drone-tm +icon: https://dronetm.hotosm.org/favicon.png +dependencies: + - name: postgresql + version: 15.2.2 + repository: oci://registry-1.docker.io/bitnamicharts + condition: postgresql.enabled + alias: postgresql + - name: minio + version: 5.1.0 + repository: https://charts.min.io + condition: minio.enabled + alias: minio + - name: redis + version: 18.1.0 + repository: oci://registry-1.docker.io/bitnamicharts + condition: redis.enabled + alias: redis diff --git a/charts/drone-tm/README.md b/charts/drone-tm/README.md new file mode 100644 index 000000000..0034b1cd0 --- /dev/null +++ b/charts/drone-tm/README.md @@ -0,0 +1,94 @@ +# Drone Task Manager Helm Chart + +This Helm chart deploys the Drone Task Manager application and its dependencies. + +## Values Files + +### `values.yaml` + +Default values for the chart. Contains all configurable parameters with sensible defaults. + +### `values-local.yaml` + +Development environment configuration: + +- **Purpose**: Local development and testing +- **Usage**: `helm install drone-tm ./charts/drone-tm -f values-local.yaml` +- **Features**: + - Minimal resource allocation + - Ingress disabled (uses port-forward) + - ODM processing enabled for testing + - Local storage classes + +## Environment-Specific Configuration + +Environment-specific configurations (staging, production) are managed in the k8s-infra repository through ArgoCD applications. This approach: + +- **Eliminates duplication** between chart repo and k8s-infra repo +- **Centralizes environment config** in the infrastructure repository +- **Maintains separation of concerns** between application and infrastructure +- **Enables GitOps** workflow for environment management + +## Usage Examples + +### Local Development + +```bash +# Install with development values +helm install drone-tm ./charts/drone-tm -f values-local.yaml + +# Upgrade with development values +helm upgrade drone-tm ./charts/drone-tm -f values-local.yaml +``` + +### Staging/Production Deployment + +Staging and production deployments are managed through ArgoCD applications in the k8s-infra repository. The environment-specific configurations are embedded directly in the ArgoCD Application manifests, eliminating the need for separate values files. + +To modify environment-specific settings: + +1. Edit the ArgoCD Application manifest in k8s-infra repository +2. Update the `values` section in the `helm` configuration +3. ArgoCD will automatically sync the changes to the cluster + +## Dependencies + +This chart includes the following subcharts: + +- **PostgreSQL**: Database with PostGIS extension +- **MinIO**: S3-compatible object storage +- **Redis**: Caching and task queue + +## Configuration + +Key configuration areas: + +- **Global**: Domain, storage class, ingress class +- **Backend**: API server configuration +- **Frontend**: Web application configuration +- **Worker**: Background task processing +- **ODM**: Optional OpenDroneMap processing +- **PostgreSQL**: Database configuration +- **MinIO**: Object storage configuration +- **Redis**: Cache and queue configuration + +## Secrets + +Secrets are managed through Kubernetes secrets and should be created separately: + +- `drone-tm-secrets`: Contains database, S3, Redis, and application secrets + +## Monitoring + +Health checks are configured for all services: + +- **Liveness Probe**: Ensures containers are running +- **Readiness Probe**: Ensures containers are ready to serve traffic + +## Resources + +Resource limits and requests are configured per environment: + +- **Development**: Minimal resources for local testing +- **Staging**: Moderate resources for testing +- **Production**: High resources with autoscaling diff --git a/charts/drone-tm/charts/minio-5.1.0.tgz b/charts/drone-tm/charts/minio-5.1.0.tgz new file mode 100644 index 000000000..97fe39d33 Binary files /dev/null and b/charts/drone-tm/charts/minio-5.1.0.tgz differ diff --git a/charts/drone-tm/charts/postgresql-15.2.2.tgz b/charts/drone-tm/charts/postgresql-15.2.2.tgz new file mode 100644 index 000000000..8dc6ff5cb Binary files /dev/null and b/charts/drone-tm/charts/postgresql-15.2.2.tgz differ diff --git a/charts/drone-tm/charts/redis-18.1.0.tgz b/charts/drone-tm/charts/redis-18.1.0.tgz new file mode 100644 index 000000000..2b3a93787 Binary files /dev/null and b/charts/drone-tm/charts/redis-18.1.0.tgz differ diff --git a/charts/drone-tm/templates/NOTES.txt b/charts/drone-tm/templates/NOTES.txt new file mode 100644 index 000000000..d903f96db --- /dev/null +++ b/charts/drone-tm/templates/NOTES.txt @@ -0,0 +1,53 @@ +1. Get the application URL by running these commands: +{{- if .Values.frontend.ingress.enabled }} +{{- range $host := .Values.frontend.ingress.hosts }} + http{{ if $.Values.frontend.ingress.tls }}s{{ end }}://{{ $host.host }} +{{- end }} +{{- else if contains "NodePort" .Values.frontend.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "drone-tm.frontend.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.frontend.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 "drone-tm.frontend.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "drone-tm.frontend.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.frontend.service.port }} +{{- else if contains "ClusterIP" .Values.frontend.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "drone-tm.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=frontend" -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 }} + +{{- if .Values.backend.ingress.enabled }} +2. API endpoint: +{{- range $host := .Values.backend.ingress.hosts }} + http{{ if $.Values.backend.ingress.tls }}s{{ end }}://{{ $host.host }} +{{- end }} +{{- end }} + +{{- if .Values.odm.enabled }} +3. ODM processing is enabled: + - NodeODM service: {{ include "drone-tm.odm.nodeodm.fullname" . }} + - WebODM UI: Available through the main application +{{- end }} + +4. Database connection: +{{- if .Values.postgresql.enabled }} + - PostgreSQL is deployed as part of this chart + - Host: {{ include "drone-tm.fullname" . }}-postgresql + - Port: 5432 + - Database: {{ .Values.postgresql.auth.database }} + - User: {{ .Values.postgresql.auth.username }} +{{- else }} + - Using external PostgreSQL database +{{- end }} + +5. S3 Storage: +{{- if .Values.minio.enabled }} + - MinIO is deployed as part of this chart + - Endpoint: http://{{ include "drone-tm.fullname" . }}-minio:9000 + - Access Key: {{ .Values.minio.auth.rootUser }} +{{- else }} + - Using external S3-compatible storage +{{- end }} diff --git a/charts/drone-tm/templates/_helpers.tpl b/charts/drone-tm/templates/_helpers.tpl new file mode 100644 index 000000000..a3e81bc00 --- /dev/null +++ b/charts/drone-tm/templates/_helpers.tpl @@ -0,0 +1,98 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "drone-tm.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 "drone-tm.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 "drone-tm.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "drone-tm.labels" -}} +helm.sh/chart: {{ include "drone-tm.chart" . }} +{{ include "drone-tm.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "drone-tm.selectorLabels" -}} +app.kubernetes.io/name: {{ include "drone-tm.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "drone-tm.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "drone-tm.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Create the name of the backend service +*/}} +{{- define "drone-tm.backend.fullname" -}} +{{- printf "%s-backend" (include "drone-tm.fullname" .) }} +{{- end }} + +{{/* +Create the name of the frontend service +*/}} +{{- define "drone-tm.frontend.fullname" -}} +{{- printf "%s-frontend" (include "drone-tm.fullname" .) }} +{{- end }} + +{{/* +Create the name of the worker service +*/}} +{{- define "drone-tm.worker.fullname" -}} +{{- printf "%s-worker" (include "drone-tm.fullname" .) }} +{{- end }} + +{{/* +Create the name of the ODM services +*/}} +{{- define "drone-tm.odm.nodeodm.fullname" -}} +{{- printf "%s-odm-nodeodm" (include "drone-tm.fullname" .) }} +{{- end }} + +{{- define "drone-tm.odm.webodm.fullname" -}} +{{- printf "%s-odm-webodm" (include "drone-tm.fullname" .) }} +{{- end }} + +{{- define "drone-tm.odm.worker.fullname" -}} +{{- printf "%s-odm-worker" (include "drone-tm.fullname" .) }} +{{- end }} diff --git a/charts/drone-tm/templates/backend-ingress.yaml b/charts/drone-tm/templates/backend-ingress.yaml new file mode 100644 index 000000000..80b0b5f1a --- /dev/null +++ b/charts/drone-tm/templates/backend-ingress.yaml @@ -0,0 +1,60 @@ +{{- if and .Values.backend.enabled .Values.backend.ingress.enabled -}} +{{- $fullName := include "drone-tm.backend.fullname" . -}} +{{- $svcPort := .Values.backend.service.port -}} +{{- if and .Values.global.ingress.className (not (hasKey .Values.backend.ingress.annotations "kubernetes.io/ingress.class")) }} + {{- $_ := set .Values.backend.ingress.annotations "kubernetes.io/ingress.class" .Values.global.ingress.className}} +{{- 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 }} + labels: + {{- include "drone-tm.labels" . | nindent 4 }} + app.kubernetes.io/component: backend + {{- with .Values.backend.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.global.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.global.ingress.className }} + {{- end }} + {{- if .Values.backend.ingress.tls }} + tls: + {{- range .Values.backend.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.backend.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 }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/drone-tm/templates/backend-service.yaml b/charts/drone-tm/templates/backend-service.yaml new file mode 100644 index 000000000..e8c087f60 --- /dev/null +++ b/charts/drone-tm/templates/backend-service.yaml @@ -0,0 +1,19 @@ +{{- if .Values.backend.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "drone-tm.backend.fullname" . }} + labels: + {{- include "drone-tm.labels" . | nindent 4 }} + app.kubernetes.io/component: backend +spec: + type: {{ .Values.backend.service.type }} + ports: + - port: {{ .Values.backend.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "drone-tm.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: backend +{{- end }} diff --git a/charts/drone-tm/templates/frontend-deployment.yaml b/charts/drone-tm/templates/frontend-deployment.yaml new file mode 100644 index 000000000..d5d5ebb7a --- /dev/null +++ b/charts/drone-tm/templates/frontend-deployment.yaml @@ -0,0 +1,70 @@ +{{- if .Values.frontend.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "drone-tm.frontend.fullname" . }} + labels: + {{- include "drone-tm.labels" . | nindent 4 }} + app.kubernetes.io/component: frontend +spec: + replicas: {{ .Values.frontend.replicaCount }} + selector: + matchLabels: + {{- include "drone-tm.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: frontend + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "drone-tm.labels" . | nindent 8 }} + app.kubernetes.io/component: frontend + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "drone-tm.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-frontend + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.frontend.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.frontend.service.port }} + protocol: TCP + resources: + {{- toYaml .Values.frontend.resources | nindent 12 }} + envFrom: + {{- toYaml .Values.frontend.extraEnvFrom | nindent 12 }} + env: + - name: VITE_API_URL + value: "http://{{ include "drone-tm.backend.fullname" . }}:{{ .Values.backend.service.port }}" + volumeMounts: + - name: frontend-html + mountPath: /tmp/frontend_html + volumes: + - name: frontend-html + emptyDir: {} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/drone-tm/templates/frontend-ingress.yaml b/charts/drone-tm/templates/frontend-ingress.yaml new file mode 100644 index 000000000..168d108ed --- /dev/null +++ b/charts/drone-tm/templates/frontend-ingress.yaml @@ -0,0 +1,60 @@ +{{- if and .Values.frontend.enabled .Values.frontend.ingress.enabled -}} +{{- $fullName := include "drone-tm.frontend.fullname" . -}} +{{- $svcPort := .Values.frontend.service.port -}} +{{- if and .Values.global.ingress.className (not (hasKey .Values.frontend.ingress.annotations "kubernetes.io/ingress.class")) }} + {{- $_ := set .Values.frontend.ingress.annotations "kubernetes.io/ingress.class" .Values.global.ingress.className}} +{{- 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 }} + labels: + {{- include "drone-tm.labels" . | nindent 4 }} + app.kubernetes.io/component: frontend + {{- with .Values.frontend.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.global.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.global.ingress.className }} + {{- end }} + {{- if .Values.frontend.ingress.tls }} + tls: + {{- range .Values.frontend.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.frontend.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 }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/drone-tm/templates/frontend-service.yaml b/charts/drone-tm/templates/frontend-service.yaml new file mode 100644 index 000000000..28ca935df --- /dev/null +++ b/charts/drone-tm/templates/frontend-service.yaml @@ -0,0 +1,19 @@ +{{- if .Values.frontend.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "drone-tm.frontend.fullname" . }} + labels: + {{- include "drone-tm.labels" . | nindent 4 }} + app.kubernetes.io/component: frontend +spec: + type: {{ .Values.frontend.service.type }} + ports: + - port: {{ .Values.frontend.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "drone-tm.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: frontend +{{- end }} diff --git a/charts/drone-tm/templates/odm-nodeodm-deployment.yaml b/charts/drone-tm/templates/odm-nodeodm-deployment.yaml new file mode 100644 index 000000000..35861f6b2 --- /dev/null +++ b/charts/drone-tm/templates/odm-nodeodm-deployment.yaml @@ -0,0 +1,60 @@ +{{- if and .Values.odm.enabled .Values.odm.nodeodm.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "drone-tm.odm.nodeodm.fullname" . }} + labels: + {{- include "drone-tm.labels" . | nindent 4 }} + app.kubernetes.io/component: odm-nodeodm +spec: + replicas: {{ .Values.odm.nodeodm.replicaCount }} + selector: + matchLabels: + {{- include "drone-tm.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: odm-nodeodm + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "drone-tm.labels" . | nindent 8 }} + app.kubernetes.io/component: odm-nodeodm + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "drone-tm.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: odm-nodeodm + image: "{{ .Values.odm.nodeodm.image.repository }}:{{ .Values.odm.nodeodm.image.tag }}" + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: {{ .Values.odm.nodeodm.service.port }} + protocol: TCP + resources: + {{- toYaml .Values.odm.nodeodm.resources | nindent 12 }} + env: + - name: NODEODM_HOSTNAME + value: "webodm-node-odm-1" + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/drone-tm/templates/serviceaccount.yaml b/charts/drone-tm/templates/serviceaccount.yaml new file mode 100644 index 000000000..f4eb35e6e --- /dev/null +++ b/charts/drone-tm/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "drone-tm.serviceAccountName" . }} + labels: + {{- include "drone-tm.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/drone-tm/templates/worker-deployment.yaml b/charts/drone-tm/templates/worker-deployment.yaml new file mode 100644 index 000000000..3109b6800 --- /dev/null +++ b/charts/drone-tm/templates/worker-deployment.yaml @@ -0,0 +1,91 @@ +{{- if .Values.worker.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "drone-tm.worker.fullname" . }} + labels: + {{- include "drone-tm.labels" . | nindent 4 }} + app.kubernetes.io/component: worker +spec: + replicas: {{ .Values.worker.replicaCount }} + selector: + matchLabels: + {{- include "drone-tm.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: worker + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "drone-tm.labels" . | nindent 8 }} + app.kubernetes.io/component: worker + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "drone-tm.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-worker + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.worker.image.repository }}:{{ .Values.worker.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.worker.image.pullPolicy }} + command: ["arq", "app.arq.tasks.WorkerSettings"] + resources: + {{- toYaml .Values.worker.resources | nindent 12 }} + envFrom: + {{- toYaml .Values.worker.extraEnvFrom | nindent 12 }} + env: + {{- if .Values.postgresql.enabled }} + - name: POSTGRES_HOST + value: {{ include "drone-tm.fullname" . }}-postgresql + - name: POSTGRES_PORT + value: "5432" + - name: POSTGRES_DB + value: {{ .Values.postgresql.auth.database }} + - name: POSTGRES_USER + value: {{ .Values.postgresql.auth.username }} + {{- end }} + {{- if .Values.minio.enabled }} + - name: S3_ENDPOINT + value: "http://{{ include "drone-tm.fullname" . }}-minio:9000" + - name: S3_ACCESS_KEY + value: {{ .Values.minio.auth.rootUser | quote }} + {{- end }} + {{- if .Values.redis.enabled }} + - name: REDIS_HOST + value: {{ include "drone-tm.fullname" . }}-redis-master + - name: REDIS_PORT + value: "6379" + {{- end }} + livenessProbe: + {{- toYaml .Values.worker.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.worker.readinessProbe | nindent 12 }} + volumeMounts: + - name: frontend-html + mountPath: /project/src/backend/frontend_html + volumes: + - name: frontend-html + emptyDir: {} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/drone-tm/values-local.yaml b/charts/drone-tm/values-local.yaml new file mode 100644 index 000000000..e069ab6de --- /dev/null +++ b/charts/drone-tm/values-local.yaml @@ -0,0 +1,89 @@ +# Development values for drone-tm +# Use with: helm install drone-tm ./charts/drone-tm -f values-local.yaml + +global: + domain: drone-tm.localhost + +# Development backend configuration +backend: + replicaCount: 1 + resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + ingress: + enabled: false + +# Development frontend configuration +frontend: + replicaCount: 1 + resources: + limits: + cpu: 250m + memory: 256Mi + requests: + cpu: 125m + memory: 128Mi + ingress: + enabled: false + +# Development worker configuration +worker: + replicaCount: 1 + resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + +# Enable ODM processing for development (optional) +odm: + enabled: true + +# Development database configuration +postgresql: + enabled: true + primary: + resources: + limits: + cpu: 1000m + memory: 1Gi + requests: + cpu: 500m + memory: 512Mi + persistence: + size: 10Gi + +# Development MinIO configuration +minio: + enabled: true + replicas: 1 + resources: + limits: + cpu: 500m + memory: 1Gi + requests: + cpu: 250m + memory: 512Mi + persistence: + size: 10Gi + +# Development Redis configuration +redis: + enabled: true + architecture: standalone + master: + resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + persistence: + size: 5Gi diff --git a/charts/drone-tm/values.yaml b/charts/drone-tm/values.yaml new file mode 100644 index 000000000..96ce7517f --- /dev/null +++ b/charts/drone-tm/values.yaml @@ -0,0 +1,283 @@ +# Default values for drone-tm +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +global: + domain: drone-tm.localhost + storageClass: "" + ingress: + className: "" + +# Main application services +backend: + enabled: true + image: + repository: ghcr.io/hotosm/drone-tm/backend + tag: "2025.3.2" + pullPolicy: IfNotPresent + + replicaCount: 1 + + service: + type: ClusterIP + port: 8000 + + ingress: + enabled: true + className: "" + annotations: + kubernetes.io/ingress.class: nginx + tls: [] + hosts: + - host: api.drone-tm.localhost + paths: + - path: / + pathType: Prefix + + resources: {} + # limits: + # cpu: 1000m + # memory: 1Gi + # requests: + # cpu: 500m + # memory: 512Mi + + livenessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 30 + periodSeconds: 10 + readinessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 5 + periodSeconds: 5 + + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 10 + targetCPUUtilizationPercentage: 80 + + extraEnvFrom: + - secretRef: + name: drone-tm-secrets + + # Database configuration + database: + host: "" + port: 5432 + name: "" + user: "" + password: "" + + # S3 configuration + s3: + endpoint: "" + accessKey: "" + secretKey: "" + bucket: "" + region: "" + +frontend: + enabled: true + image: + repository: ghcr.io/hotosm/drone-tm/frontend + tag: "2025.3.2" + pullPolicy: IfNotPresent + + replicaCount: 1 + + service: + type: ClusterIP + port: 3040 + + ingress: + enabled: true + className: "" + annotations: + kubernetes.io/ingress.class: nginx + tls: [] + hosts: + - host: drone-tm.localhost + paths: + - path: / + pathType: Prefix + + resources: {} + + extraEnvFrom: + - secretRef: + name: drone-tm-secrets + +worker: + enabled: true + image: + repository: ghcr.io/hotosm/drone-tm/backend + tag: "2025.3.2" + pullPolicy: IfNotPresent + + replicaCount: 1 + + resources: {} + + extraEnvFrom: + - secretRef: + name: drone-tm-secrets + + livenessProbe: + exec: + command: + - arq + - app.arq.tasks.WorkerSettings + - --check + initialDelaySeconds: 30 + periodSeconds: 30 + readinessProbe: + exec: + command: + - arq + - app.arq.tasks.WorkerSettings + - --check + initialDelaySeconds: 5 + periodSeconds: 5 + +# ODM processing (optional) +odm: + enabled: false + + nodeodm: + enabled: true + image: + repository: docker.io/opendronemap/nodeodm + tag: "3.5.5" + replicaCount: 1 + service: + type: ClusterIP + port: 3000 + resources: {} + + webodm: + enabled: true + image: + repository: docker.io/opendronemap/webodm_webapp + tag: "2.8.3" + replicaCount: 1 + service: + type: ClusterIP + port: 8000 + ingress: + enabled: false + className: "" + annotations: {} + hosts: [] + resources: {} + + worker: + enabled: true + image: + repository: docker.io/opendronemap/webodm_webapp + tag: "2.8.3" + replicaCount: 1 + resources: {} + +# Subchart configurations +postgresql: + enabled: true + image: + registry: docker.io + repository: bitnami/postgresql + tag: 16-debian-12 + auth: + enablePostgresUser: false + username: dtm + database: dtm_db + existingSecret: drone-tm-secrets + secretKeys: + userPasswordKey: POSTGRES_PASSWORD + initdb: + scripts: + 01-enable-postgis.sql: | + CREATE EXTENSION IF NOT EXISTS postgis; + primary: + resources: + limits: + cpu: 2000m + memory: 2Gi + requests: + cpu: 500m + memory: 500Mi + +minio: + enabled: true + mode: standalone + replicas: 1 + image: + repository: quay.io/minio/minio + tag: RELEASE.2024-08-03T04-33-23Z + environment: + MINIO_BROWSER: "off" + mountPath: /mnt/data + resources: + requests: + memory: 200Mi + auth: + rootUser: dtm_user + existingSecret: drone-tm-secrets + existingSecretKey: S3_SECRET_KEY + defaultBuckets: "dtm-bucket" + ingress: + enabled: false + ingressClassName: ~ + annotations: {} + path: / + hosts: [] + tls: [] + +redis: + enabled: true + image: + registry: docker.io + repository: bitnami/redis + tag: 7.2-debian-12 + auth: + enabled: true + existingSecret: drone-tm-secrets + secretKeys: + passwordKey: REDIS_PASSWORD + architecture: standalone + master: + resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 100m + memory: 128Mi + +# Kubernetes resources +serviceAccount: + create: true + automount: true + annotations: {} + name: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: + runAsNonRoot: true + runAsUser: 1001 + +nodeSelector: {} +tolerations: [] +affinity: {}