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

Support for OCI helm Repositories #1477

Closed
roitalpaz opened this issue Feb 23, 2021 · 7 comments · Fixed by #1892
Closed

Support for OCI helm Repositories #1477

roitalpaz opened this issue Feb 23, 2021 · 7 comments · Fixed by #1892
Assignees
Labels
area/helm customer/feedback Feedback from customers helm-release-ga-blockers Items blocking Helm Release GA kind/enhancement Improvements or new features resolution/fixed This issue was fixed size/M Estimated effort to complete (up to 5 days).
Milestone

Comments

@roitalpaz
Copy link

Problem description

pulumi does not support using Helm chart and OCI registries with the experimental OCI support.
According to https://helm.sh/docs/topics/registries/

AWS documented the above here:
https://docs.aws.amazon.com/AmazonECR/latest/userguide/push-oci-artifact.html

@lblackstone lblackstone added the kind/enhancement Improvements or new features label Feb 23, 2021
@roitalpaz
Copy link
Author

roitalpaz commented Feb 24, 2021

The current workaround, download Helm chart using AWS API.

import * as pulumi from "@pulumi/pulumi";
import {ECRClient, BatchGetImageCommand, GetDownloadUrlForLayerCommand} from "@aws-sdk/client-ecr";
import * as download from "download";

// Download and extract the `latest` helm chart into folder
export const downloadHelm = async (repoName: string, downloadDestination: string, region: string) => {
    const stampEcrClient = new ECRClient({
            region: region,
        }
    );

    const getImageCommand = new BatchGetImageCommand({
        repositoryName: repoName,
        imageIds: [{imageTag: "latest"}]
    })

    try {
        const getImagesResponse = await stampEcrClient.send(getImageCommand);
        await pulumi.log.debug(`Got ${getImagesResponse.$metadata}`)

        if (getImagesResponse.images && getImagesResponse.images.length > 0 && getImagesResponse.images[0].imageManifest) {
            if (getImagesResponse.images.length > 1) {
                await pulumi.log.error(`Got too many results. ${getImagesResponse.images.length}`)
                new pulumi.RunError(`Got too many results. ${getImagesResponse.images.length}`)
            }

            const imageManifest = JSON.parse(getImagesResponse.images[0].imageManifest)

            const getDownloadURL = new GetDownloadUrlForLayerCommand({
                repositoryName: repoName,
                layerDigest: imageManifest.layers[0].digest,
            })
            const downloadURLResponse = await stampEcrClient.send(getDownloadURL);
            if (downloadURLResponse.downloadUrl) {
                await download(downloadURLResponse.downloadUrl, downloadDestination, {extract: true});
            }

        } else {
            await pulumi.log.error(`Got no Images: ${JSON.stringify(getImagesResponse.failures)}.`)
            new pulumi.RunError("Error getting images")
        }
    } catch (error) {
        await pulumi.log.error(`Error occurred: ${JSON.stringify(error)}.`)
        new pulumi.RunError(error)
    }
}

@yuft
Copy link

yuft commented Jul 2, 2021

Does anyone have a workaround for Azure Container Registry?
https://docs.microsoft.com/en-us/azure/container-registry/container-registry-helm-repos

@lblackstone lblackstone added area/helm customer/feedback Feedback from customers labels Oct 12, 2021
@lblackstone
Copy link
Member

I think we should be able to support this in the new helm.Release resource. I haven't tested it yet, but it's possible that it would work just by setting the env var (HELM_EXPERIMENTAL_OCI=1) and running that resource. If not, it should be straightforward to plumb that option through.

FYI @viveklak

@viveklak viveklak added the helm-release-ga-blockers Items blocking Helm Release GA label Oct 20, 2021
@leezen leezen added the size/S Estimated effort to complete (1-2 days). label Oct 25, 2021
@infin8x infin8x added this to the 0.64 milestone Oct 26, 2021
@lblackstone lblackstone self-assigned this Nov 11, 2021
@lblackstone
Copy link
Member

I checked if setting the HELM_EXPERIMENTAL_OCI env var would work, and it doesn't appear so. It looks like we'll need to add a handler specifically for OCI repos in the client, and then create an input type to support the configuration in the SDK.

OCI support is still experimental and subject to breaking changes, but it's probably ok since we're pinning to a specific client version in the provider. The internal implementation shouldn't affect user programs as long as we can maintain the same API.

@mikhailshilkov mikhailshilkov modified the milestones: 0.64, 0.65 Nov 15, 2021
@mikhailshilkov mikhailshilkov added size/M Estimated effort to complete (up to 5 days). and removed size/S Estimated effort to complete (1-2 days). labels Nov 16, 2021
@mikhailshilkov mikhailshilkov modified the milestones: 0.65, 0.66 Dec 7, 2021
@lblackstone
Copy link
Member

lblackstone commented Dec 10, 2021

I ran into some problems trying to implement this because the required OCI client packages are still experimental:
helm/helm#9188
helm/helm#10393

It looks like the packages may be available to use externally sometime soon:
helm/helm#10447

Since the upstream work is ongoing, I don't think we should directly support this feature yet. We'll keep an eye on the upstream progress, and reevaluate if it looks like it's stalled.

In the meantime, I'd suggest working around by downloading the chart separately and then referencing the local chart path.

Edit: Here's my WIP code for this: #1835

@lblackstone lblackstone removed this from the 0.66 milestone Dec 10, 2021
@SharpEdgeMarshall
Copy link
Contributor

With helm 3.8.x now the OCI standard is out of beta so this issue should be reconsidered

@lblackstone lblackstone assigned viveklak and unassigned lblackstone Jan 28, 2022
@lblackstone
Copy link
Member

With helm 3.8.x now the OCI standard is out of beta so this issue should be reconsidered

Thanks for the heads up! We'll give this another look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/helm customer/feedback Feedback from customers helm-release-ga-blockers Items blocking Helm Release GA kind/enhancement Improvements or new features resolution/fixed This issue was fixed size/M Estimated effort to complete (up to 5 days).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants