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

Add GetPackageRepositories implementation for carvel and helm-fluxv2 #2840

Merged
merged 5 commits into from
May 21, 2021

Conversation

absoludity
Copy link
Contributor

@absoludity absoludity commented May 20, 2021

Description of the change

This was just to rename the helm_operator plugin to helm_fluxv2, but while there, I've added a demo implementation for the GetPackageRepositories method for both.

From the updated README, with the appropriate resources on your cluster you can now:

$ curl -s http://localhost:8080/plugins/helm_fluxv2/packages/v1alpha1/packagerepositories | jq .
{
  "repositories": [
    {
      "name": "bitnami",
      "namespace": "flux-system",
      "url": "https://charts.bitnami.com/bitnami"
    }
  ]
}

$ curl -s http://localhost:8080/plugins/kapp_controller/packages/v1alpha1/packagerepositories | jq .
{
  "repositories": [
    {
      "name": "repo-name.example.com",
      "namespace": "",
      "url": "foo.registry.example.com/repo-name/main@sha256:cecd9b51b1f29a773a5228fe04faec121c9fbd2969de55b0c3804269a1d57aa5"
    }
  ]
}

Benefits

Provides an example of an API call implemented by two plugins (needed for #2775). Renames helm flux plugin more appropriately (@gfichtenholt found helm_operator is from a pre fluxv2 version). Provides an example so @gfichtenholt can think about GetAvailablePackages for helm-fluxv2 (though as I mentioned on slack, this may be more work than we'd thought, depending whether fluxv2 actually exposes something analogous - afaict so far, it only creates a HelmChart object when a user installs from a repo, happy to jump in there to help as needed).

Possible drawbacks

N/A

Applicable issues

Additional information

Next up for me:

  • Start using this to help with the design of the API requests across plugins
  • investigating the fake dynamic client so we can write useful unit tests
  • potentially try a generic API call above the plugins, such as /core/packages/v1alpha1/GetPackageRepositories to show how we could return objects across plugins (chatted with @migmartri about this).
    But I'll discuss the above as part of our iteration planning next week.

@@ -18,7 +18,7 @@ import (
"google.golang.org/grpc"

"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
v1alpha1 "github.com/kubeapps/kubeapps/cmd/kubeapps-apis/gen/plugins/helm_operator/packages/v1alpha1"
v1alpha1 "github.com/kubeapps/kubeapps/cmd/kubeapps-apis/gen/plugins/helm_fluxv2/packages/v1alpha1"
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably just go with fluxv2, i.e. drop "helm". Based on their docs Flux supports more than just helm, they also support Git repositories with artifacts, as well as Amazon-style buckets with artifacts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, I was thinking that we're only interested in the helm support, but we may want to support any repositories/packages. Note that we'd need to then include something like a resource type field (group/version/name) so if we're returning results including both HelmRepositories and GitRepositories (?), they can be recognised as such (I'll just rename in this PR). Let me do the rename...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. :)

IMAGE_TAG=dev1 make kubeapps/kubeapps-apis
```

and make that imageg available on your cluster somehow. If using kind, you can simply do:
Copy link
Contributor

Choose a reason for hiding this comment

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

spelling and/or wording?

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.

I viewed and I am ok with the changes. I don't have enough expertise on grpc and protobuf to be able to comment constructively at this point, but I will get there someday :-)

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.

sorry missed one question. In earlier version of the PR, I saw a change you made in deploy-dev.mk to deploy kapp-controller to a cluster. I don't see that anymore in this list of files, nor do I see a target to deploy flux v2 Is that deliberate?

Base automatically changed from add-kubeapps-apis-service-5 to master May 21, 2021 01:34
@absoludity absoludity force-pushed the add-kubeapps-apis-service-6 branch from 4edf1f8 to bf9a383 Compare May 21, 2021 01:56
@absoludity
Copy link
Contributor Author

sorry missed one question. In earlier version of the PR, I saw a change you made in deploy-dev.mk to deploy kapp-controller to a cluster. I don't see that anymore in this list of files, nor do I see a target to deploy flux v2 Is that deliberate?

That was in the previous PR, let me add a similar one with the flux command I used to install the flux CRDs etc., as it's also useful as documentation of what version etc. was being used.

@absoludity absoludity merged commit d17d8fd into master May 21, 2021
@absoludity absoludity deleted the add-kubeapps-apis-service-6 branch May 21, 2021 03:40
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.

Implement kapp-controller/flux Kubeapps APIs for GetAvailablePackages
2 participants