Skip to content

Bug: Deployment time replicas are set wrong in case of fullnameOverrideΒ #3445

@prakarsh-dt

Description

@prakarsh-dt

πŸ“œ Description

Devtron automatically detects current desiredReplicas from the HPA and sets the replicas according to it while sending a new deployment. This is done so that any application that has higher number of replicas brought up from an HPA isn't reset to the initial values specified in autoscaling configs/replicas.
If an HPA is not detected according to the HPA name template, it uses replica field from deployment-template ( Logic at https://github.com/devtron-labs/devtron/blob/5283e1c712c4a555c993a64247ecc058530ca1bf/pkg/app/AppService.go#LL2264C1-L2265C1 )

This logic needs to update to consider the HPA name template in case of fullnameOverride is used.

πŸ‘Ÿ Reproduction steps

  1. Create an app with autoscaling enabled and autoscaling.MinReplicas=2 and replicas=1
  2. Deploy this app and wait for it to get healthy.
  3. Ensure that Rolling strategy is configured with default setting (ie MaxUnavailable=1, maxSurge=25% )
  4. Redeploy this app with a different image and closely watch the app details while refreshing it on 10s intervals.
  5. The deployment will not respect rolling strategy and both the old pods will terminate creating a disruption.

πŸ‘ Expected behavior

The deployment should respect deployment strategy rolling and should terminate the pods one by one instead. The logic should auto-detect any HPA objects created either from rawYaml or from KedaAutoscaling and use relevant desired replicas from these objects instead of using replica from deployment-template.

πŸ‘Ž Actual Behavior

The deployment will not respect rolling strategy and both the old pods will terminate creating a disruption. This happens because the new deployment happens with replica=1 which is passed on from the deployment-configuration if an hpa (with the specified format ie appName-envName is not detected).

☸ Kubernetes version

1.26

Cloud provider

AWS

🌍 Browser

Chrome

🧱 Your Environment

No response

βœ… Proposed Solution

The hpa detection logic should auto-detect any HPA objects created either from rawYaml or from KedaAutoscaling and use relevant desired replicas from these objects instead of using replica from deployment-template.

πŸ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find any similar issue

🏒 Have you read the Code of Conduct?

AB#3369

Metadata

Metadata

Labels

To be prioritizedIssues that are yet to be prioritizedbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions