https://prefect.io logo
c

Christian Nuss

03/28/2022, 5:37 PM
hey everyone! i'm trying to add the Prefect Server Helm chart as a dependency to an existing helm chart. If I want to prefix/rename EVERYTHING that is in the Prefect Server helm chart, is there an easy way to do that?
discourse 1
z

Zanie

03/28/2022, 5:48 PM
c

Christian Nuss

03/28/2022, 5:51 PM
i saw that, but it was a tid bit headscratching, with respect to
namePrefix
nameSuffix
too... in my top-level chart, should i set
nameOverride
or
namePrefix
or
nameSuffix
for each component?
z

Zanie

03/28/2022, 5:54 PM
Yeah šŸ˜„
So… the name for each object is created with
Copy code
{{- $name := print (.namePrefix | default "") ( .component ) (.nameSuffix | default "") -}}
{{ printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
Where the first chunk is the name of the helm release
And the second chunk is the ā€œnameā€ which has a prefix, component, and suffix
The prefix and suffix there are internal to the chart, although we could expose their default value in the values file if it’d be helpful.
It sounds like you want to change the first chunk though, which is just the release name
A Release is an instance of a chart running in a Kubernetes cluster. One chart can often be installed many times into the same cluster. And each time it is installed, a new release is created. Consider a MySQL chart. If you want two databases running in your cluster, you can install that chart twice. Each one will have its own release, which will in turn have its own release name.
c

Christian Nuss

03/28/2022, 6:02 PM
exactly, so my Chart.yml looks something like this:
Copy code
apiVersion: v2
name: my-app
type: application
version: 0.0.0
appVersion: "1.16.0"
...
dependencies:
  - name: postgresql
    version: "~9.3.2"
    repository: <https://charts.bitnami.com/bitnami>
    condition: postgresql.useSubChart
  - name: prefect-server
    version: "2022.01.25"
    repository: <https://prefecthq.github.io/server/>
so currently its colliding on the service account name and postgres (and we already have a component called ui as well) i think prefect's helm is trying to make
my-app-postgresql
which is already taken by
my-app
z

Zanie

03/28/2022, 6:23 PM
Hmmm
I think we might need to add something to the chart to make this possible
c

Christian Nuss

03/28/2022, 6:28 PM
i think this is the possible issue: https://github.com/PrefectHQ/server/blob/master/helm/prefect-server/templates/_helpers.tpl#L27 i believe the helper is taking
.Chart.Name
or which is in this case,
my-app
, and only allowing
.Values.nameOverride
as an alternative?
z

Zanie

03/28/2022, 6:29 PM
What happens if you provide a nameOverride to the server chart?
The name of the component uses the release name, not the chart name, so I don’t think nameOverride takes effect
c

Christian Nuss

03/28/2022, 6:31 PM
in my top level values.yaml, i've been playing with something like this...
Copy code
prefect-server:
  nameOverride: prefect-server
  useSubChart: false
  postgresql:
    nameOverride: prefect-server-postgresql
  serviceAccount:
    name: prefect-server
but that nested nameOverride seems to have no effect? (PSA I'm new to the way values.yaml are munged for subcharts)
z

Zanie

03/28/2022, 6:53 PM
Yeah only the top-level name override will do anything
And it’ll just override the chart name, not the component names
c

Christian Nuss

03/28/2022, 7:00 PM
ahh dang šŸ˜•
z

Zanie

03/28/2022, 7:02 PM
c

Christian Nuss

03/28/2022, 7:06 PM
that looks pretty good, wouldn't we want an option of somekind to conditionally do the new naming, for backwards compatibility?
z

Zanie

03/28/2022, 7:07 PM
Perhaps, I’m not actually sure how helm will behave on upgrade when names change
In theory, it’ll just replace the components with the newly named ones.
c

Christian Nuss

03/28/2022, 7:10 PM
i believe the service yamls use
nameField
as well, so in theory the generated DNS name would likely change, that might break anyone that's hardcoded the DNS name of apollo, for example
i'm wondering if just allowing
.namePrefix
or
.nameSuffix
to be provided in values would do the trick?
z

Zanie

03/28/2022, 7:12 PM
Ah yes, hm. I’m not really enthused about including a boolean. I’ll see what the rest of the team thinks.
Well… those are supposed to be internal for different uses of
nameField
like if somewhere in the chart we had two names for the same component and wanted to add a suffix to one
It’d have to be change to be global prefix/suffix values and I’d rather just fix the default names.
c

Christian Nuss

03/28/2022, 7:15 PM
gotcha, i understand! let me know what the rest of the team thinks!
FYI, i've worked around this by simply doing another chart install outside of my standard app install
z

Zanie

03/29/2022, 3:04 PM
I’ve added a toggle to the PR for backwards compatibility
c

Christian Nuss

03/29/2022, 3:41 PM
wonderful thanks!! does this land in the Helm Repo once its pushed to master?
z

Zanie

03/29/2022, 3:49 PM
No, I’ll cut a new server release today though
c

Christian Nuss

03/29/2022, 3:50 PM
šŸš€ you rock thanks!
18 Views