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

Support multi-cluster with helm plugin #3282

Merged
merged 2 commits into from
Aug 19, 2021

Conversation

absoludity
Copy link
Contributor

@absoludity absoludity commented Aug 19, 2021

Description of the change

This PR updates the GRPC registration function for plugins so that it receives the clusters configuration. This enables plugins to make decisions based on the clusters configuration, which is required for the Helm plugin as it behaves slightly differently for the cluster on which Kubeapps is installed.
Even though the Helm plugin only requires the kubeapps cluster name, I've passed the complete config for generality... perhaps we should just pass the kubeapps cluster name for now (though that makes assumptions about other plugins later needs).

It then updates the Helm plugin so that:

  • Requests for packages available in a namespace of other clusters only ever returns the global available packages (ie. those from the kubeapps namespace on the kubeapps cluster), and
  • Requests for installed packages on a cluster (or namespace of a cluster) use the config for that cluster.

Example, after installing apache on the second cluster:

grpcurl -H "$auth_header" -plaintext -d '{"context": {"cluster": "second-cluster", "namespace": "default"}}' localhost:8080 kubeappsapis.plugins.helm.packages.v1alpha1.HelmPackagesService.GetInstalledPackageSummaries
{
  "installedPackageSummaries": [
    {
      "installedPackageRef": {
        "context": {
          "cluster": "second-cluster",
          "namespace": "default"
        },
        "identifier": "apache-second-cluster"
      },
      "name": "apache-second-cluster",
      "pkgVersionReference": {
        "version": "8.6.0"
      },
      "currentPkgVersion": "8.6.0",
      "currentAppVersion": "2.4.48",
      "iconUrl": "https://bitnami.com/assets/stacks/apache/img/apache-stack-220x234.png",
      "pkgDisplayName": "apache",
      "shortDescription": "Chart for Apache HTTP Server",
      "latestPkgVersion": "8.6.0",
      "status": {
        "ready": true,
        "reason": "STATUS_REASON_INSTALLED",
        "userReason": "deployed"
      }
    }
  ]
}

Benefits

We can continue to support the existing multicluster functionality when using the new API.

Possible drawbacks

Applicable issues

Additional information

Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Copy link
Contributor

@gfichtenholt gfichtenholt left a comment

Choose a reason for hiding this comment

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

Looked at everything except server_test, which looked had way too many changes to analyze properly I trust you on this one. If tests are passing +1 from me.

@absoludity
Copy link
Contributor Author

Looked at everything except server_test, which looked had way too many changes to analyze properly I trust you on this one. If tests are passing +1 from me.

Yep, tests are passing and the real-life test works as per the description. Thanks.

@absoludity absoludity merged commit 843e538 into vmware-tanzu:master Aug 19, 2021
@absoludity absoludity deleted the cluster-support-api-2 branch August 19, 2021 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[kubeapps-apis] Implement support for cluster in packaging API
2 participants