Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow extending flux runtime ui beyond flux to create gitops runtime #4162

Merged
merged 43 commits into from
Dec 22, 2023

Conversation

enekofb
Copy link
Contributor

@enekofb enekofb commented Dec 8, 2023

Closes of #4174

What changed?

  • added api endpoint to support for listing runtime objects beyond flux
  • added api endpoint to support for listing runtime crds beyond flux
  • addded ui components to support generic runtime api endpoint

Why was this change made?

  • to extend current runtime experience beyond flux to includes other oss components like policy or tf-controllers

How was this change implemented?

  • Duplicated api endpoints
  • Duplicated ui components
  • Added feature flag to control the behaviour

How did you validate the change?

  • UI
  • Unit

Release notes

  • Runtime UI supports runtime components beyond flux like policy agent or tf-controller. See documentation for more info.

Documentation Changes

  • Added via helm chart reference annotations and updated documentation

@enekofb enekofb changed the title wip - poc for gitops runtime out of flux runtime api allow extending flux runtime ui beyond flux to create gitops runtime Dec 15, 2023
@enekofb enekofb added the type/enhancement New feature or request label Dec 15, 2023
@enekofb
Copy link
Contributor Author

enekofb commented Dec 18, 2023

next is to refactor logic to:

  • add endpoint gitops_runtime behind the feature flag
  • add gitops_runtime ui component
  • deprecate flux_runtime one

@opudrovs
Copy link
Contributor

Some tests are failing.

Will test the current PR after I am done with testing my enterprise PR (building it now).

@enekofb enekofb removed the request for review from opudrovs December 18, 2023 17:24
@enekofb
Copy link
Contributor Author

enekofb commented Dec 18, 2023

Some tests are failing.

Will test the current PR after I am done with testing my enterprise PR (building it now).

@opudrovs sorry i assigned request too early, ignore it so far ... just reviewing the PR and need to add questions to ask.

@opudrovs
Copy link
Contributor

@enekofb ah got it, np. 👌

ui/App.tsx Outdated Show resolved Hide resolved
ui/App.tsx Outdated Show resolved Hide resolved
ui/App.tsx Show resolved Hide resolved
@enekofb enekofb force-pushed the wge-3600-gitops-runtime branch 3 times, most recently from 880b207 to 7f16f80 Compare December 20, 2023 16:51
@enekofb enekofb marked this pull request as ready for review December 20, 2023 16:59
@opudrovs
Copy link
Contributor

❔ Will any of new components/hooks/functions be used in enterprise directly? I mean, should anything be added to exports in ui/index.ts?

@opudrovs
Copy link
Contributor

❔ It's not an issue, just a minor question, related to usability (and I am not sure who will use this new UI, so don't know if it's of any importance). Since the routes of both views are slightly different:

/flux_runtime/flux
/runtime/flux

if the user toggles the feature flag and just refreshes the page (while browser stays at the same route), there will be a page not found error displayed:

Screenshot 2023-12-22 at 03 55 23

Is it possible that someone will share a link to a runtime page (in a documentation, for example) and then the flag will be toggled and the users will bump into page not working? Would a redirect or keeping both routes functional help? If it does not matter (or like in "if anyone starts screaming about it, we'll figure it out then" 😅 ), never mind.

Copy link
Contributor

@opudrovs opudrovs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great job! ✨

Tested it in Tilt with the flag on and off, everything is working as expected:

Screenshot 2023-12-22 at 03 54 59

Screenshot 2023-12-22 at 03 55 37

Just added some minor optional questions and suggestions.

ui/App.tsx Show resolved Hide resolved
ui/App.tsx Show resolved Hide resolved
website/docs/open-source/getting-started/ui-OSS.mdx Outdated Show resolved Hide resolved
website/docs/open-source/getting-started/ui-OSS.mdx Outdated Show resolved Hide resolved
website/docs/open-source/getting-started/ui-OSS.mdx Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! ✨


const supportMultipleFlux =
Object.keys(fluxVersions).length > 1 ? true : false;
const supportMultipleFlux = true;
Copy link
Contributor

@opudrovs opudrovs Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great this condition was replaced, ? true : false was redundant here.

❔ But now it looks like the condition below on line 84:

{!supportMultipleFlux && deployments[0]?.labels[fluxVersionLabel] && (
  <FluxVersionText color="neutral30" titleHeight={true}>
    This cluster is running Flux version:
    <span>{deployments[0].labels[fluxVersionLabel]}</span>
  </FluxVersionText>
)}

will never be true because supportMultipleFlux is always true? Does it mean that this FluxVersionText component will never get rendered? Or are you going to change this condition later?

And this check on line 71 is not needed too, because now it is always true:

  if (supportMultipleFlux) {
    tabs.unshift({
      name: "Flux Versions",
      path: `${path}/flux`,
      component: () => {
        return <FluxVersionsTable versions={Object.values(fluxVersions)} />;
      },
      visible: true,
    });
  }

If it's a temp change which will be fixed later, like commenting out code for the time being, could you please add a comment explaining if it's temporary or in which cases a developer might want to set this value to false?

Copy link
Contributor Author

@enekofb enekofb Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good shout, I wanted to remove it all together under the assumption of having a consistent experience between OSS and EE (using the multi-cluster scenario as baseline) ...

how do you feel and @jpellizzari about it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me!


// FIXME: make it generic enough so it fits for both FluxRuntime or WeaveGitopsRuntime
Copy link
Contributor

@opudrovs opudrovs Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ When will this FIXME be addressed? Is there a follow-up issue for this or is it just "nice to do one day"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed cause was original design to have a single component ... the design i am now behind is to just replace fluxruntime

