weaveworks / weave-gitops-enterprise

This repo provides the enterprise level features for the weave-gitops product, including CAPI cluster creation and team workspaces.
https://docs.gitops.weave.works/
Apache License 2.0
160 stars 29 forks source link

[API] Clean up the cluster-service API #3220

Open foot opened 1 year ago

foot commented 1 year ago

Motivation: customers want to use our APIs! Lets tidy them up before giving users access

Tasks here:

foot commented 1 year ago

Lets follow https://protobuf.dev/programming-guides/style/

foot commented 1 year ago

Review all the places the UI is calling the static Service object and make sure we are typing it properly and not using any.

foot commented 1 year ago

Review all the places the UI is calling the static Service object and make sure we are typing it properly and not using any.

Templates, which was the main concern, seems to be all typed now which is great!

Explorer is also typed, think we are all good with this one.

foot commented 1 year ago

Oops, chatting w/ @sarataha , we realised clusters are namespaced... so this URL doesn't have enough info in it:

Options:

  1. /api/v1/namespaces/{clusterNamespace}/clusters/{clusterName}/namespaces/{namespace}/helm_releases/{name}
  2. /api/v1/clusters/{clusterNamespace}/{clusterName}/namespaces/{namespace}/helm_releases/{name}
  3. /api/v1/clusters/{clusterNameThatIncludeNamespace}/namespaces/{namespace}/helm_releases/{name}
  4. /api/v1/helmreleases # all helmrelease on all the clusters, can be filtered
  5. /api/v1/helmreleases/clusters/{clusterName}/namespaces/{namespace}/{helmReleaseName}
  6. /api/v1/helmreleases/clusters/{clusterName}
  7. /api/v1/helmreleases/namespace/{namespace}

clusterNameThatIncludeNamespace is usually default%3dmy-cluster

Flux: https://127.0.0.1:6443/apis/helm.toolkit.fluxcd.io/v2beta1/namespaces/default/helmreleases?limit=500