-
Notifications
You must be signed in to change notification settings - Fork 702
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
Move AppListView route to be cluster-aware. #1793
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @absoludity I have some minor suggestions.
BTW, I use vscode with the typescript plugin, that helps a lot for example it automatically order imports and fix some lint issues when saving files.
to: "apps", | ||
}, | ||
{ | ||
children: "Catalog", | ||
namespaced: true, | ||
clustered: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the catalog not "clustered"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two reasons: 1) I've not yet updated the routes and related components etc: part of the reason for replacing namespaced
(which was no longer used as all were transitioned) with clustered
is so I can land code in reviewable chunks, but also 2) I'm not yet certain we'll want to make the catalog URI clustered, in that we won't (at least initially) be supporting per-namespace repos/catalogs on additional clusters and so the only catalog a user should see when viewing for an additional cluster is the global catalog. I may later move this to specifically use the default
cluster with _all
namespaces.
Does that make sense? EDIT: all that said, it no longer exists after updating to use url.app.catalog()
as per below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's something temporary it's better to leave a comment saying why.
IMO, the catalog URI should be eventually clustered:
- "global" App repos may differ between clusters
- namespaced repos should be eventually supported
Also, in my opinion, the multi-cluster support shouldn't be claimed as "complete" if secondary clusters have less functionality than the main one. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's something temporary it's better to leave a comment saying why.
As above, the code no longer exists since updating to use shared/url
.
IMO, the catalog URI should be eventually clustered:
In a following PR, you'll see that I did add the /c/:cluster/
prefix to the catalog URI, because importantly, the URI defines the catalog available for install in that location (cluster+namespace), ie. the target.
* "global" App repos may differ between clusters
Global app repos are global for the Kubeapps installation in the current design. If I switched to browse a different Kubeapps installed on a different cluster (which happened to also support a union of clusters as the first installation), it may have a different set of global app repos. But I don't plan for a single Kubeapps instalation to have different global app repos depending on the cluster - there is one Kubeapps installation (with a set of global app repos) which supports multiple clusters. Let's chat about this tonight?
* namespaced repos should be eventually supported
Yep, they should, but this is tied together with deciding on the future of AppRepos with OCI in the mix, which we should do separately.
Also, in my opinion, the multi-cluster support shouldn't be claimed as "complete" if secondary clusters have less functionality than the main one. WDYT?
Do you mean in that initially it won't be possible to add a namespaced app repository to an additional cluster? If so, as above, if not - let me know :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Global app repos are global for the Kubeapps installation in the current design. If I switched to browse a different Kubeapps installed on a different cluster (which happened to also support a union of clusters as the first installation), it may have a different set of global app repos. But I don't plan for a single Kubeapps instalation to have different global app repos depending on the cluster - there is one Kubeapps installation (with a set of global app repos) which supports multiple clusters. Let's chat about this tonight?
I think that's a valid use case that we should take into account (even if we don't implement it for the moment). As administrator, I may want to enable certain repositories for everyone with access to one cluster and other repos for a second cluster (in a dev vs prod environment for example).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely - I just mean that I would do that as part of the one Kubeapps installation - enabling the configuration of different repos on different clusters as part of the one instance of Kubeapps' configuration.
@@ -117,7 +117,7 @@ class Header extends React.Component<IHeaderProps, IHeaderState> { | |||
<ul className="header__nav__menu" role="menubar"> | |||
{this.links.map(link => ( | |||
<li key={link.to}> | |||
<HeaderLink {...link} currentNamespace={namespace.current} /> | |||
<HeaderLink {...link} currentCluster={namespace.cluster} currentNamespace={namespace.current} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably want to store the cluster
in a different object. namespace.cluster
is a bit confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - I thought the same, and then realised that the current namespace
object has everything we want for a cluster: .current(Namespace)
, .(available)namespaces
, so I was thinking of renaming the namespace
object (in a separate PR) to cluster
, so we'd then have:
cluster: {
name: default
currentNamespace: "foo",
namespaces: [...],
}
Switching clusters would cause the info to be reloaded in this case (which may be useful, as mentioned in the design doc, see strike-through text in 3. UX integration). The other option would be to retain data for each cluster with:
clusters: {
"default": {
currentNamespace: "foo",
namespaces: [...],
},
},
But with this option, the state is retained (though we can choose to refresh it when the cluster changes, I guess?). We could also pre-create this map in the state during initialization based on the config and use it to populate the dropdown. Thinking about it, I like this option better. Either way, I'm keen to do the state change as a separate, focused PR if that's OK with you (hence just adding the .cluster
to the current namespace object).
What's your preference or thoughts with the above two options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for the explanation. I'd go with the second too so we can populate the selectors and show everything. I am not worried about refreshing this data since it's just a matter of refreshing the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, I started that yesterday, should have it done today.
let link = currentNamespace ? `/ns/${currentNamespace}/${to}` : to; | ||
link = clustered ? `/c/${currentCluster}${link}` : link; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move all the links to shared/url
so we have a single place with all the links. We can have a section header
there with these links.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move all the links to
shared/url
so we have a single place with all the links.
+1, I did that for the apps.list
url, I'll do the same for header. That also simplifies the HeaderLink
(seems to be some unused code there). II really wanted to just delete the Service Instances menu, but updated to keep including it for now.
We can have a section
header
there with these links.
We don't really need that, eg. the application links are just app.apps.list
, so it may make more sense to just have them under app.
? I've done that for app.catalog
which was the only new link - see what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's fine, thanks
@@ -101,7 +102,7 @@ class Routes extends React.Component<IRoutesProps> { | |||
} | |||
private rootNamespacedRedirect = () => { | |||
if (this.props.namespace && this.props.authenticated) { | |||
return <Redirect to={`/ns/${this.props.namespace}/apps`} />; | |||
return <Redirect to={`/c/${this.props.cluster}/ns/${this.props.namespace}/apps`} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this link should be obtained from shared/url
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, my last-minute grep missed this one.
ffaf5dc
to
41ffa6b
Compare
First of several PRs which will transition existing routes in the UI to be cluster-aware, defaulting to the "default" cluster so as to not break the existing experience.
a151ba9
to
d5e89e6
Compare
Updated :)
Huh - so I've been using vscode for the past month or so (since getting a beefier local computer), and the Javascript/Typescript plugin (from Microsoft) is actually built-in (you can install a plugin for the nightly build, but I assume you're not doing that). It does highlight any lint errors (but they don't stand out to my slightly colour-blind eyes), but it was not automatically ordering imports. So I needed the following config (and installing the tslint extension from MS):
though I don't see it fixing any lint on save yet (I'll look at this later). Thanks :) |
LGTM but there are a couple of comments/questions that you forgot to reply.
Maybe those two options are conflicting. I have just the tslint option enabled globally (not per language) and it works for me:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - I meant to add a review with all the comments I had pending, but turns out I just replied to your main comment and left the comments pending :/ You should see them now.
to: "apps", | ||
}, | ||
{ | ||
children: "Catalog", | ||
namespaced: true, | ||
clustered: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two reasons: 1) I've not yet updated the routes and related components etc: part of the reason for replacing namespaced
(which was no longer used as all were transitioned) with clustered
is so I can land code in reviewable chunks, but also 2) I'm not yet certain we'll want to make the catalog URI clustered, in that we won't (at least initially) be supporting per-namespace repos/catalogs on additional clusters and so the only catalog a user should see when viewing for an additional cluster is the global catalog. I may later move this to specifically use the default
cluster with _all
namespaces.
Does that make sense? EDIT: all that said, it no longer exists after updating to use url.app.catalog()
as per below.
@@ -117,7 +117,7 @@ class Header extends React.Component<IHeaderProps, IHeaderState> { | |||
<ul className="header__nav__menu" role="menubar"> | |||
{this.links.map(link => ( | |||
<li key={link.to}> | |||
<HeaderLink {...link} currentNamespace={namespace.current} /> | |||
<HeaderLink {...link} currentCluster={namespace.cluster} currentNamespace={namespace.current} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - I thought the same, and then realised that the current namespace
object has everything we want for a cluster: .current(Namespace)
, .(available)namespaces
, so I was thinking of renaming the namespace
object (in a separate PR) to cluster
, so we'd then have:
cluster: {
name: default
currentNamespace: "foo",
namespaces: [...],
}
Switching clusters would cause the info to be reloaded in this case (which may be useful, as mentioned in the design doc, see strike-through text in 3. UX integration). The other option would be to retain data for each cluster with:
clusters: {
"default": {
currentNamespace: "foo",
namespaces: [...],
},
},
But with this option, the state is retained (though we can choose to refresh it when the cluster changes, I guess?). We could also pre-create this map in the state during initialization based on the config and use it to populate the dropdown. Thinking about it, I like this option better. Either way, I'm keen to do the state change as a separate, focused PR if that's OK with you (hence just adding the .cluster
to the current namespace object).
What's your preference or thoughts with the above two options?
let link = currentNamespace ? `/ns/${currentNamespace}/${to}` : to; | ||
link = clustered ? `/c/${currentCluster}${link}` : link; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move all the links to
shared/url
so we have a single place with all the links.
+1, I did that for the apps.list
url, I'll do the same for header. That also simplifies the HeaderLink
(seems to be some unused code there). II really wanted to just delete the Service Instances menu, but updated to keep including it for now.
We can have a section
header
there with these links.
We don't really need that, eg. the application links are just app.apps.list
, so it may make more sense to just have them under app.
? I've done that for app.catalog
which was the only new link - see what you think.
@@ -101,7 +102,7 @@ class Routes extends React.Component<IRoutesProps> { | |||
} | |||
private rootNamespacedRedirect = () => { | |||
if (this.props.namespace && this.props.authenticated) { | |||
return <Redirect to={`/ns/${this.props.namespace}/apps`} />; | |||
return <Redirect to={`/c/${this.props.cluster}/ns/${this.props.namespace}/apps`} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, my last-minute grep missed this one.
@andresmgot Thanks for the +1, I'll land but am still keen for your input on the state, in particular, before I refactor that (though we can do that on the separate PR, I guess - I'll move ahead as suggested above). |
First of several PRs which will transition existing relevant routes in the UI to
be cluster-aware, defaulting to the "default" cluster so as to not break
the existing experience.
Ref: #1762