Date: 2023-12-04
Accepted
Requested from CX to extend Flux Runtime UI for Weave GitOps Enterprise to include also controllers ecosystem under
https://github.com/weaveworks/weave-gitops-interlock/issues/265
The following alternatives are possible:
a) extending the current solution so it works for both OSS and EE b) replacing the current solution using Explorer-based UI that works in OSS and EE c) creating a new UI in EE that leverages Explorer. The old UI remains
Current solutions is available in OSS in Flux Runtime. Where we are listing deployment by label:
opts := client.MatchingLabels{
coretypes.PartOfLabel: FluxNamespacePartOf,
}
list := &appsv1.DeploymentList{}
for _, fluxNs := range fluxNamepsaces {
if err := clustersClient.List(ctx, clusterName, list, opts, client.InNamespace(fluxNs.Name)); err != nil {
respErrors = append(respErrors, &pb.ListError{ClusterName: clusterName, Namespace: fluxNs.Name, Message: fmt.Sprintf("%s, %s", ErrListingDeployments.Error(), err)})
continue
}
A solution that would work for EE controllers would involve:
- Refactor this experience to make it generic so we could include
- Use configuration to define the deployments to show in the UI:
- OSS: to show Flux, Weave GitOps app, Tf-controller, Policy Agent, etc ...
- EE: the previous + EE controllers like pipeline, gitopssets, cluster-xxx
- Create UI via either option:
- To Rename Flux Runtime to Weave GitOps Runtime or
- to Create another UI for Weave GitOps Runtime
(+) available to OSS and EE out of the box (+) easily customizable to provide WGA runtime (-) costs of maintenance and extension (-) needs extension of existing API and UI
This solution would include:
- Do not touch Flux Runtime
- Create Weave GitOps Runtime based on Explorer by
- extend Explorer to watch deployment
- define controller runtime kind to watch via label
- create generic UI to show the runtime controllers.
(+) costs of maintenance and extension (-) not available in OSS (-) needs extension of Explorer
This would include the previous solution but also requires:
- OSS Explorer so it could be used in Weave GitOps OSS.
(+) available in OSS (+) costs of maintenance and extension (-) needs OSS explorer
Given the previous alternatives, we are going to prioritise Option A due to its applicability to OSS and EE and because any of the alternatives requires extending Explorer or OSS Explorer which also involves additional effort.
Scenario A: OSS has Weave GitOps runtime
In weaveworks/weave-gitops#4162 where
- Extended API runtime to also match deployments by label
app.kubernetes.io/part-of: weave-gitops
- Weave GitOps Controllers should be labelled with that weave-gitops label. For example, tf-controller should be labelled as follows:
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: tf-controller
namespace: flux-system
spec:
...
postRenderers:
- kustomize:
patchesStrategicMerge:
- kind: Deployment
apiVersion: apps/v1
metadata:
name: tf-controller
labels:
app.kubernetes.io/part-of: weave-gitops
- kind: CustomResourceDefinition
apiVersion: apiextensions.k8s.io/v1
metadata:
name: terraforms.infra.contrib.fluxcd.io
labels:
app.kubernetes.io/part-of: weave-gitops
An example of OSS runtime with controllers beyond Flux could be:
Scenario A: EE has Weave GitOps runtime
Given EE uses runtime API endpoints directly, importing an OSS branch would make the logic available to WGE.
The following branch has the spike changes https://github.com/weaveworks/weave-gitops-enterprise/tree/wge-3600-gitops-runtime
To solution:
- Finalise spike
- Ensure runtime controllers are decorated during release process with
app.kubernetes.io/part-of: weave-gitops
- Rename Flux Runtime to Weave GitOps Runtime or just Runtime
- Users have a way to track runtime components beyond flux.
- We have a simple way to extend it with limited costs (over other alternatives).