Registry Mirror
Skip to content

Conversation

@akshat-lakhera

@akshat-lakhera akshat-lakhera commented Oct 18, 2026 •

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.
  • TestDeploy_KafkaTLSPreflight_HTTPFunction covers Kafka TLS volume checks when run.kafka is configured on an HTTP-triggered function.
  • Integration test fixtures in integration_test_helper.go use strict secret and configMap syntax without extra spaces.
  • Deployer unit tests for the moved checks are removed.

/kind cleanup

Fixes #4055

Release Note

Client.Deploy now validates the function before deploying, so library callers and in-cluster deploys (func-util, Pipelines-as-Code) get the same func.yaml validation errors as the func CLI.

Docs


@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.

@akshat-lakhera

Copy link
Copy Markdown
Author

PTAL @aliok, this one needs an ok-to-test and a workflow approval before CI can run. Your #4128 reworks the same keda deploy checks this PR removes, so should I rebase onto it once it lands, or would you rather get this one in first?

@knative-prow-robot knative-prow-robot added the needs-rebase Cannot be merged due to conflicts with HEAD. label Nov 14, 2026
@akshat-lakhera
akshat-lakhera force-pushed the fix/4055-deploy-validate branch from 5ac3e2d to 8fc7f79 Compare November 16, 2026 17:59
@akshat-lakhera

Copy link
Copy Markdown
Author

Rebased onto latest main and resolved the conflicts with #4128. All unit and integration tests across pkg/keda, pkg/k8s, pkg/functions, and pkg/deployer are passing cleanly.

… checks

Signed-off-by: Akshat Lakhera <akshatlnct2024@gmail.com>
@akshat-lakhera
akshat-lakhera force-pushed the fix/4055-deploy-validate branch from 8fc7f79 to f0e5e6e Compare November 19, 2026 02:56
@knative-prow-robot knative-prow-robot removed the needs-rebase Cannot be merged due to conflicts with HEAD. label Nov 19, 2026
@lkingland

Copy link
Copy Markdown
Member

Thanks @akshat-lakhera, and thanks for rebasing onto #4128. Kicking off CI.

/ok-to-test

@knative-prow knative-prow Bot added ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test 🤖 Needs an org member to approve testing labels Nov 24, 2026
@lkingland

Copy link
Copy Markdown
Member

Thanks @akshat-lakhera, and sorry for the wait on CI. Calling Validate() once in Client.Deploy is the right shape, and nearly everything removed from the deployers is covered by it. Two things came up:

  1. validateKafkaTLSPaths moved from if f.Run.Kafka != nil to if wantKafka. feat: configurable bounded delivery retries for run.kafka #4128 put it under run.kafka on purpose, because the Kafka sidecar is injected whenever run.kafka is set, whatever the trigger. With this change an http-triggered function with run.kafka and a tls.caCert that matches no volume passes Validate() and reaches the cluster. Could that condition stay as it was, with a unit test for the case?

    if f.Run.Kafka != nil {
        if err := validateKafkaTLSPaths(f.Run.Kafka, f.Run.Volumes); err != nil {
            return fn.DeploymentResult{}, fmt.Errorf("function %q: %w", f.Name, err)
        }
    }
  2. The Integration Tests fail because three fixtures write {{ secret: name:KEY }} with a space after secret:, which Validate() rejects (TestInt_FullPath, TestInt_Metadata, TestInt_ResourceValidationOnFirstDeploy). Would removing the space in the fixtures be the right fix?

Please also add a release-note line saying that in-cluster deploys (func-util, Pipelines-as-Code) now run Validate() too.

@akshat-lakhera
akshat-lakhera force-pushed the fix/4055-deploy-validate branch from 35fec63 to 0772622 Compare November 24, 2026 07:35
…xture spaces

Signed-off-by: Akshat Lakhera <akshatlnct2024@gmail.com>
@akshat-lakhera
akshat-lakhera force-pushed the fix/4055-deploy-validate branch from 0772622 to 0e47b4a Compare November 24, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Cleanup ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. 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()

3 participants