Skip to content

Build separate api/ package - #257

Merged
gauron99 merged 3 commits into
functions-dev:mainfrom
gauron99:push-vtuvmyqvpkvv
Oct 5, 2026
Merged

gauron99 merged 3 commits into
functions-dev:mainfrom
gauron99:push-vtuvmyqvpkvv

Conversation

@gauron99

@gauron99 gauron99 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

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

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 gauron99 changed the title Push vtuvmyqvpkvv Build separate api/ package Oct 5, 2026
@gauron99
gauron99 marked this pull request as ready for review October 5, 2026 11:42
Comment thread docs/architecture.md Outdated
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
gauron99 enabled auto-merge (squash) October 5, 2026 12:23
@gauron99
gauron99 merged commit f367076 into functions-dev:main Oct 5, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants