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

Implement a CLI plugin for helm #32174

Closed
iocanel opened this issue Mar 28, 2023 · 14 comments
Closed

Implement a CLI plugin for helm #32174

iocanel opened this issue Mar 28, 2023 · 14 comments
Assignees
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) area/kubernetes kind/enhancement New feature or request

Comments

@iocanel
Copy link
Contributor

iocanel commented Mar 28, 2023

Description

Currently, when using quarkus with helm, the user need to use the helm cli in order to install, uninstall and update the chart.
These commands do require some arguments that are boilerplate.

For example:

helm install helm-example ./target/helm/kubernetes/<chart name>

It would be great if we had a very simple cli plugin that could pickup the boilerplating values from the project. So, that the user would just need to write:

quarkus helm install

Implementation ideas

AFAIK Helm v3 is working purely on client side (there is no server side). This means that we pretty much have to reuse the helm binary, as I don't think there is a java library that we can use for installing the chart itself.

The CLI itself could be a picocli moudle under the helm extension, and we could declarate that the extension brings in a cli plugin using something like: https://github.com/quarkiverse/quarkus-authzed-client/blob/main/runtime/src/main/resources/META-INF/quarkus-extension.yaml#L12

@iocanel iocanel added the kind/enhancement New feature or request label Mar 28, 2023
@quarkus-bot quarkus-bot bot added area/cli Related to quarkus cli (not maven/gradle/etc.) area/kubernetes labels Mar 28, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 28, 2023

/cc @Sgitario (kubernetes), @ebullient (cli), @geoand (kubernetes), @maxandersen (cli)

@bulldog98
Copy link
Contributor

There is already a community driven extension for helm (https://github.com/quarkiverse/quarkus-helm).

@maxandersen
Copy link
Contributor

The extension generates helm. The cli here is to be able to invoke/install the helm binary to use the output of the extension.

That's at least how I understand @iocanel s description

@iocanel iocanel changed the title Implement a CLI extension for helm Implement a CLI plugin for helm Mar 30, 2023
@cmoulliard
Copy link

Not sure that it could help as the project has been created 6 years ago around Helm2, is using Fabric8 Java client: see microbean-helm - https://stackoverflow.com/questions/40783681/kubernetes-helm-java-api

@iocanel

@iocanel
Copy link
Contributor Author

iocanel commented Mar 30, 2023

Not sure that it could help as the project has been created 6 years ago around Helm2, is using Fabric8 Java client: see microbean-helm - https://stackoverflow.com/questions/40783681/kubernetes-helm-java-api

@iocanel

I am afraid that this doesn't help. In helm v2 most of the job was done server side and therefore it was possible to just create a client the sends the charts to the server. In helm v3 all the work is done in the client side. This means that we need to use the client or rewrite the thing in java.

@cmoulliard
Copy link

I am afraid that this doesn't help. In helm v2 most of the job was done server side

I fully agree. If we use then the helm binary, how will it be possible to configure the quarkus client to figure out the path to be used to access the binary ? How will it be possible to know how the helm install command and their parameters will be mapped to quarkus helm install or quarkus helm uninstall.

@iocanel
Copy link
Contributor Author

iocanel commented Mar 31, 2023

All the information we need can be easily be obtained from the project.
All we need to do is get the info and pass it to helm install.

@ebullient
Copy link
Contributor

so this extension is just to help wrap invocation of helm with standard parameters?

@cmoulliard
Copy link

so this extension is just to help wrap invocation of helm with standard parameters?

Yes.

We should, of course, review which helm commands we will invoke but for the standard one helm install, the quarkus extensions (kubernetes, openshift and helm) will help us to populate this command

helm install \
  fruits-app // maven name or quarkus.kubernetes.name
  halkyonio/fruits-app // helm chart (= what it has been generated locally) \
  -n (optional) // quarkus.kubernetes.namespace=mynamespace
  --set app.image=quay.io/halkyonio/atomic-fruits:latest \ // helm value generated by quarkus helm
  --set app.host=atomic.127.0.0.1.nip.io \ // helm value generated by quarkus helm
  --set db.auth.database=atomic-fruits \ // helm value generated by quarkus helm
  --set db.auth.password=Secr3t \ // helm value generated by quarkus helm
  --set db.auth.username=admin // helm value generated by quarkus helm

Remark: As the quarkus helm extension supports also to include helm dependencies, then it will also be possible when we execute the quarkus helm install to deploy them too

@iocanel iocanel added good first issue Good for newcomers and removed good first issue Good for newcomers labels Apr 13, 2023
@iocanel
Copy link
Contributor Author

iocanel commented Apr 13, 2023

This might not be as trivial as I initially thought as it most probably requires: #32567

@ebullient
Copy link
Contributor

Thanks. My suggestion, just by the bye, is that we always print out the helm command we're invoking (once parameters have been determined), to make the magic understandable.

@iocanel
Copy link
Contributor Author

iocanel commented May 26, 2023

Added to quarkus-helm.

@iocanel iocanel closed this as completed May 26, 2023
@iocanel iocanel self-assigned this May 26, 2023
@cmoulliard
Copy link

Can you share the commit/PR where code and/or documented has been pushed please ? @iocanel

@iocanel
Copy link
Contributor Author

iocanel commented May 30, 2023

@cmoulliard here you are: quarkiverse/quarkus-helm#249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) area/kubernetes kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants