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

populate chart metadata with a repoURL [hip-0018] #11378

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sudermanjr
Copy link

@sudermanjr sudermanjr commented Sep 23, 2022

What this PR does / why we need it:
Implements https://github.com/helm/community/blob/main/hips/hip-0018.md

Fixes: #4256

Signed-off-by: Luke Reed luke@lreed.net
Signed-off-by: Andy Suderman andy@suderman.dev

Special notes for your reviewer:
rebased off of, and supersedes (with permission from original author): #10369

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Output when using OCI registry

 k get secret -n goldilocks sh.helm.release.v1.goldilocks.v1 -ojson |jq -r .data.release | base64 -D|base64 -D|gunzip|jq .chart.metadata
{
  "name": "goldilocks",
  "sources": [
    "https://github.com/FairwindsOps/goldilocks"
  ],
  "version": "5.1.0",
  "description": "A Helm chart for running Fairwinds Goldilocks. See https://github.com/FairwindsOps/goldilocks ",
  "keywords": [
    "goldilocks",
    "resources",
    "kubernetes"
  ],
  "maintainers": [
    {
      "name": "sudermanjr"
    },
    {
      "name": "lucasreed"
    }
  ],
  "icon": "https://raw.githubusercontent.com/FairwindsOps/charts/master/stable/goldilocks/icon.png",
  "apiVersion": "v2",
  "appVersion": "v4.1.0",
  "repoURL": "oci://us-docker.pkg.dev/fairwinds-ops/helm/goldilocks"
}

Output when installing from a locally pulled tarball or a path

▶ k get secret -n polaris2 sh.helm.release.v1.polaris2.v1 -ojson |jq -r .data.release | base64 -D|base64 -D|gunzip|jq .chart.metadata
{
  "name": "polaris",
  "version": "5.5.0",
  "description": "Validation of best practices in your Kubernetes clusters",
  "maintainers": [
    {
      "name": "rbren",
      "email": "robertb@fairwinds.com"
    }
  ],
  "icon": "https://raw.githubusercontent.com/FairwindsOps/polaris/master/pkg/dashboard/assets/favicon-32x32.png",
  "apiVersion": "v1",
  "appVersion": "7.0",
  "repoURL": "path"
}

Output when pulling from a standard helm repository

▶ k get secret -n polaris sh.helm.release.v1.polaris.v1 -ojson |jq -r .data.release | base64 -D|base64 -D|gunzip|jq .chart.metadata
{
  "name": "polaris",
  "version": "5.5.0",
  "description": "Validation of best practices in your Kubernetes clusters",
  "maintainers": [
    {
      "name": "rbren",
      "email": "robertb@fairwinds.com"
    }
  ],
  "icon": "https://raw.githubusercontent.com/FairwindsOps/polaris/master/pkg/dashboard/assets/favicon-32x32.png",
  "apiVersion": "v1",
  "appVersion": "7.0",
  "repoURL": "https://charts.fairwinds.com/stable"
}

@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 23, 2022
@sudermanjr sudermanjr marked this pull request as ready for review September 23, 2022 15:58
@lucasreed lucasreed mentioned this pull request Sep 23, 2022
3 tasks
@joejulian joejulian added this to the 3.11.0 milestone Dec 24, 2022
@mattfarina mattfarina modified the milestones: 3.11.0, 3.12.0 Jan 18, 2023
@joejulian joejulian modified the milestones: 3.12.0, 3.13.0 May 5, 2023
if client.ChartPathOptions.RepoURL != "" {
chartRequested.Metadata.RepoURL = client.ChartPathOptions.RepoURL
} else {
chartRequested.Metadata.RepoURL = "path"
Copy link
Contributor

Choose a reason for hiding this comment

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

If the chart did not originate from a repository, recommend omitting inserting path into the RepoURL field

Copy link
Author

Choose a reason for hiding this comment

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

This was discussed during the HIP process, and ultimately decided to use a placeholder string. I'm happy to do whatever here, but wanted to make sure I followed the original HIP - https://github.com/helm/community/blob/main/hips/hip-0018.md#specification

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd almost prefer the actual path. It's a good hint if I forgot where I installed from, maybe as a file:// url?

Copy link
Author

Choose a reason for hiding this comment

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

That could work, and I'm open to whatever y'all prefer as the maintainers. For most of the planned use-cases I have seen, the path for local charts is far less important than remote repository URLs. That being said, I can see the value of having the filepath as well.

Copy link

Choose a reason for hiding this comment

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

local path it's nice feature, because in big teams we can see who touched chart at last time :)

Copy link
Collaborator

@mattfarina mattfarina left a comment

Choose a reason for hiding this comment

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

@sudermanjr Thanks for the PR. In addition to what @sabre1041 asked for, could you possibly add some simple tests for this?

@sudermanjr sudermanjr force-pushed the populate_repourl_chart_meta branch from 7326cca to 0365071 Compare July 5, 2023 16:13
Signed-off-by: Luke Reed <luke@lreed.net>

support OCI registries as well

Signed-off-by: Luke Reed <luke@lreed.net>

revert changes to DownloadTo function and implement using the ChartDownloader object instead

Signed-off-by: Luke Reed <luke@lreed.net>

make sure update will still update repoURL

Signed-off-by: Luke Reed <luke@lreed.net>
Signed-off-by: Andy Suderman <andy@suderman.dev>

Set the repository URL to path if a URL is not found

Signed-off-by: Andy Suderman <andy@suderman.dev>

Fixes

Signed-off-by: Andy Suderman <andy@suderman.dev>
@sudermanjr sudermanjr force-pushed the populate_repourl_chart_meta branch from 0365071 to 799c1b6 Compare July 5, 2023 16:20
@sudermanjr
Copy link
Author

@mattfarina I addressed the other question, and I'm looking at adding some tests, but I'm struggling a bit with the right way to approach that.

The pkg/metadata changes are covered by existing tests. The tests in the cmd package seem to deal mostly with CLI output, and I don't see anything verifying chart metadata in the release. Chart_downloader seems to be a candidate for a simple test, but everything I come up with feels a bit contrived, and not valuable as an actual test.

Did you have any specific thoughts about the approach for these tests?

@sudermanjr sudermanjr changed the title populate chart metadata with a repoURL field populate chart metadata with a repoURL [hip-0018] Jul 12, 2023
@mattfarina mattfarina modified the milestones: 3.13.0, 3.14.0 Sep 25, 2023
@ksemele
Copy link

ksemele commented Oct 28, 2023

guys, here is needed some help or not? how we can accelerate that PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show Installed Chart Source Location or Source Repository URL
6 participants