Skip to content

[Bug] PodDisruptionBudget is not created when replicaCount is not set #777

@qs-synth

Description

@qs-synth

What are you really trying to do?

I am deploying the service and setting up a HorizontalPodAutoscaler (HPA) to manage scaling the frontend and matching Deployments. I am also providing a podDisruptionBudget for these pods so that no more than 1 pod is unavailable at a given time.

Setting both of these at the same time does not work as expected.

Describe the bug

When setting a static value for replicaCount like 3, the PodDisruptionBudget gets created just as expected. This is a good outcome.

However, when removing the replicaCount field because the HPA controls that value and I don't want it set in multiple places, the PodDisruptionBudget is removed from the deployment. This is a bad outcome.

This appears to be due to the conditional create logic for PDB, requiring replicaCount to be above the default value.
{{- if and (gt ($serviceValues.replicaCount | int) 1) ($serviceValues.podDisruptionBudget) }}

Minimal Reproduction

Commenting out replicaCount and supplying any podDisruptionBudget will recreate the issue. Even though a podDisruptionBudget is applied, no PodDisruptionBudget resource is rendered.

values.yaml

...
server:
  frontend:
    enabled: true
    # replicaCount: 1
    podDisruptionBudget:
      maxUnavailable: 1
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions