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

Helm support: long term plan #4401

Open
natasha41575 opened this issue Jan 19, 2022 · 34 comments
Open

Helm support: long term plan #4401

natasha41575 opened this issue Jan 19, 2022 · 34 comments
Labels
area/helm kind/deprecation Categorizes issue or PR as related to a feature/enhancement marked for deprecation. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@natasha41575
Copy link
Contributor

natasha41575 commented Jan 19, 2022

There are many open helm-related issues in kustomize: https://github.com/kubernetes-sigs/kustomize/issues?q=is%3Aissue+is%3Aopen++label%3Aarea%2Fhelm+

Many of these issues are requesting new options in the helm chart generator configuration that will become flags to helm template. Other issues are related to problems with the --enable-helm flag and wanting more flexibility in how to enable helm.

For some context, there are limited options in the plugin configuration and the --enable-helm flag exists because of a past security issue that has since been addressed. However, it is clear that the helm chart generator built into kustomize has limitations and we need a plan for long term support.

What we would like to do is introduce a new function in the new krm-functions-registry that can inflate a helm chart. This new function will be treated as a third party extension by kustomize so it will not need any special treatment. Additionally, because it will be a containerized function, there will be fewer security problems to worry about.

Once this function is ready, we can start recommending it to users and deprecate the existing helm-related fields in kustomize.

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 19, 2022
@natasha41575
Copy link
Contributor Author

/triage accepted
/kind deprecation

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. kind/deprecation Categorizes issue or PR as related to a feature/enhancement marked for deprecation. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Jan 19, 2022
@natasha41575
Copy link
Contributor Author

/label area/helm

@k8s-ci-robot
Copy link
Contributor

@natasha41575: The label(s) /label area/helm cannot be applied. These labels are supported: api-review, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, team/katacoda, refactor

In response to this:

/label area/helm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@james-callahan
Copy link
Contributor

FWIW we don't consider krm functions usable in most of the environments we use kustomize.

On the other hand, I think the deprecation would help if the plugin is not going to get further support in kustomize itself. It might be worth directing people to https://github.com/mgoltzsche/khelm

@natasha41575
Copy link
Contributor Author

Would you mind providing some more feedback for why krm functions are not usable for you? We would like to address friction points as we move toward more krm-function-oriented solutions and extensions.

@james-callahan
Copy link
Contributor

Would you mind providing some more feedback for why krm functions are not usable for you?

  • We require kustomize to be run on various end user devices that won't have docker installed (and/or aren't supported by docker)
  • We run kustomize from within CI pipelines that are unable to spawn a container
  • We run kustomize from within containers such as ArgoCD where they will not (and should not) have permissions to spawn a container

@khrisrichardson
Copy link
Contributor

It's also worth mentioning that flux2's kustomize-controller doesn't natively support KRM config functions by way of plugin enablement, nor does it include the helm binary in the container image, and thus the current options are to fork or pre-hydrate (which still sounds like it would be a challenge for @james-callahan until other runtimes are available for KRM config functions)

@snuggie12
Copy link

In #3536 I did get a special built version of podman working after renaming it to docker though would have preferred simply being able to name my runtime.

Our need matches what was previously stated since we use argocd; we did not want to install docker onto their repo-server. It would be a lot of work if the helm plugin was moved to a krm function and we'd likely stay on an older version or fork for quite some time.

Side note, in some prototyping we got around the whole --enable-helm by altering viper to accept it as an env var. Older versions of kustomize would ignore the env var and newer ones would process it correctly. I'm all in favor of getting rid of the flag if it is not needed but if that helps as a solution for any other flags I figured I'd mention it.

@KlavsKlavsen
Copy link

