zarf-dev / zarf

DevSecOps for Air Gap & Limited-Connection Systems. https://zarf.dev/
Apache License 2.0
1.33k stars 162 forks source link

Refactor `charts` definition in `zarf.yaml` #2245

Open Racer159 opened 7 months ago

Racer159 commented 7 months ago

Describe what should be investigated or refactored

It would be worth taking some time to refactor the charts definition in the zarf.yaml to enhance user understanding of the keys such as repoName and gitPath which are usually non-intuitive for users. repoName really means the name of a chart in a Helm Repo and gitPath means the path of a chart in a git repository which are not obvious to folks not familiar with Zarf.

Links to any relevant code

https://github.com/defenseunicorns/zarf/blob/f039affe91b664f601b274a5e66d29bf030ca75f/src/types/component.go#L92

Additional context

These fields have come up with questions a few times in user questions in our k8s slack.

AustinAbro321 commented 2 months ago

propose a schema that looks like below. This is based on the examples/helm-charts within the Zarf repository. Non changed fields were taken out for brevity. Exactly one of the following field will exist for each components.charts.

- name: podinfo-repo-new
  helm:
    url: https://stefanprodan.github.io/podinfo
    name: podinfo # replaces repoName since it's only applicable in this situation

- name: podinfo-git-new
  git:
    url: https://stefanprodan.github.io/podinfo
    path: charts/podinfo

- name: podinfo-oci-new
  oci:
    url: oci://ghcr.io/stefanprodan/charts/podinfo

- name: podinfo-local-same
  local:
   path: chart
AustinAbro321 commented 6 days ago

It should be noted that in the current Zarf schema the version flag is used for both OCI charts and git charts. IMO it will be best if we leave these flags off of the git and oci sub objects and only provide users one way to add this information. Care would have to be taken in that case to ensure we don't break alpha packages when translating them.

https://github.com/zarf-dev/zarf/blob/10bf7465c4b0fc0b0477bb55f5189cd2b85d0d01/src/internal/packager/helm/repo.go#L44-L53

https://github.com/zarf-dev/zarf/blob/10bf7465c4b0fc0b0477bb55f5189cd2b85d0d01/src/internal/packager/helm/repo.go#L156-L163