Skip to content

test: Update fn render E2E tests to use :latest set-namespace#4445

Open
SurbhiAgarwal1 wants to merge 1 commit intokptdev:mainfrom
SurbhiAgarwal1:split/fn-eval-namespace-v2
Open

test: Update fn render E2E tests to use :latest set-namespace#4445
SurbhiAgarwal1 wants to merge 1 commit intokptdev:mainfrom
SurbhiAgarwal1:split/fn-eval-namespace-v2

Conversation

@SurbhiAgarwal1
Copy link
Contributor

This PR updates the kpt fn eval E2E test suite to use the :latest version of the set-namespace function.

Key Changes

1. Maintain set-namespace Behavior for Custom Resources

  • Adds an isUnknown() heuristic in internal/kptops/set-namespace.go that detects Custom Resources (CRs) by inspecting the API group.
  • Standard Kubernetes groups (empty, apps, batch, *.k8s.io) are treated as known resources and always get a namespace set.
  • CRs with custom API groups (e.g., custom.io/v1) that have no existing namespace are skipped, preserving backwards compatibility with the :latest set-namespace function image.

2. Update E2E Test Data (e2e/testdata/fn-eval/)

  • Updates Kptfile references from pinned set-namespace image tags (e.g., gcr.io/kpt-fn/set-namespace:v0.4.1) to :latest (ghcr.io/kptdev/krm-functions/set-namespace:latest).
  • Updates .expected/ golden files to reflect the new behavior of :latest, where Custom Resources without an existing namespace are not modified.