charts/gitops-server/values.yaml Outdated Show resolved Hide resolved
@@ -24,6 +24,11 @@ envVars:
value: "true"
- name: WEAVE_GITOPS_FEATURE_CLUSTER
value: "false"
# -- Enable feature this feature flag if you want to expand Flux Runtime UI with other Weave GitOps components like Policy Agent or TF-Controller.
# Ensure that Weave GitOps Deployment and CRDs are labelled with Label 'app.kubernetes.io/part-of=weave-gitops'.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Is it possible to replace one label in labelled with Label with another word (for readability)? Maybe just labeled with or, if the word Label is required, have Label/contain Label, whatever.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, reads better now

Signed-off-by: Eneko Fernandez <[email protected]>
Signed-off-by: Eneko Fernandez <[email protected]>

Signed-off-by: Eneko Fernandez <[email protected]>
Signed-off-by: Eneko Fernandez <[email protected]>
@enekofb
Copy link
Contributor Author

enekofb commented Dec 22, 2023

❔ Will any of new components/hooks/functions be used in enterprise directly? I mean, should anything be added to exports in ui/index.ts?

Interesting question that clashes with my existing FE knowledge: yes, we would like to use the feature as is in EE. it is the second story on this epic weaveworks/weave-gitops-enterprise#3725

What changes needs to do in this PR to just use it in EE?

@enekofb
Copy link
Contributor Author

enekofb commented Dec 22, 2023

❔ It's not an issue, just a minor question, related to usability (and I am not sure who will use this new UI, so don't know if it's of any importance). Since the routes of both views are slightly different:

/flux_runtime/flux
/runtime/flux

if the user toggles the feature flag and just refreshes the page (while browser stays at the same route), there will be a page not found error displayed:

Screenshot 2023-12-22 at 03 55 23

Is it possible that someone will share a link to a runtime page (in a documentation, for example) and then the flag will be toggled and the users will bump into page not working? Would a redirect or keeping both routes functional help? If it does not matter (or like in "if anyone starts screaming about it, we'll figure it out then" 😅 ), never mind.

Yes, it is a bit annoying but think of a limited impact ( i think only once) as you face that situation in a scenario where there an existing WEGO installed. Given that its a configuration issue, it will be noticed by the platfrom eng or the dev doing the upgrade or configuration. The rest of the wego users, given there is a new release of the app would need to relogin and use whatever route is there via navigation so hopefully not that impacted.

Having both routes /flux_runtime and /runtime feels semantically incorrect in terms of exectations for users going to /flux_runtime and potentially seeing other non-flux controllers

My 2cts is that we could deliver as is and as proven value, we deprecate flux_runtime as a sub-set of runtime ... if not value for runtime ... then we just dont ship it for OSS (only for EE )

How do you feel about that @opudrovs ?

Signed-off-by: Eneko Fernandez <[email protected]>
tools/helm-values-dev.yaml Outdated Show resolved Hide resolved
@enekofb
Copy link
Contributor Author

enekofb commented Dec 22, 2023

@opudrovs re-requested review after addressing comments. PTAL 🙏

@opudrovs
Copy link
Contributor

Having both routes /flux_runtime and /runtime feels semantically incorrect in terms of exectations for users going to /flux_runtime and potentially seeing other non-flux controllers

My 2cts is that we could deliver as is and as proven value, we deprecate flux_runtime as a sub-set of runtime ... if not value for runtime ... then we just dont ship it for OSS (only for EE )

@enekofb I see, thanks, fine with me.

@opudrovs
Copy link
Contributor

opudrovs commented Dec 22, 2023

@enekofb

Interesting question that clashes with my existing FE knowledge: yes, we would like to use the feature as is in EE. it is the second story on this epic weaveworks/weave-gitops-enterprise#3725

What changes needs to do in this PR to just use it in EE?

It's more related to our specific product setup and to how we build the OSS package (@weaveworks/weave-gitops) which is imported to enterprise not frontend in general, you frontend knowledge is fine. 😸

In order to be able to import an identifier in enterprise from OSS (I mean directly, if it's not a part of an already imported component), you need to export it from OSS in ui/index.ts. Just import them to index.ts and add them to the long list of exports:

export {

I am not sure what should be added to the exports, it depends on what will be imported when the new components/function are used in enterprise. So, feel free to add the exports now or in the next issue.

Copy link
Contributor

@opudrovs opudrovs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-tested it with the flag on and off, LGTM!

@enekofb
Copy link
Contributor Author

enekofb commented Dec 22, 2023

@enekofb

Interesting question that clashes with my existing FE knowledge: yes, we would like to use the feature as is in EE. it is the second story on this epic weaveworks/weave-gitops-enterprise#3725

What changes needs to do in this PR to just use it in EE?

It's more related to our specific product setup and to how we build the OSS package (@weaveworks/weave-gitops) which is imported to enterprise not frontend in general, you frontend knowledge is fine. 😸

In order to be able to import an identifier in enterprise from OSS (I mean directly, if it's not a part of an already imported component), you need to export it from OSS in ui/index.ts. Just import them to index.ts and add them to the long list of exports:

export {

I am not sure what should be added to the exports, it depends on what will be imported when the new components/function are used in enterprise. So, feel free to add the exports now or in the next issue.

done!
93d08fe

Signed-off-by: Eneko Fernandez <[email protected]>
@enekofb enekofb merged commit 0af2f4f into main Dec 22, 2023
27 checks passed
@enekofb enekofb deleted the wge-3600-gitops-runtime branch December 22, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants