Skip to content

[Feature] Add global.image.registry support for custom registry prefix - #748

Open
Gui13 wants to merge 1 commit into
StarRocks:mainfrom
Gui13:gbi_imageregistry
Open

Gui13 wants to merge 1 commit into
StarRocks:mainfrom
Gui13:gbi_imageregistry

Conversation

@Gui13

@Gui13 Gui13 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Description

This allows to use private registries without having to override the repository. This is how public charts usually work: split between registry, repository and image tag. Bitnami used to work like this.

Adds a global.image.registry value (default: "") that is prepended to all component image repositories. Each component (FE, BE, CN, FE proxy) also exposes its own image.registry field to allow per-component overrides; the component-level value takes priority over the global one.

New helpers (starrockscluster.fe/be/cn/feproxy.image) build the full image reference in one place, keeping templates clean. The init-password job inherits the FE registry automatically.

Priority order (ascending, last wins):
global.image.registry
< starrocksCluster.componentValues.image.registry
< starrocks{FE,BE,CN}Spec.image.registry

The feproxy component is excluded from componentValues (as it already was for image.tag) and resolves directly from its own registry or global.image.registry.

This commit was partially helped with Claude, I added it in the commit Co-Authors.

Related Issue(s)

None

Checklist

For operator, please complete the following checklist:

  • run make generate to generate the code.
  • run golangci-lint run to check the code style.
  • run make test to run UT.
  • run make manifests to update the yaml files of CRD.

For helm chart, please complete the following checklist:

  • make sure you have updated the values.yaml
    file of starrocks chart.
  • In scripts directory, run bash create-parent-chart-values.sh to update the values.yaml file of the parent
    chart( kube-starrocks chart).

@Gui13
Gui13 force-pushed the gbi_imageregistry branch from 00e3674 to 26be7c3 Compare April 16, 2026 08:42
@Gui13

Gui13 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

