From 10360fba43d1daa0a2049946c0aee126a9f270cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Mon, 27 Apr 2026 13:38:44 +0200 Subject: [PATCH 1/3] Bump knative.dev/func --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 4e0458f..e790f8d 100644 --- a/go.mod +++ b/go.mod @@ -155,4 +155,4 @@ require ( sigs.k8s.io/yaml v1.6.0 // indirect ) -replace knative.dev/func => knative.dev/func v0.47.1-0.20260421122411-87ce20dd94e4 +replace knative.dev/func => knative.dev/func v0.48.1-0.20260427113619-77707d1de8b6 diff --git a/go.sum b/go.sum index becdf9d..2dfb860 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,6 @@ github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEK github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= @@ -503,8 +501,8 @@ knative.dev/client/pkg v0.0.0-20260414023335-1977a50c04df h1:lVwgz0nFbAiYQUhAVdU knative.dev/client/pkg v0.0.0-20260414023335-1977a50c04df/go.mod h1:aAFzTzKkLSK6I6W4g/+QUMpv5ty2UcOngcXxzn+a1FE= knative.dev/eventing v0.48.1-0.20260414191034-3b3ea1d037e6 h1:maXR76gTo6zpNjZOir4npylXw5wQX2BcXisq8fcaf4c= knative.dev/eventing v0.48.1-0.20260414191034-3b3ea1d037e6/go.mod h1:Y3FYNf5gNCIuqv+NzUAmqfbHJ8n+TxXSsZoV/20jfV0= -knative.dev/func v0.47.1-0.20260421122411-87ce20dd94e4 h1:IjCmEXwcA19aomt7mznmz3wk8qlVesUj2EigI0LPT/I= -knative.dev/func v0.47.1-0.20260421122411-87ce20dd94e4/go.mod h1:R8TiTtGRnIvWSr4EJG6NvEYeB6Fjuj/wBrR7Gw6Ka24= +knative.dev/func v0.48.1-0.20260427113619-77707d1de8b6 h1:TLTpkrxoiZ1gbVA/xBQWFgSBbFmTiu7QID5Olrf8O74= +knative.dev/func v0.48.1-0.20260427113619-77707d1de8b6/go.mod h1:R8TiTtGRnIvWSr4EJG6NvEYeB6Fjuj/wBrR7Gw6Ka24= knative.dev/networking v0.0.0-20260407015926-cc2f0572b3c2 h1:8QlbccV/8/YO2zIoCAOvjU/0t5HxMiWyo480cwohrlQ= knative.dev/networking v0.0.0-20260407015926-cc2f0572b3c2/go.mod h1:a3XBEpYEpWTSz6DdKNXA6+hcny6SSs5J9FChfPxUJMM= knative.dev/pkg v0.0.0-20260414003832-e65cbe95a718 h1:/8xILwHO82gYQXgqQgP9jbSpxg8rmsl/mk1YrYtY/hs= From f0cc468b26f13f8e1b66fbc55c348d18a0471b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Mon, 27 Apr 2026 16:23:00 +0200 Subject: [PATCH 2/3] Add latest commit SHA information in status --- api/v1alpha1/function_types.go | 1 + config/crd/bases/functions.dev_functions.yaml | 2 ++ internal/controller/function_controller.go | 22 ++++++++++++------- .../controller/function_controller_test.go | 4 +++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/api/v1alpha1/function_types.go b/api/v1alpha1/function_types.go index 1a84211..8b2c1a0 100644 --- a/api/v1alpha1/function_types.go +++ b/api/v1alpha1/function_types.go @@ -99,6 +99,7 @@ type FunctionStatusGit struct { type FunctionStatusDeployment struct { Image string `json:"image,omitempty"` ImageBuilt metav1.Time `json:"imageBuilt,omitempty"` + Revision string `json:"revision,omitempty"` Deployer string `json:"deployer,omitempty"` Runtime string `json:"runtime,omitempty"` } diff --git a/config/crd/bases/functions.dev_functions.yaml b/config/crd/bases/functions.dev_functions.yaml index 732294b..8ef81d8 100644 --- a/config/crd/bases/functions.dev_functions.yaml +++ b/config/crd/bases/functions.dev_functions.yaml @@ -184,6 +184,8 @@ spec: imageBuilt: format: date-time type: string + revision: + type: string runtime: type: string type: object diff --git a/internal/controller/function_controller.go b/internal/controller/function_controller.go index a17fb76..6fbf30c 100644 --- a/internal/controller/function_controller.go +++ b/internal/controller/function_controller.go @@ -251,16 +251,18 @@ type middlewareCheck interface { } type middlewareUpToDate struct { - currentImage string - serviceReady string - currentVersion string - autoUpdate autoUpdateStatus + currentImage string + currentRevision string + serviceReady string + currentVersion string + autoUpdate autoUpdateStatus } func (middlewareUpToDate) middlewareCheck() {} type middlewareOutdated struct { currentImage string + currentRevision string serviceReady string currentVersion string availableVersion string @@ -292,15 +294,17 @@ func (r *FunctionReconciler) checkMiddlewareState(ctx context.Context, function if latestVersion == desc.Middleware.Version { return middlewareUpToDate{ - currentImage: desc.Image, - serviceReady: desc.Ready, - currentVersion: desc.Middleware.Version, - autoUpdate: autoUpdate, + currentImage: desc.Image, + currentRevision: desc.Revision, + serviceReady: desc.Ready, + currentVersion: desc.Middleware.Version, + autoUpdate: autoUpdate, }, nil } return middlewareOutdated{ currentImage: desc.Image, + currentRevision: desc.Revision, serviceReady: desc.Ready, currentVersion: desc.Middleware.Version, availableVersion: latestVersion, @@ -330,6 +334,7 @@ func (r *FunctionReconciler) handleMiddlewareUpdate(ctx context.Context, functio case middlewareUpToDate: logger.Info("Function is on latest middleware. No redeploy needed", "version", check.currentVersion) function.Status.Deployment.Image = check.currentImage + function.Status.Deployment.Revision = check.currentRevision function.Status.Middleware.Current = check.currentVersion function.Status.Middleware.AutoUpdate.Enabled = check.autoUpdate.enabled function.Status.Middleware.AutoUpdate.Source = check.autoUpdate.source @@ -339,6 +344,7 @@ func (r *FunctionReconciler) handleMiddlewareUpdate(ctx context.Context, functio case middlewareOutdated: function.Status.Deployment.Image = check.currentImage + function.Status.Deployment.Revision = check.currentRevision function.Status.Middleware.Current = check.currentVersion function.Status.Middleware.AutoUpdate.Enabled = check.autoUpdate.enabled function.Status.Middleware.AutoUpdate.Source = check.autoUpdate.source diff --git a/internal/controller/function_controller_test.go b/internal/controller/function_controller_test.go index 5bac418..2431322 100644 --- a/internal/controller/function_controller_test.go +++ b/internal/controller/function_controller_test.go @@ -228,7 +228,8 @@ var _ = Describe("Function Controller", func() { Middleware: functions.Middleware{ Version: "v1.0.0", }, - Image: "my-image:v1.2.3", + Image: "my-image:v1.2.3", + Revision: "my-revision", }, nil) funcMock.EXPECT().GetLatestMiddlewareVersion(mock.Anything, mock.Anything, mock.Anything).Return("v1.0.0", nil) @@ -241,6 +242,7 @@ var _ = Describe("Function Controller", func() { }, statusChecks: func(status *functionsdevv1alpha1.FunctionStatus) { Expect(status.Deployment.Image).Should(Equal("my-image:v1.2.3")) + Expect(status.Deployment.Revision).Should(Equal("my-revision")) Expect(status.Deployment.Deployer).Should(Equal("keda")) Expect(status.Deployment.Runtime).Should(Equal("node")) }, From 23aadde66ba0bd04f3a8938513e9a8e3687bee3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Mon, 27 Apr 2026 17:14:15 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d53cf30..6817acc 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ kubectl get function my-function -o yaml The status will include: - Function name and conditions - Git information (branch, commit, last checked time) -- Deployment details (image, runtime, build time, deployer) +- Deployment details (image, revision, runtime, build time, deployer) - Middleware status (current and available versions, auto-update settings, pending rebuild status) ## Advanced Use Cases @@ -309,6 +309,7 @@ make lint | `git.lastChecked` | timestamp | Last time the repository was checked | | `deployment.image` | string | Container image of the deployed function | | `deployment.imageBuilt` | timestamp | When the current image was built | +| `deployment.revision` | string | Latest commit SHA of the deployed revision | | `deployment.deployer` | string | Tool/method used to deploy the function (e.g., "func") | | `deployment.runtime` | string | Detected function runtime | | `middleware.current` | string | Current middleware version in use |