Build separate api/ package - #257
Merged
Merged
Conversation
knative/func imports the CRD types from api/v1alpha1 for its Function CR sync. As part of the root module it pulls in the whole operator module, and once the operator uses func as a library the two modules would require each other. api/ is now github.com/functions-dev/func-operator/api with only k8s.io/api and k8s.io/apimachinery. The root go.mod requires it and points it at ./api with a replace, so the operator always builds against the types in the same commit. Import paths do not change. ./... from the root no longer covers api/, so the fmt, vet, test and lint targets, the test and lint workflows and dependabot also run for api/. The Dockerfiles copy api/go.mod and api/go.sum before go mod download, which needs them for the replace. controller-gen crosses module boundaries on its own, so manifests and generate are unchanged.
The operator needs func's git-source API (fn.NewFunctionFromGit, knative/func#4064), which is on func's main branch but in no release. Require the main commit 2b0e414 directly and drop the replace to an older main commit: nothing else in the dependency graph requires func, so a plain require is enough. func at this commit requires github.com/functions-dev/func-operator v0.2.1 for its Function CR sync. That is this module, so Go keeps the local copy and the CRD types come from the local api module; nothing ends up importing v0.2.1. The commit's pseudo-version v0.50.1-0.20260929103511-2b0e414f74d7 sorts below func's release-branch tags v0.50.2 and v0.50.3, which lack #4064, so dependabot ignores knative.dev/func until a release has it.
gauron99
force-pushed
the
push-vtuvmyqvpkvv
branch
from
October 5, 2026 10:48
ff62ddb to
790b81c
Compare
gauron99
marked this pull request as ready for review
October 5, 2026 11:42
maschmid
reviewed
Oct 5, 2026
Breaking change to v1alpha1: - spec.repository.branch is now spec.repository.revision. It takes a branch name or a full ref such as refs/tags/v1.0.0. Bare tag names and commit hashes follow once sources are read with func's NewFunctionFromGit. - spec.repository.path is now spec.repository.dir, matching func's build.source.dir and --source-dir. - status.git.resolvedBranch is now status.git.resolvedRevision. The operator no longer defaults an empty revision to main: the clone takes the remote's default branch and resolvedRevision reports its name, so repositories whose default branch is not main work without a revision. The sample CR used fields the CRD never had (spec.source.repositoryUrl, spec.registry.path) and is rewritten against the current schema. knative/func's Function CR sync still writes branch and path through func-operator v0.2.1. The API server drops those unknown fields, so func needs a matching change.
gauron99
force-pushed
the
push-vtuvmyqvpkvv
branch
from
October 5, 2026 12:22
790b81c to
0acc3a0
Compare
gauron99
enabled auto-merge (squash)
October 5, 2026 12:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
split
api/so that it can be versioned individually and operator will just import it. this will make it so both operator and func can import the api package instead of func having the need to import all the operator deps along with it.This should cleanup some of the importing back and forth