3. Fix line-ending issues in CI

  • Adds .gitattributes to force LF line endings for *.sh files and CRLF for *.bat/*.cmd files, preventing bash\r errors in CI.

4. Test infrastructure updates

  • Updates internal/fnruntime/runner_test.go to align test expectations with the new function behavior.

Motivation

The set-namespace function images previously used in E2E tests were pinned to older versions hosted on gcr.io. This PR migrates all fn eval tests to use the :latest image from ghcr.io/kptdev/krm-functions, ensuring tests reflect the current upstream behavior.

This is part 1 of 2 from the original PR #4420 (fn-eval portion).

Signed-off-by: Surbhi agarwalsurbhi1807@gmail.com

Copilot AI review requested due to automatic review settings March 22, 2026 17:42
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 22, 2026
@netlify
Copy link

netlify bot commented Mar 22, 2026

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 2f1c61d
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/69c0c63a19a3ca0008594969
😎 Deploy Preview https://deploy-preview-4445--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@dosubot dosubot bot added area/fn-runtime KRM function runtime go Pull requests that update Go code Testing labels Mar 22, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the kpt fn eval (and related) E2E fixtures to run against set-namespace:latest, and adds repo-level line-ending normalization to prevent CI bash\r failures.

Changes:

  • Switch E2E fn-eval golden configs/results to use set-namespace:latest (and update expected stderr/stdout accordingly).
  • Remove/update various fn-render test fixtures and .krmignore files (as reflected in the golden data changes).
  • Add .gitattributes to enforce LF for *.sh and CRLF for *.bat/*.cmd.

Reviewed changes

Copilot reviewed 291 out of 677 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
e2e/testdata/fn-render/mutate-legacy-path-index/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/mutate-legacy-path-index/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/multiple-fnconfig/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/multiple-fnconfig/configmap.yaml Removes fixture configmap file
e2e/testdata/fn-render/multiple-fnconfig/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/multiple-fnconfig/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/multiple-fnconfig/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/modify-path-annotation/starlark-fn.yaml Removes fixture function config
e2e/testdata/fn-render/modify-path-annotation/deployment.yaml Removes fixture input resource file
e2e/testdata/fn-render/modify-path-annotation/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/modify-path-annotation/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/modify-path-annotation/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/modify-legacy-path-annotation/starlark-fn.yaml Removes fixture function config
e2e/testdata/fn-render/modify-legacy-path-annotation/deployment.yaml Removes fixture input resource file
e2e/testdata/fn-render/modify-legacy-path-annotation/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/modify-legacy-path-annotation/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/modify-legacy-path-annotation/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/missing-kptfile/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/missing-kptfile/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/missing-kptfile/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/missing-fnconfig/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/missing-fnconfig/labelconfig.yaml Removes fixture function config file
e2e/testdata/fn-render/missing-fnconfig/db/resources.yaml Removes fixture input resource file (subpkg)
e2e/testdata/fn-render/missing-fnconfig/db/Kptfile Removes fixture Kptfile (subpkg)
e2e/testdata/fn-render/missing-fnconfig/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/missing-fnconfig/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/missing-fnconfig/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/missing-fn-image/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/missing-fn-image/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/missing-fn-image/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/missing-fn-image/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/kubeval-failure/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/kubeval-failure/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/kubeval-failure/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/kubeval-failure/.expected/results.yaml Removes existing golden results
e2e/testdata/fn-render/kubeval-failure/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/krmignore/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/krmignore/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/krmignore/.krmignore Removes ignore rules for this fixture
e2e/testdata/fn-render/krm-check-exclude-kustomize/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/krm-check-exclude-kustomize/kustomization.yaml Removes fixture kustomization file
e2e/testdata/fn-render/krm-check-exclude-kustomize/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/krm-check-exclude-kustomize/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/kptfile-unknown-fields/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/kptfile-unknown-fields/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/kptfile-unknown-fields/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/kptfile-unknown-fields/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/invalid-kptfile/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/invalid-kptfile/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/invalid-kptfile/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/invalid-kptfile/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/invalid-inline-fnconfig/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/invalid-configmap-fnconfig/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/invalid-configmap-fnconfig/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/invalid-configmap-fnconfig/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/invalid-configmap-fnconfig/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/image-pull-policy-never/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/image-pull-policy-never/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/image-pull-policy-never/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/image-pull-policy-never/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/image-pull-policy-if-not-present/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/image-pull-policy-if-not-present/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/image-pull-policy-if-not-present/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/image-pull-policy-if-not-present/.expected/setup.sh Removes existing golden setup script
e2e/testdata/fn-render/image-pull-policy-if-not-present/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/image-pull-policy-always/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/image-pull-policy-always/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/image-pull-policy-always/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/image-pull-policy-always/.expected/setup.sh Removes existing golden setup script
e2e/testdata/fn-render/image-pull-policy-always/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/generator/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/generator/db/starlark-httpbin.yaml Removes fixture function config (subpkg)
e2e/testdata/fn-render/generator/db/resources.yaml Removes fixture input resource file (subpkg)
e2e/testdata/fn-render/generator/db/Kptfile Removes fixture Kptfile (subpkg)
e2e/testdata/fn-render/generator/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/generator/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/generator/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/generator-subpkgs/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/generator-subpkgs/fn-config.yaml Removes fixture config file
e2e/testdata/fn-render/generator-subpkgs/db/resources.yaml Removes fixture input resource file (subpkg)
e2e/testdata/fn-render/generator-subpkgs/db/fn-config.yaml Removes fixture config file (subpkg)
e2e/testdata/fn-render/generator-subpkgs/db/Kptfile Removes fixture Kptfile (subpkg)
e2e/testdata/fn-render/generator-subpkgs/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/generator-subpkgs/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/generator-absolute-path/starlark-httpbin.yaml Removes fixture function config
e2e/testdata/fn-render/generator-absolute-path/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/generator-absolute-path/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/generator-absolute-path/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/generator-absolute-path/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/format-on-success/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/format-on-success/db/resources.yaml Removes fixture input resource file (subpkg)
e2e/testdata/fn-render/format-on-success/db/Kptfile Removes fixture Kptfile (subpkg)
e2e/testdata/fn-render/format-on-success/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/format-on-success/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/format-on-success/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/fnresult-fn-success/search-replace-conf.yaml Removes fixture function config
e2e/testdata/fn-render/fnresult-fn-success/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnresult-fn-success/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnresult-fn-success/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnresult-fn-success/.expected/results.yaml Removes existing golden results
e2e/testdata/fn-render/fnresult-fn-success/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/fnresult-fn-success/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/fnresult-fn-failure/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnresult-fn-failure/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnresult-fn-failure/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnresult-fn-failure/.expected/results.yaml Removes existing golden results
e2e/testdata/fn-render/fnresult-fn-failure/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/fnconfig/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnconfig/labelconfig.yaml Removes fixture config file
e2e/testdata/fn-render/fnconfig/db/resources.yaml Removes fixture input resource file (subpkg)
e2e/testdata/fn-render/fnconfig/db/Kptfile Removes fixture Kptfile (subpkg)
e2e/testdata/fn-render/fnconfig/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/fnconfig-updated-in-render/update-labels.yaml Removes fixture function config
e2e/testdata/fn-render/fnconfig-updated-in-render/package-context.yaml Removes fixture function config
e2e/testdata/fn-render/fnconfig-updated-in-render/namespace.yaml Removes fixture resource file
e2e/testdata/fn-render/fnconfig-updated-in-render/label-input.yaml Removes fixture function config
e2e/testdata/fn-render/fnconfig-updated-in-render/app.yaml Removes fixture resource file
e2e/testdata/fn-render/fnconfig-updated-in-render/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig-updated-in-render/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig-updated-in-render/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/fnconfig-pkgfn-refers-subdir/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnconfig-pkgfn-refers-subdir/confs/labelconfig.yaml Removes fixture function config
e2e/testdata/fn-render/fnconfig-pkgfn-refers-subdir/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig-pkgfn-refers-subdir/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig-pkgfn-refers-subdir/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/fnconfig-outside-package/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnconfig-outside-package/labelconfig.yaml Removes fixture function config
e2e/testdata/fn-render/fnconfig-outside-package/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig-outside-package/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig-outside-package/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/fnconfig-not-relative/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnconfig-not-relative/labelconfig.yaml Removes fixture function config
e2e/testdata/fn-render/fnconfig-not-relative/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig-not-relative/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig-not-relative/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/fnconfig-multiple-config-one-file/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnconfig-multiple-config-one-file/labelconfig.yaml Removes fixture function config
e2e/testdata/fn-render/fnconfig-multiple-config-one-file/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig-multiple-config-one-file/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig-multiple-config-one-file/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/fnconfig-missing-name/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnconfig-missing-name/labelconfig.yaml Removes fixture function config
e2e/testdata/fn-render/fnconfig-missing-name/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig-missing-name/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig-missing-name/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/fnconfig-in-subdir/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnconfig-in-subdir/db/labelconfig.yaml Removes fixture function config (subdir)
e2e/testdata/fn-render/fnconfig-in-subdir/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig-in-subdir/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig-in-subdir/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/fnconfig-in-subdir/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/fnconfig-cannot-refer-subpkgs/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnconfig-cannot-refer-subpkgs/db/resources.yaml Removes fixture input resource file (subpkg)
e2e/testdata/fn-render/fnconfig-cannot-refer-subpkgs/db/labelconfig.yaml Removes fixture function config (subpkg)
e2e/testdata/fn-render/fnconfig-cannot-refer-subpkgs/db/Kptfile Removes fixture Kptfile (subpkg)
e2e/testdata/fn-render/fnconfig-cannot-refer-subpkgs/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig-cannot-refer-subpkgs/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig-cannot-refer-subpkgs/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/fnconfig-ancestorfn-not-mutate-subpkg-config/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fnconfig-ancestorfn-not-mutate-subpkg-config/db/resources.yaml Removes fixture input resource file (subpkg)
e2e/testdata/fn-render/fnconfig-ancestorfn-not-mutate-subpkg-config/db/labelconfig.yaml Removes fixture function config (subpkg)
e2e/testdata/fn-render/fnconfig-ancestorfn-not-mutate-subpkg-config/db/Kptfile Removes fixture Kptfile (subpkg)
e2e/testdata/fn-render/fnconfig-ancestorfn-not-mutate-subpkg-config/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fnconfig-ancestorfn-not-mutate-subpkg-config/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fnconfig-ancestorfn-not-mutate-subpkg-config/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/fn-success-with-stderr/starlark.yaml Removes fixture function config
e2e/testdata/fn-render/fn-success-with-stderr/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fn-success-with-stderr/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fn-success-with-stderr/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fn-success-with-stderr/.expected/results.yaml Removes existing golden results
e2e/testdata/fn-render/fn-failure/starlark-failure-fn.yaml Removes fixture function config
e2e/testdata/fn-render/fn-failure/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fn-failure/deployment_httpbin.yaml Removes fixture resource file
e2e/testdata/fn-render/fn-failure/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fn-failure/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fn-failure/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/fn-failure-output-no-truncate/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/fn-failure-output-no-truncate/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/fn-failure-output-no-truncate/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/fn-failure-output-no-truncate/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/exec-without-permissions/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/exec-without-permissions/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/exec-without-permissions/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/exec-without-permissions/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/exec-function-with-args/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/exec-function-with-args/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/exec-function-with-args/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/exec-function-with-args/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/exec-function-with-args/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/exec-function-stderr/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/exec-function-stderr/function.sh Removes fixture exec function script
e2e/testdata/fn-render/exec-function-stderr/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/exec-function-stderr/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/exec-function-stderr/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/exec-function-stderr/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/empty-pipeline/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/empty-pipeline/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/empty-pipeline/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/default-runtime/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/default-runtime/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/default-runtime/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/default-runtime/.expected/exec.sh Removes existing golden exec script
e2e/testdata/fn-render/default-runtime/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/basicpipeline/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/basicpipeline/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/basicpipeline/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/basicpipeline/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/basicpipeline/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/basicpipeline-wasm/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/basicpipeline-wasm/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/basicpipeline-wasm/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/basicpipeline-wasm/.expected/teardown.sh Removes existing golden teardown script
e2e/testdata/fn-render/basicpipeline-wasm/.expected/setup.sh Removes existing golden setup script
e2e/testdata/fn-render/basicpipeline-wasm/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/basicpipeline-wasm/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/basicpipeline-v1alpha2/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/basicpipeline-v1alpha2/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/basicpipeline-v1alpha2/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/basicpipeline-v1alpha2/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/basicpipeline-v1alpha1/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/basicpipeline-v1alpha1/labelconfig.yaml Removes fixture function config
e2e/testdata/fn-render/basicpipeline-v1alpha1/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/basicpipeline-v1alpha1/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/basicpipeline-v1alpha1/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/basicpipeline-symlink/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/basicpipeline-symlink/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/basicpipeline-symlink/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/basicpipeline-symlink/.expected/exec.sh Removes existing golden exec script
e2e/testdata/fn-render/basicpipeline-symlink/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/basicpipeline-symlink/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/basicpipeline-semver/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/basicpipeline-semver/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/basicpipeline-semver/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/basicpipeline-semver/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/basicpipeline-semver/.expected/config.yaml Removes existing golden config
e2e/testdata/fn-render/basicpipeline-out-of-place/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/basicpipeline-out-of-place/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/basicpipeline-out-of-place/.krmignore Removes ignore rules for this fixture
e2e/testdata/fn-render/basicpipeline-out-of-place/.expected/exec.sh Removes existing golden exec script
e2e/testdata/fn-render/basicpipeline-out-of-place/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-render/all-resource-deletion/resources.yaml Removes fixture input resource file
e2e/testdata/fn-render/all-resource-deletion/deployment.yaml Removes fixture resource file
e2e/testdata/fn-render/all-resource-deletion/delete-all.yaml Removes fixture function config
e2e/testdata/fn-render/all-resource-deletion/Kptfile Removes fixture Kptfile
e2e/testdata/fn-render/all-resource-deletion/.krmignore Removes .expected ignore rule for this fixture
e2e/testdata/fn-render/all-resource-deletion/.expected/diff.patch Removes existing golden diff
e2e/testdata/fn-eval/wasm-function/.expected/config.yaml Updates fn-eval wasm fixture image tag to :latest
e2e/testdata/fn-eval/subpkgs/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/subpkgs-with-krmignore/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/subpkg-include-meta-resources/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/subpkg-has-samename-subdir/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/subpkg-exclude-fn-config-by-default/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/simple-function/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/simple-function-symlink/.expected/config.yaml Updates expected stderr to :latest
e2e/testdata/fn-eval/short-image-path/.expected/results.yaml Updates results image to :latest
e2e/testdata/fn-eval/short-image-path/.expected/config.yaml Updates fn-eval fixture image/stderr to :latest
e2e/testdata/fn-eval/selectors/selectors-with-exclude/.expected/config.yaml Updates expected stderr to :latest
e2e/testdata/fn-eval/selectors/out-of-place-fnchain-unwrap/.expected/config.yaml Updates expected stderr to :latest
e2e/testdata/fn-eval/selectors/exclude/.expected/config.yaml Updates expected stderr to :latest
e2e/testdata/fn-eval/selectors/basicpipeline/.expected/config.yaml Updates expected stderr to :latest
e2e/testdata/fn-eval/save-fn/validator-type/.expected/config.yaml Updates expected saved image/log output to :latest
e2e/testdata/fn-eval/save-fn/preserve-kptfile-comments/.expected/config.yaml Updates expected saved image/log output to :latest
e2e/testdata/fn-eval/save-fn/override-fn/.expected/config.yaml Updates expected saved image/log output to :latest
e2e/testdata/fn-eval/save-fn/no-save-when-fail/.expected/config.yaml Updates expected stderr image to :latest
e2e/testdata/fn-eval/save-fn/match-selector/.expected/config.yaml Updates expected saved image/log output to :latest
e2e/testdata/fn-eval/save-fn/image/.expected/config.yaml Updates expected saved image/log output to :latest
e2e/testdata/fn-eval/save-fn/custom-pkg-path/.expected/config.yaml Updates expected saved image/log output to :latest
e2e/testdata/fn-eval/preserve-order-null-values/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/preserve-order-include-meta-resources/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/preserve-comments/.expected/diff.patch Adds new golden diff for comment preservation
e2e/testdata/fn-eval/output-to-stdout/.expected/config.yaml Updates expected stdout (namespace line removed)
e2e/testdata/fn-eval/out-of-place-fnchain-unwrap/.expected/config.yaml Updates expected stderr to :latest
e2e/testdata/fn-eval/out-of-place-fnchain-stdout/.expected/config.yaml Updates expected stderr/stdout to :latest
e2e/testdata/fn-eval/out-of-place-dir/.expected/config.yaml Updates expected stderr to :latest
e2e/testdata/fn-eval/non-krm-resource/.expected/config.yaml Updates expected stderr image to :latest
e2e/testdata/fn-eval/no-op/.expected/diff.patch Adds new golden diff for no-op behavior
e2e/testdata/fn-eval/multiple-fn-config-one-file/pkg/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/missing-fn-config/.expected/diff.patch Adds new golden diff for missing fn-config
e2e/testdata/fn-eval/missing-fn-config/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/invalid-fn-config-file/pkg/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/include-meta-resources/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/include-meta-resources-v1alpha2/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/include-meta-resources-v1alpha1/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/fnconfig-missing-name/pkg/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/fn-success-with-stderr/pkg/.expected/diff.patch Adds new golden diff for stderr-on-success
e2e/testdata/fn-eval/fn-config-file/pkg/.expected/config.yaml Updates fn-eval fixture image tag to :latest
e2e/testdata/fn-eval/fn-config-file-in-pkg/.expected/config.yaml Updates fn-eval fixture image tag to :latest
demos/demo-magic/license.txt Removes vendored MIT license notice file
.gitattributes Adds line-ending normalization rules
Comments suppressed due to low confidence (2)

e2e/testdata/fn-render/basicpipeline/.krmignore:1

  • Removing the .krmignore entry for .expected can cause golden/expected outputs to become part of the package inputs for kpt fn render/eval, which can lead to functions mutating the golden files or changing resource counts unexpectedly. If .expected/ still exists for this (or similar) fixtures after the update, keep ignoring it (or update the test harness to exclude it) to avoid test contamination.
    demos/demo-magic/license.txt:1
  • Removing a third-party license file can create licensing/compliance issues if the corresponding third-party component is still present anywhere in the repo (or redistributed via demos). If the dependency is still in use, the license notice should be retained (or moved to a centralized THIRD_PARTY_NOTICES/licenses/ location); if it’s no longer used, consider documenting that removal in the PR description to make the compliance intent explicit.

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

Comment on lines 15 to 18
testType: eval
image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0
image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest
args:
namespace: staging
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

The PR description says the tests are being migrated to ghcr.io/kptdev/krm-functions/set-namespace:latest, but this fixture uses ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest. Please align either the PR description or the test fixtures so they refer to the same image source (to avoid confusion about what’s actually being exercised).

Copilot uses AI. Check for mistakes.
Comment on lines 18 to +27
testType: eval

image: set-namespace:v0.2.0
image: set-namespace:latest

args:
namespace: staging

stdErr: |
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest" in 0s
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

Using :latest in E2E tests makes CI behavior non-reproducible and can introduce flakes when upstream images change. If the intent is to track upstream behavior, consider an approach that still provides determinism (e.g., pin to an image digest in CI and periodically update it, or run a separate “tracks latest” job while keeping the default suite pinned).

Copilot uses AI. Check for mistakes.
@SurbhiAgarwal1 SurbhiAgarwal1 force-pushed the split/fn-eval-namespace-v2 branch from b46ec37 to 8ace373 Compare March 22, 2026 18:01
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Mar 22, 2026
Copilot AI review requested due to automatic review settings March 22, 2026 18:18
@SurbhiAgarwal1 SurbhiAgarwal1 force-pushed the split/fn-eval-namespace-v2 branch from 8ace373 to e25b507 Compare March 22, 2026 18:18
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Mar 22, 2026
Copy link
Contributor

Copilot AI left a comment

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 147 out of 149 changed files in this pull request and generated 3 comments.


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

Comment on lines +63 to +68
// Heuristic: standard Kubernetes groups often have no dots or end in .k8s.io.
// Custom Resources (CRs) typically have groups with dots (e.g., custom.io).
if group == "" || group == "apps" || group == "batch" || strings.HasSuffix(group, ".k8s.io") {
return false
}
return true
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

isUnknown currently classifies any API group that isn't "", "apps", "batch", or *.k8s.io as "unknown". This misclassifies several built-in Kubernetes API groups that don't end in .k8s.io (e.g. autoscaling, extensions, policy, storage, etc.), causing setNamespace to skip setting a namespace for those resources when metadata.namespace is empty. Consider flipping the heuristic to treat groups without a dot as known (or maintain an allowlist of known core groups) and only treat dotted, non-.k8s.io groups as custom/unknown.

Copilot uses AI. Check for mistakes.
Comment on lines 236 to 240
this.importObject = {
gojs: {
go: {
// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
// may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported
// function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

This change removes support for the gojs import module and now only exposes go in the WASM import object. If any Go-compiled WASM binaries (or older/newer Go toolchains) import from module name gojs, instantiation will fail at runtime. Consider restoring the dual exposure (both go and gojs pointing to the same imports) or otherwise ensuring compatibility with the Go toolchain(s) this repo supports.

Copilot uses AI. Check for mistakes.
Comment on lines +175 to +180
if hydErr != nil {
if e.Output == nil {
updateRenderStatus(hctx, hydErr)
}
_ = e.saveFnResults(ctx, hctx.fnResults) // Ignore save error to avoid masking hydration error
return hctx.fnResults, errors.E(op, root.pkg.UniquePath, hydErr)
}

saveErr := e.saveFnResults(ctx, hctx.fnResults)

if e.Output == nil {
updateRenderStatus(hctx, saveErr)
}

return hctx.fnResults, saveErr
return hctx.fnResults, e.saveFnResults(ctx, hctx.fnResults)
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

Renderer.Execute no longer updates the root Kptfile's status.conditions (Rendered condition) on success/failure. This is a user-visible behavior change, but it isn't called out in the PR title/description. Please either document this behavior change explicitly (and update the source CLI docs under documentation/content/...) or keep the status-condition update logic if it’s still intended behavior.

Copilot uses AI. Check for mistakes.
@SurbhiAgarwal1 SurbhiAgarwal1 force-pushed the split/fn-eval-namespace-v2 branch from e25b507 to 5247321 Compare March 23, 2026 04:18
@SurbhiAgarwal1 SurbhiAgarwal1 changed the title test: Update fn eval E2E tests to use :latest set-namespace test: Update fn render E2E tests to use :latest set-namespace Mar 23, 2026
This PR updates the kpt fn eval E2E test suite to use the :latest version of the set-namespace function.

Key changes:

- Add isUnknown() heuristic in internal/kptops/set-namespace.go to detect Custom Resources by API group, skipping namespace for unknown CRs without existing namespace

- Update Kptfile references from pinned set-namespace image tags to :latest (ghcr.io/kptdev/krm-functions/set-namespace:latest)

- Update .expected/ golden files to reflect new :latest behavior

- Add .gitattributes to force LF for *.sh and CRLF for *.bat/*.cmd, preventing bash errors in CI

- Update internal/fnruntime/runner_test.go to align with new function behavior

Part 1 of 2 from the original PR kptdev#4420 (fn-eval portion).

Signed-off-by: Surbhi <agarwalsurbhi1807@gmail.com>
Copilot AI review requested due to automatic review settings March 23, 2026 04:48
@SurbhiAgarwal1 SurbhiAgarwal1 force-pushed the split/fn-eval-namespace-v2 branch from 5247321 to 2f1c61d Compare March 23, 2026 04:48
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Mar 23, 2026
Copy link
Contributor

Copilot AI left a comment

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 46 out of 48 changed files in this pull request and generated 3 comments.


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

Comment on lines 86 to 91
tmp, err := os.CreateTemp("", "kpt-pipeline-*")
assert.NoError(t, err, "unexpected error")
_, err = tmp.WriteString(c.configFileContent)
assert.NoError(t, err, "unexpected error")
c.fn.ConfigPath = path.Base(tmp.Name())
c.fn.ConfigPath = filepath.Base(tmp.Name())
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

The temp config file created with os.CreateTemp is never closed (or removed). On Windows this can prevent reopening the file in newFnConfig and can also leak file descriptors. Close the file (and ideally defer os.Remove(tmp.Name())) after writing before calling newFnConfig.

Copilot uses AI. Check for mistakes.
Comment on lines 15 to 18
testType: eval
image: ghcr.io/kptdev/krm-functions-catalog/wasm/set-namespace:v0.5.1
#image: ghcr.io/kptdev/krm-functions-catalog/wasm/set-namespace:latest
image: gcr.io/kpt-fn-demo/set-namespace:latest
args:
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

This expected config switches the WASM test image to gcr.io/kpt-fn-demo/..., and leaves the intended ghcr.io/kptdev/krm-functions-catalog/wasm/set-namespace:latest commented out. This conflicts with the PR’s stated goal of moving tests off gcr.io/pinned images; if the ghcr image is the target, update the test to use it (or document why the demo image is required).

Copilot uses AI. Check for mistakes.
Comment on lines 45 to 49
for _, n := range rl.Items {
if isUnknown(n) && n.GetNamespace() == "" {
continue
}
if err := n.SetNamespace(namespace); err != nil {
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

setNamespace now skips setting a namespace for resources deemed "unknown" (custom API groups) when metadata.namespace is empty. In this repo, the in-process function dispatcher still registers this implementation under a pinned image tag (.../set-namespace:v0.4.1), so the behavior no longer matches what that tag implies. Consider either updating the internal image mapping/tests to use :latest (to reflect the new semantics) or adding a note clarifying that this stub intentionally tracks :latest behavior.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/fn-runtime KRM function runtime go Pull requests that update Go code size:XL This PR changes 500-999 lines, ignoring generated files. Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants