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

Initial support for Helm release resource #1677

Merged
merged 54 commits into from
Sep 3, 2021
Merged

Initial support for Helm release resource #1677

merged 54 commits into from
Sep 3, 2021

Conversation

viveklak
Copy link
Contributor

@viveklak viveklak commented Aug 12, 2021

This change adds a new resource - kubernetes:helm.sh/v3:Release. This resource directly utilizes Helm to orchestrate the installation of charts into releases. Users can query the release through Pulumi as well as Helm.

This is heavily inspired by https://github.com/hashicorp/terraform-provider-helm fashioned for Pulumi's kubernetes provider.

Here is an example of the experience so far:

const release = new k8s.helm.v3.Release("release", {
    chart: "redis",
    repositoryOpts: {
        repo: "https://charts.bitnami.com/bitnami",
    },
    version: "13.0.1",
    values: {
        cluster: {
            enabled: true,
            slaveCount: 2,
        },
        metrics: {
            enabled: true,
            service: {
                annotations: {
                    "prometheus.io/port": "9127",
                }
            },
        },
        global: {
            redis: {
                password: redisPassword,
            }
        },
        rbac: {
            create: true,
        }
    },
    timeout: 120,
});


const srv = k8s.core.v1.Service.get("redis-master-svc", pulumi.interpolate`${release.status.namespace}/${release.status.name}-redis-master`);
export const clusterIP = srv.spec.clusterIP;

With the default behavior (skipAwait = false) all resources must be available before the release becomes available and the subsequent get on the service works. Note that underlying resources are not in state (unlike helm chart support).

How to build/use

  1. Checkout branch
  2. make build
  3. export PATH=$PATH:$PWD/bin
  4. Use provided SDK.

Things to do:

  • Make await default
  • Golang SDK fixes (currently package name doesn't match the expected package)
  • Fix linting issues because of ^
  • Values should be hierarchical (existing chart semantics)
  • Add E2E tests (Need dotnet example)

The following are known follow-up items which have corresponding issues being tracked:

@viveklak viveklak changed the title Helm release support Helm release support [WIP] Aug 12, 2021
@viveklak viveklak marked this pull request as draft August 12, 2021 21:07
@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • kubernetes:helm.sh/v3:Release

@lblackstone
Copy link
Member

Passerby here awaiting this before deploying some helm charts that utilize hooks. Does anyone have an intuition about the timeframe for this to land? I'm trying to evaluate waiting or implementing a workaround. Thanks in advance! :)

We're expecting to have it available as a beta/dev preview resource soon. I'll say end of September conservatively, but likely sooner than that.

@joeduffy
Copy link
Member

I'll say end of September conservatively, but likely sooner than that.

Levi, my understanding is that this should be available by early September. Is that right? cc @lukehoban

@lblackstone
Copy link
Member

I'll say end of September conservatively, but likely sooner than that.

Levi, my understanding is that this should be available by early September. Is that right? cc @lukehoban

@joeduffy Yes, AFAIK. I need to confirm with Vivek, but I believe we're just about ready to ship initial support (minus the list of followup items in the description).

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • kubernetes:helm.sh/v3:Release

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • kubernetes:helm.sh/v3:Release

provider/pkg/gen/overlays.go Outdated Show resolved Hide resolved
provider/pkg/gen/overlays.go Outdated Show resolved Hide resolved
provider/pkg/gen/overlays.go Show resolved Hide resolved
@@ -70,6 +70,30 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec {
Description: "If present and set to true, suppress apiVersion deprecation warnings from the CLI.\n\nThis config can be specified in the following ways, using this precedence:\n1. This `suppressDeprecationWarnings` parameter.\n2. The `PULUMI_K8S_SUPPRESS_DEPRECATION_WARNINGS` environment variable.",
TypeSpec: pschema.TypeSpec{Type: "boolean"},
},
"suppressHelmReleaseBetaWarning": {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it would make sense to nest these helm-specific configs under a top-level config to avoid cluttering the docs + auto-complete suggestions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will play with this. I can follow up for this in a separate PR?

provider/pkg/provider/helm_release.go Outdated Show resolved Hide resolved
provider/pkg/provider/helm_release.go Outdated Show resolved Hide resolved
provider/pkg/provider/helm_release.go Outdated Show resolved Hide resolved
provider/pkg/provider/manifest_json.go Outdated Show resolved Hide resolved
if k.defaultNamespace != "" {
namespace = k.defaultNamespace
}
k.helmReleaseProvider, err = newHelmReleaseProvider(
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how much overhead this causes, but we might want to make this conditional on the program using a helm Release resource.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Though this should be fairly lightweight for the moment. Happy to revisit later.

if !k.clusterUnreachable {
return k.helmReleaseProvider.Check(ctx, req, !k.suppressHelmReleaseBetaWarning)
}
return nil, fmt.Errorf("can't use Helm Release with unreachable cluster. Reason: %q", k.clusterUnreachableReason)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should print some sort of placeholder value rather than erroring in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is desirable to render the manifests and resource names from the helm release but they would only render if I emitted them from Check (and not from Create/Update etc.). As a result Check is an "online"-only operation at the moment. I am happy to open an issue to revisit this. Perhaps we can mark those fields as computed instead when the cluster is unreachable.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it seems like we should be able to fall back to showing some minimal info rather than erroring. Two things to check here would be YAML render mode, which generally doesn't require an active cluster, and the case where the cluster hasn't been created yet, but is a parent in the stack via the Provider.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • kubernetes:helm.sh/v3:Release

@github-actions
Copy link

github-actions bot commented Sep 1, 2021

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • kubernetes:helm.sh/v3:Release

@github-actions
Copy link

github-actions bot commented Sep 1, 2021

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • kubernetes:helm.sh/v3:Release

Copy link
Member

@lblackstone lblackstone left a comment

Choose a reason for hiding this comment

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

I think this looks good as a starting point for the beta. 👍

@github-actions
Copy link

github-actions bot commented Sep 3, 2021

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • kubernetes:helm.sh/v3:Release

@github-actions
Copy link

github-actions bot commented Sep 3, 2021

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • kubernetes:helm.sh/v3:Release

@viveklak
Copy link
Contributor Author

viveklak commented Sep 3, 2021

  • The latest changes remove the inputs under ReleaseSpec and flatten them
  • Rename repositorySpec to repositoryOpts

@viveklak viveklak merged commit 876eaea into master Sep 3, 2021
@pulumi-bot pulumi-bot deleted the vl/HelmRelease branch September 3, 2021 05:35
@muhlba91
Copy link

muhlba91 commented Sep 3, 2021

hi, as this was blocking us to use pulumi for our helm releases and it got merged now for beta, how am i able to use and test this version? what version tag do i have to specify in my package.json and are there any other requirements i have to adjust in my NodeJS project? :)

@viveklak
Copy link
Contributor Author

viveklak commented Sep 3, 2021

@muhlba91 I am planning to cut a release today and will update this issue with directions. Thanks for your patience!

@viveklak
Copy link
Contributor Author

viveklak commented Sep 4, 2021

@muhlba91 I am planning to cut a release today and will update this issue with directions. Thanks for your patience!

This is now included in v3.7.0 release. We are still getting docs etc. ready but the resource is now available to play around with. Some known issues are tracked here.

@JoaRiski
Copy link

@viveklak does the current implementation support installing charts from local files like the Chart resource does? Haven't figured how that works

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

10 participants