Skip to content

Make the image prefix configurable#4616

Open
OisinJohnston2005 wants to merge 28 commits into
kptdev:mainfrom
Nordix:configurable-image-prefix
Open

Make the image prefix configurable#4616
OisinJohnston2005 wants to merge 28 commits into
kptdev:mainfrom
Nordix:configurable-image-prefix

Conversation

@OisinJohnston2005

Copy link
Copy Markdown

This PR is resolving issue #4595, which requests the ability to configure the default prefix used when resolving image names into fully qualified urls, it asks for the ability to do so either by environment variable or command line argument, this PR implements both prioritising cli args and falling back to the environment variable and then the hard coded prefix.

In order to implement this I removed the ResolveToImageForCLI function since its approach of currying the default image prefix into the ResolveToImage function attribute on the RunnerOptions struct didn't allow Cobra to update the ImagePrefix on runtime.

Instead I opted to implement ResolveToImage as a method and added the ImagePrefix attribute which is updated by cobra whenever a command is run, if no prefix is provided it first checks for the environment variable KPT_IMAGE_PREFIX if set it will use that as the image prefix if not it will use ghcr.io/kptdev/krm-functions-catalog/

Copilot AI review requested due to automatic review settings July 2, 2026 14:10
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 2, 2026
@netlify

netlify Bot commented Jul 2, 2026

Copy link
Copy Markdown

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 99e8133
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6a4baa261f3be60008be67a3
😎 Deploy Preview https://deploy-preview-4616--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@dosubot dosubot Bot added enhancement New feature or request go Pull requests that update Go code labels Jul 2, 2026
@dosubot

dosubot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

📄 Knowledge review

✏️ Suggested updates

3 page suggestions need review.

Page Library Status
_index /kpt/blob/main/documentation/content/en/book/04-using-functions/_index.md kpt ⬆️ Pushed to this PR
_index /kpt/blob/main/documentation/content/en/reference/cli/fn/render/_index.md kpt ⬆️ Pushed to this PR
_index /kpt/blob/main/documentation/content/en/reference/cli/fn/eval/_index.md kpt ⬆️ Pushed to this PR

Leave Feedback Ask Dosu about kpt Add Dosu to your team

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

This PR addresses #4595 by making the default prefix used to expand short KRM function image names configurable at runtime, via a new KPT_IMAGE_PREFIX environment variable and (for relevant commands) a --image-prefix CLI flag. It refactors the image-resolution logic so Cobra can update the configured prefix at execution time rather than relying on a curried function stored in options.

Changes:

  • Added DefaultImagePrefix() (env var fallback) and refactored RunnerOptions to carry ImagePrefix plus a ResolveToImage method.
  • Added --image-prefix flag wiring for fn render and fn eval.
  • Updated command/test code to align with the RunnerOptions refactor and adjusted behavior for fn doc.

Reviewed changes

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

Show a summary per file
File Description
thirdparty/cmdconfig/commands/cmdeval/cmdeval.go Adds --image-prefix flag for fn eval and uses RunnerOptions.ResolveToImage method.
thirdparty/cmdconfig/commands/cmdeval/cmdeval_test.go Updates expected RunnerOptions shape due to refactor (now includes ImagePrefix).
pkg/lib/runneroptions/runneroptions.go Introduces env-var-based defaulting and replaces ResolveToImage function field with ImagePrefix + method.
pkg/fn/runtime/wasmtime_unsupported.go Tweaks unsupported-wasmtime error message and adds linter suppression (needs follow-up).
commands/fn/render/cmdrender.go Adds --image-prefix flag for fn render.
commands/fn/doc/cmdfndoc.go Switches to using DefaultImagePrefix() when resolving images for fn doc.

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

Comment thread pkg/fn/runtime/wasmtime_unsupported.go Outdated
Comment thread commands/fn/doc/cmdfndoc.go Outdated
Comment thread thirdparty/cmdconfig/commands/cmdeval/cmdeval_test.go
Comment thread pkg/lib/runneroptions/runneroptions.go

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

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

Comment thread commands/fn/doc/cmdfndoc.go Outdated
Comment thread commands/fn/render/cmdrender.go Outdated
Comment thread commands/fn/render/cmdrender.go Outdated
Comment thread thirdparty/cmdconfig/commands/cmdeval/cmdeval.go Outdated
Comment thread thirdparty/cmdconfig/commands/cmdeval/cmdeval_test.go
Comment thread commands/fn/doc/cmdfndoc.go Outdated
OisinJohnston2005 and others added 14 commits July 3, 2026 14:38
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
…al as well as render

Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
* Adding rules to CONTRIBUTING.md

- Current CODEOWNER.md based rules for pr approvals.
  This will be changed ot the maintainer and contributor groups based rules
  once we agreed to apply them to all the repos.
- Rules for stale prs

Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>

* Apply suggestions from code review

Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>
Assisted-by: GitHub Copilot: Claude Haiku 4.5

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
…ptdev#4605)

Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Michael Greaves <michael.greaves@nokia.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Michael Greaves <michael.greaves@nokia.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Michael Greaves <michael.greaves@nokia.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Michael Greaves <michael.greaves@nokia.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
CsatariGergely and others added 11 commits July 3, 2026 14:38
Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>
Assisted-by: GitHub Copilot: Claude Haiku 4.5
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Co-authored-by: Catalin Stratulat <159934629+Catalin-Stratulat-Ericsson@users.noreply.github.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Catalin-Stratulat-Ericsson <catalin.stratulat@ericsson.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
…es file overwrite (kptdev#4604)

Signed-off-by: tar <gabor.tar.ext@nokia.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
* Specifying allowed alert types

Signed-off-by: Dominika Schweier <dominika.schweier@nokia.com>

* Specifying allowed alert types

Signed-off-by: Dominika Schweier <dominika.schweier@nokia.com>

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Signed-off-by: Dominika Schweier <dominika.schweier@nokia.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
…4597)

Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
@OisinJohnston2005 OisinJohnston2005 force-pushed the configurable-image-prefix branch from 2dcb9ae to 87be303 Compare July 3, 2026 13:38
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jul 3, 2026
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jul 3, 2026
@liamfallon

Copy link
Copy Markdown
Contributor

@OisinJohnston2005 Can you resolve the copilot comments please?

Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Signed-off-by: Oisin Johnston <oisin.johnston@ericsson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update Go code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants