SRVOCF-979: return union of repo and cluster functions - #133
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pmeida 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 |
|
@pmeida: This pull request references SRVOCF-979 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.1.0" version, but no target version was set. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
c4d9732 to
2968a47
Compare
|
Edge cases in the repo/cluster function union - worth discussing This PR merges repo-discovered and cluster-deployed functions, which surfaces two states we should be intentional about:
|
|
/test e2e-aws |
2968a47 to
7107e94
Compare
|
/test e2e-aws |
1 similar comment
|
/test e2e-aws |
| github.com/google/go-github/v72 v72.0.0 | ||
| github.com/onsi/ginkgo/v2 v2.32.0 | ||
| github.com/onsi/gomega v1.42.1 | ||
| go.yaml.in/yaml/v3 v3.0.5 |
There was a problem hiding this comment.
remove, we have sigs.k8s.io/yaml v1.6.0 in line 16
There was a problem hiding this comment.
Done.
Notice that sigs.k8s.io/yaml is itself a wrapper around go.yaml.in/yaml/v3. So by switching to it, we still pull that package in transitively (indirect section)
There was a problem hiding this comment.
It makes sense to have an adapter for functions pkg.
I think scaffold could be merged into here. The scaffold package is basically the C in CRUD for function management and the functions package is now the R.
The function list was sourced only from GitHub repositories, so functions deployed to the cluster without a discoverable repo never appeared in the UI. /func/list now returns the union of repo-discovered and cluster-deployed functions, tagging each with a source (repo or cluster) and keeping the repo source when a function exists in both. Cluster-only functions have no repository to edit, so the frontend disables their Edit action and explains why on hover. Empty runtime now renders as a dash, matching url and namespace. Function querying is split out of the cluster client, which is now provisioning-only (RBAC, service accounts, tokens). A new functions package exposes a growable Client facade over knative/func, and a new kube package owns the shared REST config (host resolution, TLS, JSON content type, request timeout) that both cluster and functions build on. This keeps each cluster concern focused and avoids a god-client. knative/func is bumped to pick up knative/func#4010 so cluster-deployed functions report their runtime. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7107e94 to
e44895c
Compare
func.yaml parsing pulled in go.yaml.in/yaml/v3 as a second direct YAML library, while sigs.k8s.io/yaml was already a dependency. Switch the func.yaml unmarshal to sigs.k8s.io/yaml and retag the struct with json tags (which sigs.k8s.io/yaml honors), removing the redundant direct dependency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
/test e2e-aws |
The scaffold and functions packages were both thin facades over knative/func: scaffold generated a new function's source and CI files, while functions queried deployed functions. Keeping them apart split knative/func usage across two boundaries for no real gain. Fold scaffold into functions so a single package owns all knative/func usage, while keeping its two responsibilities distinct: - client.go holds the cluster-connected facade (Client, NewClient, List); deploy/undeploy/describe are expected next, hence an interface. - scaffold.go holds offline generation (Generate, ScaffoldConfig, EnvVar), which writes to a temp dir and returns scm.FileEntry blobs. It never touches the cluster, so it stays a package function rather than a Client method. Renames for clarity now that both concerns share the namespace: functions.New -> functions.NewClient, functions.Config -> functions.ScaffoldConfig. The knative/func import is aliased fn since the package is itself named functions. docs/ARCHITECTURE.md updated to drop the scaffold package and record why offline scaffolding stays separate from the cluster CRUD facade. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
284263f to
72b4609
Compare
|
@pmeida: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
Summary
/func/listnow returns the union of GitHub repo-discovered functions and cluster-deployed functions, each tagged with asource(repoorcluster); when a function exists in both,repowins. Cluster-deployed functions with no source repository now appear in the UI.functionspackage (unified knative/func facade: the growablefunctions.Clientfor cluster queries, plus offline source/CI scaffold generation - the formerscaffoldpackage folded in so all knative/func usage sits behind one boundary) and newkubepackage (shared REST config: host resolution, TLS, JSON content type, request timeout).clusteris now provisioning-only (RBAC, service accounts, tokens) instead of a god-client.sourcethrough the table, disables Edit for cluster-only functions with a tooltip ("No source repository to edit"), and renders empty runtime as a dash.knative/functo include fix(list): populate RUNTIME column in func list knative/func#4010 so cluster-deployed functions report their runtime and refactor(listers): inject k8s.Client via DI knative/func#4003 so that we can inject rest configs into the lister.functionspackage; added frontend tests for cluster-only rows and the disabled-Edit behavior.kube/functionspackages and the cluster-access split.go.yaml.in/yaml/v3dependency, usingsigs.k8s.io/yamlforfunc.yamlparsingFixes SRVOCF-979
Checklist
docs/ARCHITECTURE.md(if there are relevant changes to our layered architecture)Additional Info
Reasoning for the design decisions:
cluster(write: provisioning) andfunctions(function lifecycle) answer different questions, so they are separate packages rather than one shared client interface.functions.Clientis an interface (not a bare lister) because deploy/delete/describe may be expected next.kube.RESTConfig, a leaf package (depends only onclient-go/rest), so both domain packages build connections identically without a dependency cycle. It intentionally does not live inconfig, which is the wiring layer imported only byhandler/main.