We are also looking to use this in argocd (as soon as kostumize gains OCI support - which was just released as stable with Helm 3.8.0) - so it would be bad, to limit it like this :(

@natasha41575
Copy link
Contributor Author

We are looking at ways to support alternatives to docker, including containerized alternatives as well as simple and safe ways to run exec KRM functions. The latter would run very similarly to the existing builtin plugin.

@natasha41575
Copy link
Contributor Author

Since I have been receiving several messages about this, I would like to reiterate again that we will be supporting the new KRM Helm function as executable, meaning that you would not need to run docker in order to use it. In terms of execution, this will be almost exactly the same as running the current builtin Helm plugin, except that the code lives elsewhere and is compiled separately.

@QuinnBast
Copy link

I noticed that the helm chart inflation has been moved to the kubernetes-sigs repository and now exists in both repositories. Which is the officially supported version, and how would I use kubernetes-sigs with kustomize?

@natasha41575
Copy link
Contributor Author

natasha41575 commented Mar 22, 2022

I noticed that the helm chart inflation has been moved to the kubernetes-sigs repository and now exists in both repositories. Which is the officially supported version, and how would I use kubernetes-sigs with kustomize?

@QuinnBast Could you elaborate by what you mean by kubernetes-sigs repository? kubernetes-sigs is the org, and has many repositories.

Edited to add: If you are referring to the code in the krm functions registry, it is not ready yet. We are still working on setting up the repo infrastructure.

@jmmclean
Copy link

jmmclean commented Sep 6, 2022

Its kind of a poor Developer Experience that the KRM repo is referenced for helm inflation, but no contributions have put on it for about 6 months - this is typically an indicator of a dying project in the open source world. Im specifically thinking of #4335 where contributions were made by the community, but disregarded for the below option (clearly not an active project)

https://github.com/kubernetes-sigs/krm-functions-registry

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 5, 2022
@KnVerey
Copy link
Contributor

KnVerey commented Dec 5, 2022

/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 5, 2022
@boldandbusted
Copy link

I have noticed that the lack of the possibility to pass extra-args to helm makes it impossible to properly use helm charts that check capabilities, e.g. cert-manager's in-built Prometheus ServiceMonitor creation, see https://github.com/cert-manager/cert-manager/blob/9887baac3357beb1ad949f9b62f25dc3eea27fb7/deploy/charts/cert-manager/templates/servicemonitor.yaml#L1

My thoughts on that:

  1. It makes sense for the upstream projects to check whether a resource is accepted by the target cluster, so the capability check is vital, especially when helm's --atomic flag is used (when helm is used directly, that is)
  2. Speaking of which: One cannot pass the --atomic flag, either.
  3. Imho, it does NOT make sense to implement the functionality and/or logic of helm's respective flags in kustomize -- that would couple the implementations tightly.
  4. The easiest solution would have to (re-)introduce extraArgs to the helmCharts members and pass them verbatim to the function call

As a downstream user, I'd like to be able to make use of Helm's --atomic flag. I searched for an Issue that covers adding that flag, but came up empty. With #4401 (comment), and no extra-args: key, there's now apparently no path towards adding support for Helm features like --atomic. Thanks in advance for any background info or links to deeper discussions! :)

@Jorricks
Copy link

Jorricks commented May 4, 2023

Is this still an active plan? I am seeing no activity in the mentioned repository, nor am I seeing any significant contributions in this repository to refactor the HELM setup.
IMO the HELM functionality works well, of course it has bugs, but all software does. Furthermore I think it's good to keep active contributions in this area until the entire refactor is complete.

Furthermore, I would like to extend upon the ideas of @mwmahlberg here.

  • I've come across another implementation that will allow you to specify the args in the kustomize command, which would be the preferred way for me. The command would become something like; kustomize build --enable-alpha-plugins --enable-helm --load-restrictor=LoadRestrictionsNone --helm-templated-args '--api-versions my-api-version' /path/to/deployment

But I see the main reason for me to upgrade has been merged recently(I was looking for --api-versions support); #4926

@james-callahan
Copy link
Contributor

As a downstream user, I'd like to be able to make use of Helm's --atomic flag

The --atomic flag doesn't make any sense in the context of kustomize.
Infact the usual way to apply kustomize is via kustomize build | kubectl apply -f - ==> the kustomize binary has no idea where it's output is going; whether it worked; or how to role it back.

@boldandbusted
Copy link

As a downstream user, I'd like to be able to make use of Helm's --atomic flag

The --atomic flag doesn't make any sense in the context of kustomize. Infact the usual way to apply kustomize is via kustomize build | kubectl apply -f - ==> the kustomize binary has no idea where it's output is going; whether it worked; or how to role it back.

Yep, I was an ignorant first-time Kustomize user when I posted that... and realize that using Kustomize as a way to apply Helm charts kind of removes a lot of the nice features of Helm as a K8s-equivalent of a OS package-manager.

@hawkesn
Copy link

hawkesn commented Jun 12, 2023

There is some movement on this PR: #5167
Very excited to see support for OCI!

@lindhe
Copy link

lindhe commented Jul 28, 2023

Is the plan to keep requiring the --enable-helm flag once this feature is complete, or can we get rid of it then?

@vladfr
Copy link

vladfr commented Aug 22, 2023

@KnVerey, @natasha41575 I've reached this page from the docs. It doesn't seem that this Long-term plan for Helm is actually happening, as it's been a year since anyone has contributed to the KRM repo. It does seem like problems with the --enable-helm option are being addressed.

Is it time to revisit the ideas outlined in this issue? Namely, there are PRs already done with support for private repos, OCI registry, and a few bugs. It would be great to reopen this.

Use-case: Cluster setup with ArgoCD

Helm in an Argo app can be a bit cumbersome to do with GitOps. There is a Chicken & Egg problem, where you need an App of Apps to initialize an Argo repo from Git, but Helm charts don't fit well with that. Argo UI also puts some limits in how it displays Helm charts too, with some nice advantages such as viewing values and overrides. But for the cluster admin use-case, it can get a bit cumbersome.

There is a case to be made that kustomize should be used instead. If we can nail support for Helm inflate within kustomize it would enable a nice use-case: Apply a chart and kustomizations in the same Argo app. This could be useful for cluster admins who want to consume org charts, or even public charts, and need to add or modify resources.

Examples:

  • install cert-manager and configure some ClusterIssuers
  • add Ingress resources for a Grafana chart

While this can be achieved in other ways, having kustomize apply these will enable a cleaner directory structure in the git repo, and enable the App-of-Apps pattern, which is a de-facto standard with ArgoCD and GitOps. (While I haven't fully tried it, the same can be said for Flux, although with Flux, the problem is smaller in scope because it doesn't extend to the UI)

@KlavsKlavsen
Copy link

KlavsKlavsen commented Aug 22, 2023

For our open source project ( https://github.com/Obmondo/k8id ) - we only use helm charts and the 2.6+ feature with having values files in diff. repo - and in the very few instances where we need more, we add templates to the "wrapper helm chart" - and we also have a "static yaml" application which files are in the same "sepeate config repo" - or we extend helm chart and do upstream PR.. But helm + kustomize would give an extra option, which is definely not bad, but AFAIK kostumize's biggest strength is more the ability to handle patching of resources.. and a helm chart would "bark" at that afterwards? (unless argocd does helm template and runs kostumize locally - so it knows the end state - and there will then not be a diff.. I assume thats hot it would work). I still prefer upstream patch - but its definetely a good flexibility to have, to patch "resut of helm charts" - instead of the helm chart itself if necessary.

So if you use Helm umbrella model (you have a parent helm chart of your own - that simply depends on upstream chart) - then you have an easy way to extend helm charts (not quite as flexible as kustomize) that works too. You can see in k8id project - under argocd-helm-charts folder for examples :)

@GreenCappuccino
Copy link

There is a case to be made that kustomize should be used instead. If we can nail support for Helm inflate within kustomize it would enable a nice use-case: Apply a chart and kustomizations in the same Argo app. This could be useful for cluster admins who want to consume org charts, or even public charts, and need to add or modify resources.

I actually do this, but instead of in the GitOps application, it's done at the pre-commit step. By computing the combined hash of all files in each directory to find which releases have changed, I can automatically generate the relevant Kustomize output, with inflated charts in a build.yaml file, onto which Kustomization patches/overlays can be applied onto. build.yaml is committed into version control.

It's not a very comprehensive solution, since it's in a single pre-commit python script, but I think that such a model has the potential to be compatible with both Argo and Flux, and also enable static-analysis based CI tooling, like for example to upgrade helm charts like Dependabot.

Here is how I manage my lab cluster (I'm planning to refactor the folder structure to support kustomize localize, but I haven't had the time): https://github.com/ShamrockTeam/kubernetes

@koba1t
Copy link
Member

koba1t commented Mar 6, 2024

Hi all. I'm currently the subproject lead of kustomize.
I feel we need to improve helm support in this project because I think many users use this function in view of some issues and PRs.

In the first step, I plan to import helm lib in kustomize because it currently functions by directly running the helm binary on the user's computer. Other functions and improvements are added after that are completed.

Current status: I'm waiting for this PR to be merged.
helm/helm#12725

EronWright added a commit to pulumi/pulumi-kubernetes that referenced this issue May 31, 2024
<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md)
    for Pulumi's contribution guidelines.

    Help us merge your changes more quickly by adding more details such
    as labels, milestones, and reviewers.-->