Please note that I have an helm unittest (https://github.com/helm-unittest/) file that tests the combinations of global.image.registry / starrocksComponents.image.registry and individual registry values to validate that the proper overrides are working as intended.

I didn't commit the file because this would enlarge the merge request substantially :

  • add unittest/ folder & the unittest file
  • need to add a new github action to pass theses unittests (otherwise they are not useful per se)
  • need to add a .helmignore file to ignore packaging of this unittest/ folder

This allows to use private registries without having to override
the repository. This is how public charts usually work: split between
registry, repository and image tag. Bitnami used to work like this.

Adds a global.image.registry value (default: "") that is prepended to
all component image repositories. Each component (FE, BE, CN, FE proxy)
also exposes its own image.registry field to allow per-component
overrides; the component-level value takes priority over the global one.

New helpers (starrockscluster.fe/be/cn/feproxy.image) build the full
image reference in one place, keeping templates clean. The init-password
job inherits the FE registry automatically.

Priority order (ascending, last wins):
  global.image.registry
  < starrocksCluster.componentValues.image.registry
  < starrocks{FE,BE,CN}Spec.image.registry

The feproxy component is excluded from componentValues (as it already was
for image.tag) and resolves directly from its own registry or
global.image.registry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Guillaume Bienkowski <guillaume.bienkowski@braincube.com>
@Gui13
Gui13 force-pushed the gbi_imageregistry branch from 26be7c3 to 7d870f7 Compare April 16, 2026 08:48
@kevincai
kevincai requested review from Copilot, kevincai and yandongxiao and removed request for Copilot April 21, 2026 15:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds configurable image registry prefixing to the StarRocks Helm charts so users can target private registries without overriding each component’s repository.

Changes:

  • Introduces global.image.registry and per-component image.registry values, plus a cluster-wide override at starrocksCluster.componentValues.image.registry.
  • Centralizes FE/BE/CN/FEProxy image string construction in new Helm helpers and updates templates to use them.
  • Updates the init-password Job to inherit the FE image (including registry behavior) via the new helper.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
helm-charts/charts/kube-starrocks/values.yaml Exposes new registry values in the parent chart values (subchart-scoped under starrocks.*).
helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml Adds global.image.registry and per-component registry fields to the subchart defaults/docs.
helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml Switches FE/BE/CN/FEProxy image: fields to use centralized helpers.
helm-charts/charts/kube-starrocks/charts/starrocks/templates/init-pwd/job.yaml Uses FE image helper so init-password job inherits registry/tag logic.
helm-charts/charts/kube-starrocks/charts/starrocks/templates/_helpers.tpl Adds new image-building helpers implementing the registry precedence rules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +723 to +728
{{- $registry := coalesce .Values.starrocksFESpec.image.registry .Values.starrocksCluster.componentValues.image.registry .Values.global.image.registry -}}
{{- $repo := .Values.starrocksFESpec.image.repository -}}
{{- $tag := include "starrockscluster.fe.image.tag" . -}}
{{- if $registry -}}
{{- printf "%s/%s:%s" $registry $repo $tag -}}
{{- else -}}

Copilot AI Apr 21, 2026

Copy link

Choose a reason for hiding this comment

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

The registry/repo concatenation can produce an invalid image reference if the user provides a registry with a trailing slash (e.g. "my-registry/") or a repository with a leading slash, resulting in "registry//repo:tag". Consider normalizing before printf (e.g., trimSuffix "/" on the registry and trimPrefix "/" on the repo) and using the normalized values in both branches.

Copilot uses AI. Check for mistakes.
Comment on lines +738 to +743
{{- $registry := coalesce .Values.starrocksBeSpec.image.registry .Values.starrocksCluster.componentValues.image.registry .Values.global.image.registry -}}
{{- $repo := .Values.starrocksBeSpec.image.repository -}}
{{- $tag := include "starrockscluster.be.image.tag" . -}}
{{- if $registry -}}
{{- printf "%s/%s:%s" $registry $repo $tag -}}
{{- else -}}

Copilot AI Apr 21, 2026

Copy link

Choose a reason for hiding this comment

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

Same as FE image helper: joining registry/repo without trimming can yield "registry//repo:tag" when registry ends with "/" (or repo starts with "/"), which is not a valid image reference. Normalize registry/repo before formatting.

Copilot uses AI. Check for mistakes.
Comment on lines +753 to +758
{{- $registry := coalesce .Values.starrocksCnSpec.image.registry .Values.starrocksCluster.componentValues.image.registry .Values.global.image.registry -}}
{{- $repo := .Values.starrocksCnSpec.image.repository -}}
{{- $tag := include "starrockscluster.cn.image.tag" . -}}
{{- if $registry -}}
{{- printf "%s/%s:%s" $registry $repo $tag -}}
{{- else -}}

Copilot AI Apr 21, 2026

Copy link

Choose a reason for hiding this comment

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

Same normalization concern here: if global/component registry is set with a trailing slash, the formatted image becomes "registry//repo:tag". Trimming the slash (and any leading slash on repo) avoids generating invalid image refs.

Copilot uses AI. Check for mistakes.
Comment on lines +771 to +776
{{- $registry := coalesce .Values.starrocksFeProxySpec.image.registry .Values.global.image.registry -}}
{{- $repo := .Values.starrocksFeProxySpec.image.repository -}}
{{- $tag := .Values.starrocksFeProxySpec.image.tag -}}
{{- if $registry -}}
{{- printf "%s/%s:%s" $registry $repo $tag -}}
{{- else -}}

Copilot AI Apr 21, 2026

Copy link

Choose a reason for hiding this comment

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

The FE proxy image helper has the same potential double-slash issue when registry ends with "/" (or repo starts with "/"), producing "registry//repo:tag". It’s safer to trimSuffix "/" on the registry and trimPrefix "/" on the repo before building the image string.

Copilot uses AI. Check for mistakes.

This branch has not been deployed

No deployments
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.

2 participants