Compare commits

...

3 Commits

Author SHA1 Message Date
Marco Nenciarini
ea36ef4f41
Merge e11f2a85b3 into 4a94cb9dae 2026-04-01 19:27:57 +02:00
Kenny Root
4a94cb9dae
fix(metrics): announce sidecar injection capability (#776)
Some checks failed
release-please / release-please (push) Failing after 5s
The operator was not announcing the TYPE_INSTANCE_SIDECAR_INJECTION
capability so the CNPG operator did not consider the plugin enabled
for instance pods. The instance manager never queried the plugin's
metrics endpoint, and the barman_cloud_cloudnative_pg_io_* metrics
were missing entirely.

This bug was masked when isWALArchiver was set to true in the plugin
configuration, because the backward compatibility code in CNPG would
mark the plugin as enabled as a side-effect. Users with isWALArchiver
set to false (or omitted) never saw the new metrics.

Closes #682 

Signed-off-by: Kenny Root <kenny@the-b.org>
2026-03-31 15:36:09 +02:00
Marco Nenciarini
e11f2a85b3 chore(ci): read Go version from go.mod toolchain directive
Replace hardcoded Go version across the Taskfile and Dockerfiles with a
single GO_VERSION variable extracted from go.mod's toolchain directive.
This makes go.mod the single source of truth for the Go version,
removing the need to keep 3 Taskfile tasks and 2 Dockerfiles in sync
via Renovate's custom regex manager.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-03-06 18:57:34 +01:00
4 changed files with 22 additions and 16 deletions

View File

@ -6,6 +6,8 @@ output: prefixed
# Variables that are shared across tasks. # Variables that are shared across tasks.
vars: vars:
GO_VERSION:
sh: sed -n 's/^toolchain go//p' go.mod
# renovate: datasource=docker depName=kindest/node versioning=semver # renovate: datasource=docker depName=kindest/node versioning=semver
E2E_KUBERNETES_VERSION: v1.35.1 E2E_KUBERNETES_VERSION: v1.35.1
E2E_CLUSTER_NAME: barman-cloud-plugin-e2e-{{.E2E_KUBERNETES_VERSION}} E2E_CLUSTER_NAME: barman-cloud-plugin-e2e-{{.E2E_KUBERNETES_VERSION}}
@ -128,8 +130,6 @@ tasks:
go-test: go-test:
desc: Run go test desc: Run go test
env: env:
# renovate: datasource=docker depName=golang versioning=semver
GOLANG_IMAGE_VERSION: 1.26.1
# renovate: datasource=git-refs depname=kubernetes packageName=https://github.com/kubernetes/kubernetes versioning=semver # renovate: datasource=git-refs depname=kubernetes packageName=https://github.com/kubernetes/kubernetes versioning=semver
K8S_VERSION: 1.31.0 K8S_VERSION: 1.31.0
# renovate: datasource=git-refs depName=controller-runtime packageName=https://github.com/kubernetes-sigs/controller-runtime versioning=semver # renovate: datasource=git-refs depName=controller-runtime packageName=https://github.com/kubernetes-sigs/controller-runtime versioning=semver
@ -137,7 +137,7 @@ tasks:
cmds: cmds:
- > - >
GITHUB_REF= dagger -s call -m ./dagger/gotest GITHUB_REF= dagger -s call -m ./dagger/gotest
--go-version ${GOLANG_IMAGE_VERSION} --go-version {{.GO_VERSION}}
--kube-version ${K8S_VERSION} --kube-version ${K8S_VERSION}
--setup-envtest-version ${SETUP_ENVTEST_VERSION} --setup-envtest-version ${SETUP_ENVTEST_VERSION}
unit-test --src . unit-test --src .
@ -231,7 +231,7 @@ tasks:
cmds: cmds:
- > - >
GITHUB_REF= dagger -s call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA} GITHUB_REF= dagger -s call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
build --dir . --file containers/Dockerfile.plugin --platform linux/amd64 build --dir . --file containers/Dockerfile.plugin --args GO_VERSION={{.GO_VERSION}} --platform linux/amd64
publish --ref {{ .REGISTRY_NAME }}:{{ .REGISTRY_PORT }}/plugin-barman-cloud --tags testing publish --ref {{ .REGISTRY_NAME }}:{{ .REGISTRY_PORT }}/plugin-barman-cloud --tags testing
# We build an image and push it to a local registry. # We build an image and push it to a local registry.
@ -248,7 +248,7 @@ tasks:
cmds: cmds:
- > - >
GITHUB_REF= dagger -s call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA} GITHUB_REF= dagger -s call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
build --dir . --file containers/Dockerfile.sidecar --platform linux/amd64 build --dir . --file containers/Dockerfile.sidecar --args GO_VERSION={{.GO_VERSION}} --platform linux/amd64
publish --ref {{ .REGISTRY_NAME }}:{{ .REGISTRY_PORT }}/sidecar-barman-cloud --tags testing publish --ref {{ .REGISTRY_NAME }}:{{ .REGISTRY_PORT }}/sidecar-barman-cloud --tags testing
build-images: build-images:
@ -305,8 +305,6 @@ tasks:
- build-images - build-images
- start-kind-cluster - start-kind-cluster
vars: vars:
# renovate: datasource=docker depName=golang versioning=semver
GOLANG_IMAGE_VERSION: 1.26.1
KUBECONFIG_PATH: KUBECONFIG_PATH:
sh: mktemp -t kubeconfig-XXXXX sh: mktemp -t kubeconfig-XXXXX
env: env:
@ -317,15 +315,12 @@ tasks:
GITHUB_REF= dagger call -m dagger/e2e/ run GITHUB_REF= dagger call -m dagger/e2e/ run
--source . --source .
--kubeconfig {{.KUBECONFIG_PATH}} --kubeconfig {{.KUBECONFIG_PATH}}
--go-version {{ .GOLANG_IMAGE_VERSION }} --go-version {{.GO_VERSION}}
e2e-ephemeral: e2e-ephemeral:
desc: Run e2e tests in an ephemeral k3s cluster desc: Run e2e tests in an ephemeral k3s cluster
deps: deps:
- build-images - build-images
vars:
# renovate: datasource=docker depName=golang versioning=semver
GOLANG_IMAGE_VERSION: 1.26.1
env: env:
_EXPERIMENTAL_DAGGER_RUNNER_HOST: docker-container://{{ .DAGGER_ENGINE_CONTAINER_NAME }} _EXPERIMENTAL_DAGGER_RUNNER_HOST: docker-container://{{ .DAGGER_ENGINE_CONTAINER_NAME }}
cmds: cmds:
@ -334,7 +329,7 @@ tasks:
--source . --source .
--ca certs/ca.pem --ca certs/ca.pem
--registry {{.REGISTRY_NAME}}:{{.REGISTRY_PORT}} --registry {{.REGISTRY_NAME}}:{{.REGISTRY_PORT}}
--go-version {{ .GOLANG_IMAGE_VERSION }} --go-version {{.GO_VERSION}}
ci: ci:
desc: Run the CI pipeline desc: Run the CI pipeline
@ -373,12 +368,12 @@ tasks:
- > - >
dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA} dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
--registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD --registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD
build --dir . --file containers/Dockerfile.plugin --platform linux/amd64 --platform linux/arm64 build --dir . --file containers/Dockerfile.plugin --args GO_VERSION={{.GO_VERSION}} --platform linux/amd64 --platform linux/arm64
publish --ref {{.PLUGIN_IMAGE_NAME}} --tags {{.IMAGE_VERSION}} publish --ref {{.PLUGIN_IMAGE_NAME}} --tags {{.IMAGE_VERSION}}
- > - >
dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA} dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
--registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD --registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD
build --dir . --file containers/Dockerfile.sidecar --platform linux/amd64 --platform linux/arm64 build --dir . --file containers/Dockerfile.sidecar --args GO_VERSION={{.GO_VERSION}} --platform linux/amd64 --platform linux/arm64
publish --ref {{.SIDECAR_IMAGE_NAME}} --tags {{.IMAGE_VERSION}} publish --ref {{.SIDECAR_IMAGE_NAME}} --tags {{.IMAGE_VERSION}}
controller-gen: controller-gen:

View File

@ -1,5 +1,7 @@
# Build the manager binary # Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.26.1 AS gobuilder # GO_VERSION must be passed as a build arg (read from go.mod toolchain directive by Taskfile)
ARG GO_VERSION
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS gobuilder
ARG TARGETOS ARG TARGETOS
ARG TARGETARCH ARG TARGETARCH

View File

@ -5,7 +5,9 @@
# Both components are built before going into a distroless container # Both components are built before going into a distroless container
# Build the manager binary # Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.26.1 AS gobuilder # GO_VERSION must be passed as a build arg (read from go.mod toolchain directive by Taskfile)
ARG GO_VERSION
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS gobuilder
ARG TARGETOS ARG TARGETOS
ARG TARGETARCH ARG TARGETARCH

View File

@ -62,6 +62,13 @@ func (i IdentityImplementation) GetPluginCapabilities(
}, },
}, },
}, },
{
Type: &identity.PluginCapability_Service_{
Service: &identity.PluginCapability_Service{
Type: identity.PluginCapability_Service_TYPE_INSTANCE_SIDECAR_INJECTION,
},
},
},
}, },
}, nil }, nil
} }