DefectDojo / django-DefectDojo

DevSecOps, ASPM, Vulnerability Management. All on one platform.
https://defectdojo.com
BSD 3-Clause "New" or "Revised" License
3.6k stars 1.52k forks source link

Highly Available PostreSQL/celery/redis doesn't deploy as HA per documentation #10547

Open jcleve opened 2 months ago

jcleve commented 2 months ago

Bug description I'm following the Kubernetes instructions for a highly available postresql cluster, and while the chart installs without error, PostreSQL, celery, and redis are not deployed as highly available. PostgreSQL comes up with one pod, Celery comes up with 2 pods (one beat, one worker), and redis comes up with one pod.

From the docs

Run highly available PostgreSQL cluster instead of MySQL - recommended setup for production environment.

helm install \ defectdojo \ ./helm/defectdojo \ --namespace="${K8S_NAMESPACE}" \ --set host="defectdojo.${TLS_CERT_DOMAIN}" \ --set django.replicas=3 \ --set celery.replicas=3 \ --set rabbitmq.replicas=3 \ --set django.ingress.secretName="minikube-tls" \ --set mysql.enabled=false \ --set database=postgresql \ --set postgresql.enabled=true \ --set postgresql.replication.enabled=true \ --set postgresql.replication.slaveReplicas=3 \ --set createSecret=true \ --set createRabbitMqSecret=true \ --set createRedisSecret=true \ --set createMysqlSecret=true \ --set createPostgresqlSecret=true

I only changed redis to be enabled, rabbitmq to be disabled, and redis.replicas=3.

Steps to reproduce

  1. Deploy the helm chart per the instructions in the documentation. Observe that only Django comes up with 3 pods.

Expected behavior All core components are highly available (Django, postreSQL, Celery, and redis or rabbitmq) with the number of replicas defined at deploy-time

Deployment method (select with an X)

Environment information

albertokawahara commented 1 month ago

Hello, We're getting the same error:

$ helm install \ defectdojo \ ./helm/defectdojo \ --namespace=defectdojo \ --set django.replicas=3 \ --set celery.replicas=3 \ --set rabbitmq.replicas=3 \ --set mysql.enabled=false \ --set database=postgresql \ --set postgresql.enabled=false \ --set postgresqlha.enabled=true \ --set createSecret=true \ --set createRabbitMqSecret=true \ --set createPostgresHaSecret=true \ --set createPostgresqlHaPgpoolSecret=true Error: INSTALLATION FAILED: template: defectdojo/charts/rabbitmq/templates/svc.yaml:12:14: executing "defectdojo/charts/rabbitmq/templates/svc.yaml" at <include "common.labels.standard" (dict "customLabels" $labels "context" $)>: error calling include: template: defectdojo/charts/postgresqlha/charts/common/templates/_labels.tpl:6:27: executing "common.labels.standard" at <include "common.names.name" .>: error calling include: template: defectdojo/charts/postgresqlha/charts/common/templates/_names.tpl:6:18: executing "common.names.name" at <.Chart.Name>: nil pointer evaluating interface {}.Name

It is working fine with Postgresql but it is failing with this error when trying to deploy PostgresHa. Please let us know your suggestions, thanks! @himadriganguly

zazathomas commented 1 week ago

Also having similar errors, I've created a PR here to fix the replica counts for celery(workers & beat). The helm chart doesn't seem to have redis HA implemented, appears the K8s documentation is wrong. Postgres gives some errors that I haven't been able to debug