Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating scaledObject annotations does not propagate the to HPA #5468

Closed
chubchubsancho opened this issue Feb 1, 2024 · 6 comments
Closed
Labels
bug Something isn't working stale All issues that are marked as stale due to inactivity

Comments

@chubchubsancho
Copy link

Report

We need some annotations on our HPA for internal process. And sometimes we need to update them.
Acutally scaledObject annotation are propagated on creation but they are not updated if scaledObject change target only annotiations.

If other change append at same times no there is no problem

Expected Behavior

Even if we update only annotations on scaledObject hpa need to be reconcile.

Actual Behavior

No change append on hpa annotations

Steps to Reproduce the Problem

  1. Create a scaled object with some annotations
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  annotations:
    test: "this-is-a-test"
  labels:
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: 1.0.0
  name: test
spec:
  advanced:
    horizontalPodAutoscalerConfig:
      behavior:
        scaleDown:
          policies:
          - periodSeconds: 60
            type: Percent
            value: 10
          - periodSeconds: 60
            type: Pods
            value: 5
          selectPolicy: Min
          stabilizationWindowSeconds: 1800
        scaleUp:
          policies:
          - periodSeconds: 5
            type: Percent
            value: 100
          - periodSeconds: 5
            type: Pods
            value: 4
          selectPolicy: Max
          stabilizationWindowSeconds: 0
    scalingModifiers: {}
  cooldownPeriod: 300
  maxReplicaCount: 10
  minReplicaCount: 2
  pollingInterval: 30
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: test
  triggers:
  - metadata:
      value: "20"
    metricType: AverageValue
    type: cpu
  1. HPA is created with those annotations
  2. Update scaledObject annotations and deploy it
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  annotations:
    test: "this-is-another-test"
  labels:
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: 1.0.0
  name: test
spec:
  advanced:
    horizontalPodAutoscalerConfig:
      behavior:
        scaleDown:
          policies:
          - periodSeconds: 60
            type: Percent
            value: 10
          - periodSeconds: 60
            type: Pods
            value: 5
          selectPolicy: Min
          stabilizationWindowSeconds: 1800
        scaleUp:
          policies:
          - periodSeconds: 5
            type: Percent
            value: 100
          - periodSeconds: 5
            type: Pods
            value: 4
          selectPolicy: Max
          stabilizationWindowSeconds: 0
    scalingModifiers: {}
  cooldownPeriod: 300
  maxReplicaCount: 10
  minReplicaCount: 2
  pollingInterval: 30
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: test
  triggers:
  - metadata:
      value: "20"
    metricType: AverageValue
    type: cpu
  1. HPA is not updated

Logs from KEDA operator

example

KEDA Version

2.13.0

Kubernetes Version

1.26

Platform

Other

Scaler Details

cpu,prometheus

Anything else?

No response

@chubchubsancho chubchubsancho added the bug Something isn't working label Feb 1, 2024
@chubchubsancho chubchubsancho changed the title Updating scaledObject annotation does not propagate the to HPA Updating scaledObject annotations does not propagate the to HPA Feb 1, 2024
@JorTurFer
Copy link
Member

Hey!
Thanks for reporting! I can replicate the issue.
Are you willing to contribute with the fix?

@JorTurFer
Copy link
Member

I think that the issue is just that KEDA doesn't trigger a reconciliation if (generic) annotations or labels change:

For(&kedav1alpha1.ScaledObject{}, builder.WithPredicates(
predicate.Or(
kedacontrollerutil.PausedPredicate{},
kedacontrollerutil.PausedReplicasPredicate{},
kedacontrollerutil.ScaleObjectReadyConditionPredicate{},
predicate.GenerationChangedPredicate{},
),
)).

Do you know if there is any reason for ignoring those changes @zroubalik ?

Copy link

stale bot commented Apr 1, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Apr 1, 2024
@zroubalik
Copy link
Member

I think that the issue is just that KEDA doesn't trigger a reconciliation if (generic) annotations or labels change:

For(&kedav1alpha1.ScaledObject{}, builder.WithPredicates(
predicate.Or(
kedacontrollerutil.PausedPredicate{},
kedacontrollerutil.PausedReplicasPredicate{},
kedacontrollerutil.ScaleObjectReadyConditionPredicate{},
predicate.GenerationChangedPredicate{},
),
)).

Do you know if there is any reason for ignoring those changes @zroubalik ?

Yeah, this has been done to reduce the number of reconciliations.

@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Apr 10, 2024
Copy link

stale bot commented Jun 9, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Jun 9, 2024
Copy link

stale bot commented Jun 17, 2024

This issue has been automatically closed due to inactivity.

@stale stale bot closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale All issues that are marked as stale due to inactivity
Projects
Archived in project
Development

No branches or pull requests

3 participants