Conversation
func logs reads the logs of functions deployed with the raw and keda deployers. Their pods carry no Knative service label, so each deployer gets its own pod selector: Knative pods by serving.knative.dev/service, raw and keda pods by the boson.dev/function and function.knative.dev/name labels the raw deployer puts on them. Keda deploys through the raw deployer, so the two share one selector. The instructions the MCP server sends its clients say so too. A function which consumes from Kafka runs the kafka-runtime sidecar beside user-container. func logs prints user-container by default, and the new --container flag ($FUNC_CONTAINER), named as in kubectl logs, picks another, as in func logs --container kafka-runtime. The e2e and integration tests no longer set FUNC_CONTAINER=false: no command has read it since func run lost its --container flag, and func logs would. When pods match but none runs a container of the asked name, func logs names the containers they do run, rather than suggest the function scaled to zero or, with --follow, wait for logs which never come.
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauron99 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
🟡 Changes recommended
Active issues allow inherited FUNC_CONTAINER values to redirect or break MCP logs and cause sidecar log following to exit prematurely during rollouts.
2 open issues
What changed in this PR
Extends func logs to raw and KEDA deployments through shared Kubernetes log collection, while retaining Knative support and defaulting to the function’s own container.
Changes:
- Select pods according to the function’s deployer.
- Add
--containerselection and missing-container diagnostics. - Expand tests and documentation, and remove shared
FUNC_CONTAINER=falsetest defaults.
| File | Description |
|---|---|
pkg/mcp/instructions.md |
Document supported deployers and container scope. |
pkg/knative/logs.go |
Extract a reusable Knative pod selector. |
pkg/k8s/logs.go |
Add raw/KEDA pod selection and container validation. |
pkg/k8s/logs_test.go |
Cover selectors, sidecar logs, and missing containers. |
pkg/functions/client_int_test.go |
Remove the shared container environment default. |
e2e/e2e_test.go |
Remove the shared container environment default. |
docs/reference/func_logs.md |
Document container selection and sidecar examples. |
cmd/logs.go |
Route requests by deployer and expose container selection. |
cmd/logs_test.go |
Cover deployer routing, container options, and environment overrides. |
Review effort: Balanced
| Since: viper.GetString("since"), | ||
| Tail: viper.GetInt64("tail"), | ||
| Follow: viper.GetBool("follow"), | ||
| Container: viper.GetString("container"), |
| if err = checkContainer(list.Items, opts.Container); err != nil { | ||
| return err |

func logsnow prints the logs of functions deployed with the raw and keda deployers, not only Knative ones.It prints the function's own container by default;
--container kafka-runtimeprints the Kafka sidecar's logs instead.Before (main)
After (this PR)
Reproduce
On a cluster with func's local registry (e.g.
hack/cluster.sh):With KEDA installed,
--deployer kedagives the same pod: keda deploys through the raw deployer.Follows #3850, which #3851 closed by adding the error above rather than support.