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

[Regression] Allow package details to fetch from config.kubeappsCluster #4564

Closed
aanthonyrizzo opened this issue Apr 6, 2022 · 5 comments · Fixed by #5566
Closed

[Regression] Allow package details to fetch from config.kubeappsCluster #4564

aanthonyrizzo opened this issue Apr 6, 2022 · 5 comments · Fixed by #5566
Assignees
Labels
component/ui Issue related to kubeapps UI kind/bug An issue that reports a defect in an existing feature

Comments

@aanthonyrizzo
Copy link
Contributor

aanthonyrizzo commented Apr 6, 2022

Description:

The kubeapps dashboard no longer supports kubeappsCluster or kubeappsNamespace.

As of version 2.4.2 the kubeapps dashbord no longer respects the kubeappsCluster or kubeappsNamespace` configurations.
as of v2.4.2, dashboard components no longer read the config for the kubeappCluster:

const {
packages: { isFetching: packagesIsFetching, selected: selectedPackage },
apps,
} = useSelector((state: IStoreState) => state);

v2.4.1 does:

const {
apps,
config,
packages: { isFetching: packagesIsFetching, selected },
} = useSelector((state: IStoreState) => state);

Previously these values were taken into account when fetching the package details from the UI. This is no longer the case. GetAvailablePackageDetail will not use the kubeappsCluster value when fetching the details.

Related to #4563

Corresponding slack thread: https://kubernetes.slack.com/archives/C9D3TSUG4/p1649178273135249

Repro Instructions:

  1. Ensure that kubeappsCluster is not included in clusters in the configmap, this will make sure that the subsequet GetAvailablePackageDetail request will fail.
  2. Load kubeapps as normal and try to deply a helm chart
  3. Be greeted with: image
  4. Verify it's fetching GetAvailablePackageDetail with a value in the clusters[] and not the kubeappsCluster. Ex: +core GetAvailablePackageDetail (cluster="default", namespace="kubeapps")
@absoludity absoludity added the component/ui Issue related to kubeapps UI label Apr 6, 2022
@absoludity
Copy link
Contributor

Sorry @aanthonyrizzo , reading your issue description, and re-reading your comments in slack, I think I initially misunderstood the issue that you're seeing. Can you add some steps to reproduce to this issue? That'd help to clarify for me.

@aanthonyrizzo
Copy link
Contributor Author

Sorry @aanthonyrizzo , reading your issue description, and re-reading your comments in slack, I think I initially misunderstood the issue that you're seeing. Can you add some steps to reproduce to this issue? That'd help to clarify for me.

Updated and edited to better articulate the issue. LMK if there is a something wrong.

@absoludity
Copy link
Contributor

OK, so we were talking about the same problem (great), but I think the solution may be different since I don't think it involves the config. See what you think, but I believe the issue was introduced (by me) while getting flux deployments working at this point:

https://github.com/vmware-tanzu/kubeapps/blob/v2.4.4/dashboard/src/shared/url.ts#L20-L23

which was part of #3640 , where I've explicitly updated the dashboard to include the package cluster in the route (fine) and if it's not set, to default to the current cluster (default in your case). That change was done with the incorrect assumption that the only time an AvailablePackageReference will be received from the kubeapps apis backend with an empty cluster is if the plugin doesn't support multi-cluster. But that is false since it will also be empty if the cluster on which Kubeapps is installed is not one of the configured clusters for users to target.

The flux plugin has already been updated so that it always includes the kubeapps cluster in the response, so it should be as simple as removing the workaround in the dashboard above (I hope).

@aanthonyrizzo
Copy link
Contributor Author

@absoludity yeah that looks like the offending commit/PR. So in my case with the current routing the path would be:

/c/default/ns/namespace-name/packages/helm.packages/v1alpha1//kubeapps/coreweave%2Fargo-cd

and the // will break the routing sine '' is tje kubeapps cluster. Do we want to add the isGlobal logic back and revert the URL path? or we want to just handle '' as gloabl in the route as the packageCluster and keep the current routing? The route would look like:

/c/default/ns/namespace-name/packages/helm.packages/v1alpha1/global/kubeapps/coreweave%2Fargo-cd

@absoludity
Copy link
Contributor

@absoludity yeah that looks like the offending commit/PR. So in my case with the current routing the path would be:

/c/default/ns/namespace-name/packages/helm.packages/v1alpha1//kubeapps/coreweave%2Fargo-cd

and the // will break the routing sine '' is tje kubeapps cluster.

A couple of thoughts here:

  1. All plugins now always return the kubeapps cluster for an available package, so we can (and should) now assume that if "" is returned, it's specifically the case here that we're dealing with (ie. the plugin is unable to specify a cluster name since the cluster in context is specifically not named in the config)
  2. This situation only affects the Helm plugin, since flux doesn't (yet) try to support multi-cluster) and carvel has actual cluster resources for available packages (that need to be on the cluster where the package will be installed, in our usage).
  3. We could therefore make this more explicit by having the helm plugin return "-" as the cluster name in this case, so the URL would look like /c/default/ns/namespace-name/packages/helm.packages/v1alpha1/-/kubeapps/coreweave%2Fargo-cd
  4. This would (I think) ensure that the UI doesn't need to care at all - it's just a reference for the available package returned by the API.

Does that make sense?

Do we want to add the isGlobal logic back and revert the URL path?

Nope, not keen to re-introduce that.

or we want to just handle '' as gloabl in the route as the packageCluster and keep the current routing? The route would look like:

/c/default/ns/namespace-name/packages/helm.packages/v1alpha1/global/kubeapps/coreweave%2Fargo-cd

This would conflict if people (for reasons) configure a cluster called "global".

So I think we may be able to just update the helm plugin to return - for the cluster name when it needs to refer to the cluster on which Kubeapps is installed but that cluster is not named in the config. Sorry, rather than explaining exactly what I meant there, I've done a diff for discussion at #4591 . Let me know what you think.

@ppbaena ppbaena added the kind/bug An issue that reports a defect in an existing feature label Apr 21, 2022
castelblanque added a commit that referenced this issue Oct 26, 2022
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>

### Description of the change

Adapted version of the outdated PR #4591. After removing kubeops, there
has been a refactor of places changes by the old PR.
It fixes the scenario in which the cluster where Kubeapps is installed
is not part of the configured list of clusters.
For example:

```yaml
clusters:
  - name: second-cluster
    domain: ...
    apiServiceURL: ....
    certificateAuthorityData: ...
    serviceToken: eyJhbGciOiJS...
```

For doing so, it uses a token to reference the Kubeapps cluster: `-`.
Also empty string `''` is accepted as cluster reference, for allowing
payloads in which there is no cluster specified in context.

Therefore, if a cluster string is empty or `-`, backend logic assumes
that the Kubeapps cluster will be used.

### Benefits

User can work in a multicluster setups in which the Kubeapps cluster is
not part of the allowed clusters.

### Possible drawbacks

N/A

### Applicable issues

- fixes #4564

### Additional information

Manual tests have been done with Helm plugin (only one working in
multicluster so far).
CI E2E test will be done in #4563

Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
castelblanque added a commit that referenced this issue Nov 3, 2022
…ist (#5573)

### Description of the change

This PR adds an E2E test in CI to avoid regression on #5566 and hence to
avoid that #4564 happens again.

### Benefits

Kubeapps is usable even if Kubeapps cluster is not among the clusters
configured.

### Possible drawbacks

N/A

### Applicable issues

- fixes #4563

Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ui Issue related to kubeapps UI kind/bug An issue that reports a defect in an existing feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants