Edition gate - #117
Conversation
…n parameter to the enterprise chart that gates all enterprise-only features.
| @@ -0,0 +1,74 @@ | |||
| #!/bin/sh | |||
There was a problem hiding this comment.
github actions should call this somewhere?
| {{- $mseConfig := "" }} | ||
| {{- $mse4Config := "" }} | ||
| {{- if eq .Values.global.edition "enterprise" }} | ||
| {{- $mseConfig = include "varnish-enterprise.mseConfig" . }} | ||
| {{- $mse4Config = include "varnish-enterprise.mse4Config" . }} | ||
| {{- end }} |
There was a problem hiding this comment.
that's a repeat of the code on line 7, do we need it?
There was a problem hiding this comment.
Yes according to Claude, "$mseConfig declared inside podAnnotations (line 7) is invisible to podVolumes (line 139). They're separate scopes, like two different functions.".
| @@ -204,21 +218,25 @@ volumes: | |||
| name: {{ include "varnish-enterprise.fullname" $ }}-vcl-{{ regexReplaceAll "\\W+" $k "-" }} | |||
| {{- end }} | |||
| {{- end }} | |||
| {{- if eq .Values.global.edition "enterprise" }} | |||
| {{- if .Values.cluster.enabled }} | |||
| - name: {{ $.Release.Name }}-config-vcl-{{ regexReplaceAll "\\W+" $wrappedDefaultVCL "-" }} | |||
| configMap: | |||
| name: {{ include "varnish-enterprise.fullname" $ }}-vcl-{{ regexReplaceAll "\\W+" $wrappedDefaultVCL "-" }} | |||
| {{- end }} | |||
| {{- end }} | |||
| {{- if not (eq (include "varnish-enterprise.cmdfileConfig" .) "") }} | |||
| - name: {{ .Release.Name }}-config-cmdfile | |||
| configMap: | |||
| name: {{ include "varnish-enterprise.fullname" . }}-cmdfile | |||
| {{- end }} | |||
| {{- end }} | |||
| {{- if eq .Values.global.edition "enterprise" }} | |||
| {{- if and .Values.server.agent.enabled (not .Values.server.agent.persistence.enabled) (eq .Values.server.agent.persistence.enableWithVolumeName "") }} | |||
| - name: {{ .Release.Name }}-varnish-controller | |||
| emptyDir: {} | |||
| {{- end }} | |||
| {{- end }} | |||
There was a problem hiding this comment.
could we get get a single if eq .Values.global.edition "enterprise" and stash all the configmaps in it? This would scope things a bit better.
Probably applicable to more sits of the PR, but I think it's quite clear here
There was a problem hiding this comment.
Found some more and fixed them here 161f878
| {{- $mseConfig := "" }} | ||
| {{- $mse4Config := "" }} | ||
| {{- if eq .Values.global.edition "enterprise" }} | ||
| {{- $mseConfig = include "varnish-enterprise.mseConfig" . }} | ||
| {{- $mse4Config = include "varnish-enterprise.mse4Config" . }} | ||
| {{- end }} |
There was a problem hiding this comment.
I keep seeing this code, am I missing something?
There was a problem hiding this comment.
Same as above, they need to be called each time they are used.
| {{- if eq .Values.global.edition "enterprise" }} | ||
| {{- $mse4 = .Values.server.mse4.enabled }} | ||
| {{- end }} | ||
| {{- if eq .Values.global.edition "enterprise" }} |
| {{- if or (and (eq (kindOf .Values.server.mse.enabled) "string") (eq .Values.server.mse.enabled "-") (not $mse4) (not $malloc) ) (and (eq (kindOf .Values.server.mse.enabled) "bool") .Values.server.mse.enabled) }} | ||
| {{- $mse = true }} | ||
| {{- else }} | ||
| {{- $mse = false }} | ||
| {{- end }} |
There was a problem hiding this comment.
isn't this essentially
{{- $mse = or (and (eq (kindOf .Values.server.mse.enabled) "string") (eq .Values.server.mse.enabled "-") (not $mse4) (not $malloc) ) (and (eq (kindOf .Values.server.mse.enabled) "bool") .Values.server.mse.enabled) }}
?
| {{- end }} | ||
| {{- else }} | ||
| {{- if $mse4 }} | ||
| {{- fail "server.mse4 is not available in community edition, use server.malloc.enabled instead" }} |
There was a problem hiding this comment.
can we even reach this? we should never set mse4 if we are not in enterprise mode, should we?
Main three changes:
Adds
global.editionto the enterprise chart (enterpriseby default) that gates all enterprise-only features. When set tocommunity, implementing enterprise features will fail to compile.Adds
ci/publish-community.sh, a script that transforms the enterprise chart into a clean community chart at publish time. It switches the edition, points the image atdocker.io/varnish, sets the correct OSSappVersion, and strips enterprise-only value sections entirely so they never appear in the published chart.Updates the README to document the single-source-of-truth approach and the publish script.
The enterprise chart is now the single source of truth for both charts. They can never drift out of sync again.
Usage:
What to discuss
The old
varnish-cache/directory is still in the repo. It was hand-maintained separately and is now superseded by this approach. Options:Test plan (what I checked to validate this)
helm lint varnish-enterprise/passes with default enterprise valuesbash ci/publish-community.sh 9.0.3generates a clean community chart that passeshelm lintglobal.edition=communityandglobal.edition=enterpriserender the correct resourcesPlease give this a good review, I don't trust myself and there was indeed some Claude influence, so double don't trust.