lifecycle-toolkit icon indicating copy to clipboard operation
lifecycle-toolkit copied to clipboard

How to create ArgoCD extensions

Open mowies opened this issue 1 year ago • 1 comments

Goal

The overall goal is to put the monitoring/o11y parts of Keptn into an ArgoCD extension so that it can easily be used with ArgoCD.

Details

Research how to create an extension and create a PoC as the result.

Use cases:

  • Argo CD: observability of deployments, UI extensions that show graphs for KeptnMetrics
  • Argo Rollouts: integrate Keptn analyses into Argo experiments
  • Argo Workflows: provide observability

DoD

  • PoC implemented
  • strategy/plan on how to integrate keptn using an extension created

Notes

  • docs: https://github.com/argoproj-labs/argocd-extensions

mowies avatar Mar 27 '24 12:03 mowies

Research findings

It is possible to introduce Keptn as Argo extension. In fact, using Keptn as Argo extension means installing it to the same cluster as Argo is installed in and enabled and configure the Argo Proxy Extensions. In this case Keptn can act as backend for features implemented as Argo UI extensions (description how to implement them available here).

With UI extensions it is possible to enhance Argo CD web interface to provide data to the user. However the data is restricted to the resources that belongs to the Application. With proxy extensions it is also possible to add additional functionality that have access to data provided by backend services. In this case Argo CD API server acts as a reverse-proxy authenticating and authorizing incoming requests before forwarding to the backend service.

A nice example of an extension (with UI extension and backend filling it) is available here.

Steps to deploy Keptn as Argo extension (backend part)

As already mentioned, Keptn as an extension of Argo will live in the same cluster as Argo and therefore also deployed independently

  1. Install Keptn according to the installation docs

  2. Enable Keptn extension in Argo CD Proxy extensions (all information here) by editing the argocd-cmd-params-cm ConfigMap

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cmd-params-cm
  namespace: argocd
data:
  server.enable.proxy.extension: "true"
  1. The Keptn extension needs to be authorized in Argo CD API server. To enable it for all users add the following entry in argocd-rbac-cm ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/name: argocd-rbac-cm
    app.kubernetes.io/part-of: argocd
  name: argocd-rbac-cm
data:
  policy.csv: |-
    p, role:admin, extensions, invoke, keptn, allow
  1. After the extension is enabled and has the proper permissions, it need to be configured in the main Argo CD configmap (argocd-cm)
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cm
  namespace: argocd
data:
  extension.config: |
    extensions:
    - name: keptn
      backend:
        services:
        - url: <keptn-metrics-url>

After this configuration, the Keptn endpoint (the url configured in the argocd-cm ConfigMap) is exposed as a service under the following url:

<argocd-host>/extensions/keptn

This URL can be afterwards used in the UI extension as a backend service.

Final thoughts

This research defines mostly how the Keptn extension of Argo can be implemented. What should be implemented is part of team discussions.

odubajDT avatar Apr 09 '24 13:04 odubajDT