Skip to content

Validate functions once in Client.Deploy and drop duplicated deployer checks - #4088

Open
akshat-lakhera wants to merge 1 commit into
knative:mainfrom
akshat-lakhera:fix/4055-deploy-validate
Open

akshat-lakhera wants to merge 1 commit into
knative:mainfrom
akshat-lakhera:fix/4055-deploy-validate

Conversation

@akshat-lakhera

Copy link
Copy Markdown

Changes

  • 🧹 Client.Deploy now calls Function.Validate once, after the built, name and expose checks and before the deployer and scaler switch gates. Library callers of Client.Deploy now get the same validation as the CLI and the Tekton pipeline.
  • 🗑️ The keda deployer drops the checks Function.Validate already covers: empty, unknown, repeated or combined http and kafka triggers, the run.kafka brokers, topic and consumerGroup checks, ValidateKafkaSecurity, and the final ValidateScale sweep. The raw deployer drops its scale.min range guard, and replicaBounds no longer repeats the int32 range checks.
  • Deployers keep only the deploy-specific checks that Validate does not do: the Kubernetes name length limits (validateBridgeName, validateKafkaResourceNames), validateKafkaTLSPaths against run.volumes, and the effective replica bounds in replicaBounds (max below 1, or min above max once defaults are applied).
  • The integration test helper calls deployer.Deploy directly, so it now runs function.Validate first.

Tests:

  • New TestClient_Deploy_InvalidFunctionErrors: an invalid function fails Client.Deploy and the deployer is never called, while the same function made valid reaches it.
  • TestClient_Deploy_BlocksScalerSwitch and TestClient_Deploy_PersistsSelfReportedScalerType now use runtime go and invoke cloudevent, since their kafka functions were not valid under Validate.
  • Deployer unit tests for the moved checks are removed.
  • go test passes for pkg/keda, pkg/knative, pkg/k8s, pkg/deployer and pkg/pipelines/tekton. In pkg/functions and cmd, the only failures are TestTemplates_Mode* and TestRepository_*, which fail the same way on main in my WSL setup (file modes on an NTFS mount).

/kind cleanup

Fixes #4055

Release Note

Client.Deploy now validates the function before deploying, so library callers get the same func.yaml validation errors as the func CLI.

Docs


… checks

Signed-off-by: Akshat Lakhera <akshatlnct2024@gmail.com>
@knative-prow knative-prow Bot added the kind/cleanup Cleanup label Oct 18, 2026
@knative-prow

knative-prow Bot commented Oct 18, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: akshat-lakhera
Once this PR has been reviewed and has the lgtm label, please assign evankanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow

knative-prow Bot commented Oct 18, 2026

Copy link
Copy Markdown

Welcome @akshat-lakhera! It looks like this is your first PR to knative/func 🎉

@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels Oct 18, 2026
@knative-prow

knative-prow Bot commented Oct 18, 2026

Copy link
Copy Markdown

Hi @akshat-lakhera. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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

Labels

kind/cleanup Cleanup needs-ok-to-test 🤖 Needs an org member to approve testing size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deployers duplicate validation because Client.Deploy does not call Function.Validate()

1 participant