Skip to content

Edition gate - #117

Open
briiians wants to merge 8 commits into
mainfrom
edition-gate
Open

Edition gate#117
briiians wants to merge 8 commits into
mainfrom
edition-gate

Conversation

@briiians

Copy link
Copy Markdown
Collaborator

Main three changes:

  1. Adds global.edition to the enterprise chart (enterprise by default) that gates all enterprise-only features. When set to community, implementing enterprise features will fail to compile.

  2. 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 at docker.io/varnish, sets the correct OSS appVersion, and strips enterprise-only value sections entirely so they never appear in the published chart.

  3. 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:

./ci/publish-community.sh <oss-version> [output-dir]
# e.g.
./ci/publish-community.sh 9.0.3
helm package dist/varnish-cache --destination dist/packages

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:

  • Delete it and use only the generated chart going forward
  • Keep it temporarily as a reference while we validate the generated chart in CI
  • Something else?

Test plan (what I checked to validate this)

  • helm lint varnish-enterprise/ passes with default enterprise values
  • bash ci/publish-community.sh 9.0.3 generates a clean community chart that passes helm lint
  • Enterprise chart unit tests: 156 tests passing
  • Common unit tests: 678 tests passing
  • Both global.edition=community and global.edition=enterprise render the correct resources
  • Attempting to use enterprise features in community mode produces a clear error

Please give this a good review, I don't trust myself and there was indeed some Claude influence, so double don't trust.

audunmg and others added 2 commits June 16, 2026 15:31
…n parameter to the enterprise chart that gates all enterprise-only features.
@briiians
briiians requested review from audunmg and gquintard July 10, 2026 16:16
@briiians briiians self-assigned this Jul 10, 2026
Comment thread ci/publish-community.sh
@@ -0,0 +1,74 @@
#!/bin/sh

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

github actions should call this somewhere?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Should be fixed with 3d0cdef

Comment thread ci/publish-community.sh Outdated
Comment on lines +139 to +144
{{- $mseConfig := "" }}
{{- $mse4Config := "" }}
{{- if eq .Values.global.edition "enterprise" }}
{{- $mseConfig = include "varnish-enterprise.mseConfig" . }}
{{- $mse4Config = include "varnish-enterprise.mse4Config" . }}
{{- end }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

that's a repeat of the code on line 7, do we need it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes according to Claude, "$mseConfig declared inside podAnnotations (line 7) is invisible to podVolumes (line 139). They're separate scopes, like two different functions.".

Comment thread varnish-enterprise/templates/_pod.tpl Outdated
Comment on lines +152 to +239
@@ -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 }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Found some more and fixed them here 161f878

Comment on lines +282 to +287
{{- $mseConfig := "" }}
{{- $mse4Config := "" }}
{{- if eq .Values.global.edition "enterprise" }}
{{- $mseConfig = include "varnish-enterprise.mseConfig" . }}
{{- $mse4Config = include "varnish-enterprise.mse4Config" . }}
{{- end }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I keep seeing this code, am I missing something?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Same as above, they need to be called each time they are used.

Comment thread varnish-enterprise/templates/_pod.tpl Outdated
Comment on lines +379 to +382
{{- if eq .Values.global.edition "enterprise" }}
{{- $mse4 = .Values.server.mse4.enabled }}
{{- end }}
{{- if eq .Values.global.edition "enterprise" }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

merge the two ifs?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in f2f6865

Comment thread varnish-enterprise/templates/_pod.tpl Outdated
Comment on lines +383 to +387
{{- 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 }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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) }}

?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed in ed97b2a

Comment thread varnish-enterprise/templates/_pod.tpl Outdated
{{- end }}
{{- else }}
{{- if $mse4 }}
{{- fail "server.mse4 is not available in community edition, use server.malloc.enabled instead" }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we even reach this? we should never set mse4 if we are not in enterprise mode, should we?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed in eee23d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants