keptn / lifecycle-toolkit

Toolkit for cloud-native application lifecycle management
https://keptn.sh
Apache License 2.0
298 stars 119 forks source link

KEDA integration #605

Closed thisthat closed 1 year ago

thisthat commented 1 year ago

Goal

Provide integration between KEDA and KeptnMetric

Technical Details

In #601, we introduced a metric adapter that provides metrics via the custom.metrics.k8s.io APIs. KEDA should directly use these APIs to scale a workload.

Acceptance Criteria

DoD

Dependencies

References

Example

From @thschue:

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: http-scaledobject
  namespace: default
  labels:
    deploymentName: podtato-head-entry
spec:
  maxReplicaCount: 4
  pollingInterval: 3  # Optional. Default: 30 seconds
  cooldownPeriod:  5 # Optional. Default: 300 seconds
  scaleTargetRef:
    name: podtato-head-entry
  triggers:
  - type: metrics-api
    metadata:
      targetValue: "8.8"
      activationTargetValue: "3.8"
      url: "http://keptn-metrics-apiserver.keptn-lifecycle-toolkit-system.svc.cluster.local:9999/api/v1/metrics/default/aggregated-data"
      valueLocation: "value"
shardulsrivastava commented 1 year ago

@thisthat I would like to work on this issue.

thisthat commented 1 year ago

Thank you @shardulsrivastava, I've assigned the ticket to you

thisthat commented 1 year ago

Hey @shardulsrivastava, any progress on this ticket? :)

Shubh-2402 commented 1 year ago

Hey @thisthat, I would like to work on this issue. You can assign it to me if it has gone stale. I would need a little guidance to get started though

thisthat commented 1 year ago

Hey @Shubh-2402 thanks for volunteering. The best way to start is by running this example: https://github.com/keptn/lifecycle-toolkit/tree/main/examples/sample-app Here, you define the following Evaluation Definition: https://github.com/keptn/lifecycle-toolkit/blob/main/examples/sample-app/version-3/app-pre-deploy-eval.yaml The idea is to replicate this into a KeptnMetric CRD: https://github.com/keptn/lifecycle-toolkit/blob/main/operator/apis/metrics/v1alpha1/keptnmetric_types.go#L28 The metric operator will then watch this metric from Prometheus continuously. Finally, you should set up KEDA and use the example mentioned in the ticket to create a scaler for the workload. In the URL fields you are using the APIs provided by the operator, their definition is the following: /api/v1/metrics/<namespace>/<metric-name> where <namespace> is the namespace you stored your KeptnMetric CRD and <metric-name> is the name of your KeptnMetric CRD. You can reach out to me directly if you have issue with something :)

github-actions[bot] commented 1 year ago

This issue will be unassigned in 1 week if no further activity is seen. If you are active please provide an update on the status of the issue and if you would like to continue working on it.

github-actions[bot] commented 1 year ago

This issue will be unassigned in 1 week if no further activity is seen. If you are active please provide an update on the status of the issue and if you would like to continue working on it.