feat(chart): chart-owned PVCs, HTTPRoute filters and extraManifests - #173
Conversation
cilindrox
left a comment
There was a problem hiding this comment.
Thanks @aaronspruit - left some comments. Would you consider opening separate PRs for the features so we can keep discussion focused?
There was a problem hiding this comment.
this seems redundant, given the extraManifests feature - I think having the option to use the configExistingClaim and adding these there should cover most use cases. Maybe we can include the PVC example under the extraManifests stanza in values.yaml ?
There was a problem hiding this comment.
yeah, after more thinking, I agree with you and put in the example.
| # name: {{ include "pms-chart.fullname" . }}-extra | ||
| # data: | ||
| # port: "{{ .Values.service.port }}" | ||
| # extraContainers: |
There was a problem hiding this comment.
nit: this example should follow the extraContainers stanza above
| ExternalSecret, ...) can be owned and pruned by this release instead of being | ||
| applied by hand alongside it. |
There was a problem hiding this comment.
nit: wording
| ExternalSecret, ...) can be owned and pruned by this release instead of being | |
| applied by hand alongside it. | |
| ExternalSecret, ...) can be owned by this release. |
| extraManifests may be a list or a map. Each entry is either a YAML object or a | ||
| string; both are passed through `tpl`, so entries can use the release's values | ||
| and the chart's named templates. |
There was a problem hiding this comment.
I think this description is better suited for the values.yaml description of the entry
| */ -}} | ||
| {{- range $manifest := .Values.extraManifests }} | ||
| --- | ||
| {{- if kindIs "string" $manifest }} |
There was a problem hiding this comment.
is this actually required or wouldn't toYaml be greedy enough that we don't care and we can rely solely on the else part of this conditional?
| # -- Name for the HTTPRoute. Defaults to the chart fullname. Set this to keep | ||
| # an existing route's name when adopting one, so anything that targets it by | ||
| # name (Gateway API SecurityPolicy, BackendTrafficPolicy, ...) keeps working | ||
| name: "" |
There was a problem hiding this comment.
instead of name here, we could do a k:v map and a for_each, so k = name. Thoughts?
Based on the comments, basically you're asking to re-look at how PVCs are handled in general right? I know my PR was just a quick hack to get my use case working, but want to be sure we are on the same page. |
|
The pvcs can be added via httpRoutes can be a dict, so we don't have to do any additional |
The chart templates a Service, a StatefulSet, an Ingress and an HTTPRoute. Anything else belonging to the deployment - Gateway API policies, NetworkPolicy, ServiceMonitor, ExternalSecret - has to be applied beside the release today, so it is not pruned on `helm uninstall` and has to be kept in sync by hand. extraManifests renders arbitrary objects with the release. It may be a list or a map, and each entry is either a YAML object or a string; both are passed through `tpl`, so entries can reference values and the chart's named templates. Default is `[]`, so rendered output is unchanged unless a value is set. values.yaml documents two entries: a config PersistentVolumeClaim the release owns, paired with pms.configExistingClaim, and a policy object given as YAML rather than as a string. README.md is regenerated with helm-docs 1.14.2.
cb2ea75 to
bae6c05
Compare
|
Sorry, totally misread these initially. I agree on the PVCs. Both templates are removed.
I rebased on master and reduced this PR to I applied the other three comments. I took your suggestion exactly. I moved the list-or-map and I disagree on one point: the The branch also matters for the PVC example that you asked for. Only a string entry can carry a template of more than one line. extraManifests:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
{{- include "pms-chart.labels" . | nindent 8 }}As a string, the same text renders correctly. This is the form that the documented PVC example uses, so dropping the branch would take the example with it. Happy to drop string support entirely if you'd rather have the simpler template, but then the example has to inline the labels by hand. On |
Four additions. Every one is default-off or defaults to today's behaviour, so rendered output is unchanged unless a value is set.
httpRoute gains the ability to set matches, filters, timeouts, additionalRules and name to make it more customizable instead of disabling the httpRoute in the chart and applying it beside the release.
pms.configPersistence renders the config volume as a chart-owned PersistentVolumeClaim instead of a StatefulSet volumeClaimTemplate. A volumeClaimTemplate claim is named pms-config-- and is owned by the StatefulSet, so it cannot be given a stable name and cannot carry helm.sh/resource-policy: keep. That left configExistingClaim as the only way to attach a deliberately-named claim, so the claim had to be created and kept in sync outside the chart. configExistingClaim still takes precedence.
extraPersistentVolumeClaims creates additional claims the release owns, for volumes other than the config one - a backups share, a media library, etc - that otherwise have to be applied out of band and then referenced with extraVolumes.
extraManifests renders arbitrary objects with the release. The chart templates a Service, a StatefulSet, an Ingress and an HTTPRoute; anything else belonging to the deployment (Gateway API policies, NetworkPolicy, ServiceMonitor, ExternalSecret, etc) has to be applied beside the chart today, so helm uninstall leaves it behind.
Both extra* values and additionalRules accept a list or a map, and are passed through tpl so they can reference values and the chart's named templates.
README.md is regenerated with helm-docs 1.14.2.