-
Notifications
You must be signed in to change notification settings - Fork 714
Description
Describe the bug
Observed in Flux 2.7.2 (helm chart 2.17.1), ImageRepository resources fail to scan when certSecretRef points to a secret containing an empty string for ca.crt. This configuration previously worked in Flux 2.6.4 (helm chart 2.16.3).
The error message received is:
$ flux -n debugtenant get images all
NAME LAST SCAN SUSPENDED READY MESSAGE
imagerepository/example-app False False failed to configure authentication options: secret 'debugtenant/empty-cert-for-public' must contain either 'ca.crt' or both 'tls.crt' and 'tls.key'
NAME IMAGE TAG READY MESSAGE
imagepolicy/example-app False retrying in 30s error: no tags in database
This appears to be a regression as the same configuration worked correctly in the previous version where output for the same deployment was errors.
Steps to reproduce
Installed flux using Helm chart: https://github.com/fluxcd-community/helm-charts/releases/download/flux2-2.17.1/flux2-2.17.1.tgz
Then apply the following manifests
apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImagePolicy
metadata:
name: example-app
namespace: debugtenant
spec:
imageRepositoryRef:
name: example-app
policy:
alphabetical:
order: asc
---
apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImageRepository
metadata:
name: example-app
namespace: debugtenant
spec:
image: quay.io/redhattraining/hello-world-nginx
interval: 1m0s
certSecretRef:
name: empty-cert-for-public
---
apiVersion: v1
kind: Secret
metadata:
name: empty-cert-for-public
namespace: debugtenant
type: Opaque
data:
ca.crt: ""Expected behavior
ImageRepository should successfully scan container registries with publicly-signed certificates when certSecretRef points to a secret with an empty ca.crt value, matching the behavior in Flux 2.6.4 leading to result:
$ flux -n debugtenant get image all
NAME LAST SCAN SUSPENDED READY MESSAGE
imagerepository/example-app 2025-11-27T10:48:52+01:00 False True successful scan: found 2 tags
NAME LATEST IMAGE READY MESSAGE
imagepolicy/example-app quay.io/redhattraining/hello-world-nginx:v1.0 True Latest image tag for quay.io/redhattraining/hello-world-nginx resolved to v1.0
Use case: This pattern allows maintaining consistent configuration templates across multiple projects, where some repositories use self-signed certificates (requiring a populated ca.crt) and others use publicly-signed certificates (requiring an empty ca.crt). The ability to use an empty string simplifies configuration management.
Current workaround: Removing certSecretRef entirely for repositories with publicly-signed certificates gives the desired outcome, but requires conditional configuration logic instead of always pointing to a secret and then populate that when needed.
Screenshots and recordings
No response
OS / Distro
N/A
Flux version
Issue on 2.7.2, works on 2.6.4
Flux check
On 2.7.2
$ flux check
► checking prerequisites
✗ flux 2.7.3 <2.7.4 (new CLI version is available, please upgrade)
✔ Kubernetes 1.34.0 >=1.32.0-0
► checking version in cluster
✔ distribution: flux-2.7.2
✔ bootstrapped: false
► checking controllers
(Omitted - using chart defaults)
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta3
✔ buckets.source.toolkit.fluxcd.io/v1
✔ externalartifacts.source.toolkit.fluxcd.io/v1
✔ gitrepositories.source.toolkit.fluxcd.io/v1
✔ helmcharts.source.toolkit.fluxcd.io/v1
✔ helmreleases.helm.toolkit.fluxcd.io/v2
✔ helmrepositories.source.toolkit.fluxcd.io/v1
✔ imagepolicies.image.toolkit.fluxcd.io/v1
✔ imagerepositories.image.toolkit.fluxcd.io/v1
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1
✔ ocirepositories.source.toolkit.fluxcd.io/v1
✔ providers.notification.toolkit.fluxcd.io/v1beta3
✔ receivers.notification.toolkit.fluxcd.io/v1
✔ all checks passed
On 2.6.4
$ flux check
► checking prerequisites
✗ flux 2.2.2 <2.7.4 (new CLI version is available, please upgrade)
✔ Kubernetes 1.33.1+k3s1 >=1.26.0-0
► checking version in cluster
✔ distribution: flux-2.6.4
✔ bootstrapped: false
► checking controllers
(Omitted - using chart defaults)
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta3
✔ buckets.source.toolkit.fluxcd.io/v1
✔ gitrepositories.source.toolkit.fluxcd.io/v1
✔ helmcharts.source.toolkit.fluxcd.io/v1
✔ helmreleases.helm.toolkit.fluxcd.io/v2
✔ helmrepositories.source.toolkit.fluxcd.io/v1
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta2
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta2
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta2
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1
✔ ocirepositories.source.toolkit.fluxcd.io/v1
✔ providers.notification.toolkit.fluxcd.io/v1beta3
✔ receivers.notification.toolkit.fluxcd.io/v1
✔ all checks passed
Git provider
No response
Container Registry provider
No response
Additional context
No response
Code of Conduct
- I agree to follow this project's Code of Conduct