Green-Software-Foundation / carbon-aware-sdk

Carbon-Aware SDK
https://carbon-aware-sdk.greensoftware.foundation/
MIT License
484 stars 99 forks source link

[Bug]: Unable to include Helm chart to build on top of it #545

Closed rwslinkman closed 4 months ago

rwslinkman commented 4 months ago

Contact Details

rw.slinkman@gmail.com

What happened?

While trying to include the Helm chart within this repository as a dependency, it became clear that the Helm chart can only be used through the command line (helm commands).

Including this chart into a chart of my own (in order to add environment-specifics) is not possible. Example:

apiVersion: v2
name: Apps related to Sustainable Software
version: 0.0.0
dependencies:
  - name: carbon-aware-sdk
    version: 1.2.0
    repository: https://github.com/Green-Software-Foundation/carbon-aware-sdk/tree/v1.4.0/helm-chart

The example above does not work, since the git repository is not a valid "Chart registry". This can be achieved by including an index.yaml file describing the registry's content. Another alternative is to push the Helm chart to Artifact Hub at the moment the release goes out.

I'm working together with @WBurggraaf on a solution and would love to see this SDK in action.

client

WebAPI (Default)

Relevant log output

N/A

Code of Conduct

WBurggraaf commented 4 months ago

We can't wait to start using this with our current customer.

tiwatsuka commented 4 months ago

The helm chart is published at GHCR as an OCI image. Could you try the following configuration?

dependencies:
  - name: carbon-aware-sdk
    version: 1.2.0
    repository: oci://ghcr.io/green-software-foundation/charts
rwslinkman commented 4 months ago

Thanks for looking into this @tiwatsuka I have tried your suggestion (executed with IntelliJ) which leads to the following:

helm repo add GreenSoftwareFoundation oci://ghcr.io/green-software-foundation/charts
Error: looks like "oci://ghcr.io/green-software-foundation/charts" is not a valid chart repository or cannot be reached: object required

The section object required makes me think authentication is required to access the chart repository. I could sign in, but the environment where I'm deploying this (using Argo CD) will not sign in.

tiwatsuka commented 4 months ago

@rwslinkman When you use OCI-based registries, you don't need to do repo add. You can install with the following command.

$ helm install carbon-aware-sdk oci://ghcr.io/green-software-foundation/charts/carbon-aware-sdk --version 1.2.0

You can also do dependencies build with the setting in my previous comment without any authentication like below.

$ helm dependencies build
Saving 1 charts
Downloading carbon-aware-sdk from repo oci://ghcr.io/green-software-foundation/charts
Pulled: ghcr.io/green-software-foundation/charts/carbon-aware-sdk:1.2.0
Digest: sha256:799b3d3d872a4f4830c7fea3793a020a908eb51058b3c328a8d36651ff8c97ec
Deleting outdated charts

cf. https://helm.sh/docs/topics/registries/

rwslinkman commented 4 months ago

Thanks. Using this repository in my Chart.yaml file was the solution:

apiVersion: v2
name: NDFF Sustainable Software
version: 0.0.0
dependencies:
  - name: carbon-aware-sdk
    version: 1.2.0
    repository: oci://ghcr.io/green-software-foundation/charts