keptn / lifecycle-toolkit

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

[Tracking] Integration scenarios #2850

Open mowies opened 10 months ago

mowies commented 10 months ago

Goal

Integrate well with other tools so that users can take the most advantage of the synergies of those tools together with Keptn.

Details

This epic should be used to do research on possible integration opportunities with the tools below, to connect with the maintainer teams to present what Keptn can do and to get feedback from them on integration options. This epic should also be used for any user guides and other documentation that comes out as a result of the research. Additionally, this epic should also include any needed implementation work to integrate better with other tools.

The tools that have the best fit are:

Definition of Done

### Tasks
- [ ] #2899
- [ ] #3096 
- [ ] #2900
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/2903
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/2901
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/2262
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/2963
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/3002
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/3025
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/3026
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/3027
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/3050
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/3051
- [ ] https://github.com/keptn/lifecycle-toolkit/issues/3052
sudiptob2 commented 10 months ago

Thanos: could be a quick win to have a metrics provider since it's basically prometheus

I tested the Keptn Prometheus provider with Thanos, and it looks like it's working. I was considering to create a Thanos provider, but it seems that the Prometheus provider can be used to query Thanos šŸ¤”

I followed Keptn + HPA example and used Thanos server as the TargetServer for metrics instead of the Prometheus server. I might be mistaken as I don't have much experience with this.

Here is my KeptnMetric manifests I used

apiVersion: metrics.keptn.sh/v1alpha3
kind: KeptnMetricsProvider
metadata:
  name: thanos-provider
  namespace: podtato-kubectl
spec:
  type: prometheus
  targetServer: "http://thanos-query.thanos.svc.cluster.local:9090"

---
apiVersion: metrics.keptn.sh/v1alpha3
kind: KeptnMetric
metadata:
  name: cpu-throttling
  namespace: podtato-kubectl
spec:
  provider:
    name: thanos-provider
  query: 'sum(kube_pod_container_resource_limits{resource="cpu"})'
  fetchIntervalSeconds: 10
  range:
    interval: "5m"
    step: "1m"
    aggregation: "avg"

As you can see in the screenshot, we get metric output.

image
rakshitgondwal commented 10 months ago

@sudiptob2 That should be the expected behavior because Thanos implements the Prometheus HTTP API to query data via PromQL. I think we can have a new KeptnMetricsProvider type for Thanos in this case and reuse the functionality of the Prometheus provider.

sudiptob2 commented 10 months ago

@rakshitgondwal make sense. I was also thinking about that, like adding a case here for Thanos which just return PrometheusProvider. Perhaps, it might also be possible to solve without any code change, by simply mentioning to use prometheus type for thanos in the documentation.

mowies commented 10 months ago

thanks for looking into this! i think we can find a nice solution that prevents lots of code duplication, but let's see. for now, the epic is still work in progress. i'll write some sub-tickets for it soon and then we can refine and work them

heckelmann commented 10 months ago

I know that @thschue was integrating Keptn with K8sGPT, maybe we should put it on the List as well.