## Proposed changes

This PR implements the Kustomize `Directory` resource (v2) as a
multi-language component resource.

The `Directory` resource creates child resources based on a
kustomization directory. The input is a path to a directory containing
'kustomization.yaml', or a git repository URL with a path suffix and
other qualifiers.

### Related issues (optional)

<!--Refer to related PRs or issues: #1234, or 'Fixes #1234' or 'Closes
#1234'.
Or link to full URLs to issues or pull requests in other GitHub
repositories. -->

Closes #2786 

### API

|property|description|
|-|-| 
| `directory` | The directory or git URL containing the kustomization to
apply. |
| `namespace` | Overrides the default namespace. |
| `skipAwait` | Applies the skipAwait annotation. |
| `resourcePrefix` | Prefix for child resources, defaults to the
component name. |

### Feature: Remote Targets

This implementation supports remote kustomization targets as described
[here](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/remoteBuild.md).

Note: the v1 implementation also supports git references, but resolves
them using the Pulumi SDK
([`RetrieveGitFolder`](https://github.com/pulumi/pulumi/blob/v3.117.0/sdk/go/common/workspace/templates.go#L392))
rather than using Kustomize's own implementation.

### Feature: Enable Alpha Plugins

This implementation always enables Kustomize's plugin support, akin to
`kustomize build --enable-alpha-plugins`.

Plugins are drawn from `KUSTOMIZE_PLUGIN_HOME` (default:
`~/.config/kustomize/plugin/`). Note: the kustomize library doesn't
allow for easy customization of the plugin home.

### Feature: Unrestricted Loading

Kustomize has a strict and a relaxed mode with respect to path
references outside the kustomization base directory
(`--load-restrictor`, default is `strict`). The feature seems intended
to encourage portability, similarly to paths in Dockerfiles. This
implementation simply enables the relaxed mode.

### Feature: Enable Helm Charts

This implementation enables [Helm chart support in
Kustomize](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/helmcharts/),
which is an experimental feature of Directory v1 (see:
#2470). Note that
chart support in Kustomize is limited and evolving; see
kubernetes-sigs/kustomize#4401 for the
long-term support plan.

The `helm` binary is assumed to be on the path.

### Feature: Namespace Override

New to v2 is support for overriding the default namespace (default is
from provider configuration), as a convenience. Kustomize itself has a
similar facility (see:
[namespace](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/namespace/))
but it makes sense to support it natively.

### Feature: Resource Ordering

The Directory resource uses Pulumi's engine to install the resources
produced by kustomize. It automatically detects dependencies between
some resources. For example, it knows to install namespaces and Custom
Resource Definitions (CRDs) first.

Use the `config.kubernetes.io/depends-on` annotation to declare an
explicit resource dependency. See [blog
post](https://www.pulumi.com/blog/kubernetes-yaml-v2/#resource-ordering)
for more info.

### Limitation: Kubernetes-Style Transformations

The older v1 implementation provides the ability to transform the
Kubernetes objects produced by kustomize before being sent to the
server. That feature isn't available in Directory v2 at this time. You
may still use Pulumi's [transform
option](https://www.pulumi.com/docs/concepts/options/transformations/)
to modify the child resources.

### Tests

The PR includes unit tests covering the provider implementation code.

### Example

Here's an example of deploying a couple of kustomizations. The `local`
kustomization (see:
[helloWorld](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/helloWorld)
for details) shows how to use a variable to select a kustomization
overlay.

```yaml
name: issue-2786-yaml
runtime: yaml
description: |
  Demonstrates the Directory resource.
  Reference: https://github.com/kubernetes-sigs/kustomize/tree/master/examples/helloWorld
config:
  variant:
    type: string
    default: staging
outputs:
  name: ${local.resources}
resources:
  ns:
    type: kubernetes:core/v1:Namespace
  local:
    type: kubernetes:kustomize/v2:Directory
    properties:
      namespace: ${ns.metadata.name}
      directory: ./config/${variant}
      skipAwait: true
  remote:
    type: kubernetes:kustomize/v2:Directory
    properties:
      namespace: ${ns.metadata.name}
      directory: https://github.com/kubernetes-sigs/kustomize//examples/helloWorld/?ref=v3.3.1
      skipAwait: true
```
@Skaronator
Copy link

Just a heads-up: the Helm PR has been closed, and it looks like we might not see a solution to that issue in the near future. It might be best to explore solutions within Kustomize instead of relying on Helm.

I also gave it a shot myself with a Helm feature implementation. Even though I’m not a Golang expert, I didn’t get any feedback from the dev team. I even put together a Helm improvement proposal here but didn’t get a response. So, I wouldn’t expect any updates from the Helm side anytime soon.

@GreenCappuccino
Copy link

Note that Kustomize supports KRM fn generators like the kpt helm chart rendering generator: https://catalog.kpt.dev/render-helm-chart/v0.1/
So you can use any arbitrary generator as long as it's containerized.

@Skaronator
Copy link

While KRM does exist, I think it's a flawed approach. Unlike Helm plugins or kubectl plugins, KRMs depend on a container runtime, which is usually unavailable in CI pipelines or CD tools such as ArgoCD.

I understand that supporting Helm involves a lot of overhead, and I can see why Kustomize might not want to handle Helm-related issues. Personally, I think it would be ideal if Kustomize adopted a plugin approach similar to kubectl or Helm and outsourced all Helm-related functionality.

@QuinnBast
Copy link

It's pretty sad to see that this has been stalled for over 2 years, and that we STILL can't login to private helm registries despite that being a very basic and necessary functionality to use helm at all...

Additionally, the docs for Kustomize's helm chart inflator have been completely pulled and link to this github issue and the docs no longer explain the basic functionality that Kustomize currently supports through the helm inflation generator.

Edit: After browsing, I found the actual docs for the helm inflation generator but they are pretty buried, and the first result on google links to here which seems to indicate a lack of support for helm altogether...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/helm kind/deprecation Categorizes issue or PR as related to a feature/enhancement marked for deprecation. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests