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 experimental helmChart support to kustomize.Directory #2471

Merged
merged 6 commits into from
Jun 29, 2023

Conversation

jturolla
Copy link
Contributor

@jturolla jturolla commented Jun 26, 2023

Proposed changes

Pulumi's kustomize module doesn't enable the Helm plugin by default. Enabling the Helm plugin allows Helm Charts to be expanded by a kustomization.yaml file. I'm unaware of the tradeoffs by enabling this features, as it looks like it has no backwards compatibility issues, as it's just enabling an extra feature.

This PR enables the helm plugin using the statically linked mode, it's not super clear though if that's the helm enabling API, as it seems undocumented, but the impl of the EnabledPluginConfig being used is as follows:

func EnabledPluginConfig(b BuiltinPluginLoadingOptions) (pc *PluginConfig) {
	pc = MakePluginConfig(PluginRestrictionsNone, b)
	pc.FnpLoadingOptions.EnableStar = true
	pc.HelmConfig.Enabled = true
	// If this command is not on PATH, tests needing it should skip.
	pc.HelmConfig.Command = "helmV3"
	return
}

Which seems to be related to helm.

Related issues (optional)

#2470

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.
Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

@jturolla jturolla changed the title Enable helm on pulumi kustomize Enable Helm plugin on pulumi kustomize using krusty Jun 28, 2023
@jturolla jturolla changed the title Enable Helm plugin on pulumi kustomize using krusty Enable Helm plugin on pulumi-kustomize using krusty Jun 28, 2023
@lblackstone
Copy link
Member

Thanks for the PR @jturolla. I'm not familiar with this feature, so I'll need some more information. Do you have an example of a Kustomization that doesn't currently work with pulumi-kubernetes? We should add that to the existing Kustomize test to verify that this change fixes the issue:
test code
test assertions

@jturolla
Copy link
Contributor Author

jturolla commented Jun 29, 2023

Update:

The changed worked partially, the plugin seems enabled but it's not finding the helm installation. We're now facing the following error:

unable to run: 'helmV3 version -c --short' with env=[HELM_CONFIG_HOME=/var/folders/73/swctnd_95db_8lh18984l9yh0000gn/T/kustomize-helm-2718508415/helm HELM_CACHE_HOME=/var/folders/73/swctnd_95db_8lh18984l9yh0000gn/T/kustomize-helm-2718508415/helm/.cache HELM_DATA_HOME=/var/folders/73/swctnd_95db_8lh18984l9yh0000gn/T/kustomize-helm-2718508415/helm/.data] 
(is 'helmV3' installed?)

I tried creating an alias helmV3=helm but it also failed.

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.
Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

@jturolla
Copy link
Contributor Author

jturolla commented Jun 29, 2023

After the last commit it works on my machine, helm got inflated correctly and I can see all the resources in the pulumi preview.

I'm on macOS M1, helm was installed using brew. We should check how this dependency is used and how do you expect to distribute it.

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.
Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

@lblackstone
Copy link
Member

/run-acceptance-tests

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.
Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

@pulumi-bot
Copy link
Contributor

@joseronierison
Copy link

Thanks for the PR @jturolla. I'm not familiar with this feature, so I'll need some more information. Do you have an example of a Kustomization that doesn't currently work with pulumi-kubernetes? We should add that to the existing Kustomize test to verify that this change fixes the issue: test code test assertions

As a example, this chuck of code uses helm chart with kustomize:

kind: Kustomization
namespace: kube-system

helmCharts:
- name: external-secrets
  releaseName: external-secrets
  repo: https://charts.external-secrets.io/

and then it is called in a pulumi code like this:

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {

		_, err := kustomize.NewDirectory(ctx, "<name>",
			kustomize.DirectoryArgs{
				Directory: pulumi.String("../<folder>/<folder-with-kustomize-yml>"),
			},
		)
		if err != nil {
			return err
		}

		return nil
	})
}

Let me know if the above example helps.

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.
Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

@lblackstone
Copy link
Member

/run-acceptance-tests

@pulumi-bot
Copy link
Contributor

Copy link
Contributor

@rquitales rquitales left a comment

Choose a reason for hiding this comment

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

LGTM

@lblackstone lblackstone merged commit 34fd609 into pulumi:master Jun 29, 2023
8 of 10 checks passed
@lblackstone lblackstone changed the title Enable Helm plugin on pulumi-kustomize using krusty Add experimental helmChart support to kustomize.Directory Jun 29, 2023
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.

None yet

6 participants