Skip to content

Commit ccac97c

Browse files
committed
Add WithSystemCertPool for CA compatibility
Updates pkg/runtime to v0.78.0 and configures TLSConfigFromSecretRef to use WithSystemCertPool() option. This maintains backward compatibility with the existing extend approach (system CAs + user CA) rather than the default replace approach (user CA only). This ensures image-reflector-controller continues to work with both system and user-provided CA certificates, fixing the regression where public registries with valid certificates would fail when users provide custom CA certificates for other purposes. Signed-off-by: cappyzawa <[email protected]>
1 parent f5e40c4 commit ccac97c

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/fluxcd/pkg/apis/meta v1.18.0
1616
github.com/fluxcd/pkg/auth v0.21.0
1717
github.com/fluxcd/pkg/cache v0.10.0
18-
github.com/fluxcd/pkg/runtime v0.75.0
18+
github.com/fluxcd/pkg/runtime v0.78.0
1919
github.com/fluxcd/pkg/version v0.9.0
2020
github.com/go-logr/logr v1.4.3
2121
github.com/google/go-containerregistry v0.20.6

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ github.com/fluxcd/pkg/auth v0.21.0 h1:ckAQqP12wuptXEkMY18SQKWEY09m9e6yI0mEMsDV15
181181
github.com/fluxcd/pkg/auth v0.21.0/go.mod h1:MXmpsXT97c874HCw5hnfqFUP7TsG8/Ss1vFrk8JccfM=
182182
github.com/fluxcd/pkg/cache v0.10.0 h1:M+OGDM4da1cnz7q+sZSBtkBJHpiJsLnKVmR9OdMWxEY=
183183
github.com/fluxcd/pkg/cache v0.10.0/go.mod h1:pPXRzQUDQagsCniuOolqVhnAkbNgYOg8d2cTliPs7ME=
184-
github.com/fluxcd/pkg/runtime v0.75.0 h1:wIaODmU5D54nyrehTqA9oQDFoi6BbBj/24adLStXc0I=
185-
github.com/fluxcd/pkg/runtime v0.75.0/go.mod h1:iGhdaEq+lMJQTJNAFEPOU4gUJ7kt3yeDcJPZy7O9IUw=
184+
github.com/fluxcd/pkg/runtime v0.78.0 h1:xwNZqnazmgURGuLiHDbzST6BI5K9fvZuNS4eMVY35Es=
185+
github.com/fluxcd/pkg/runtime v0.78.0/go.mod h1:iGhdaEq+lMJQTJNAFEPOU4gUJ7kt3yeDcJPZy7O9IUw=
186186
github.com/fluxcd/pkg/version v0.9.0 h1:pQBHMt9TbnnTUzj3EoMhRi5JUkNBqrTBSAaoLG1ovUA=
187187
github.com/fluxcd/pkg/version v0.9.0/go.mod h1:JU6/UwNbGeMm4gqeyUn/dxl+qwLTi2+X10xpfgWdt9I=
188188
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=

internal/registry/options.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ func (r *AuthOptionsGetter) GetOptions(ctx context.Context, repo *imagev1.ImageR
138138
Scheme: registry.Scheme(),
139139
Host: registry.Name(),
140140
}
141-
tlsConfig, err := secrets.TLSConfigFromSecretRef(ctx, r.Client, certSecretRef, registryURL.String(), repo.Spec.Insecure)
141+
// NOTE: Use WithSystemCertPool to maintain backward compatibility with the existing
142+
// extend approach (system CAs + user CA) rather than the default replace approach (user CA only).
143+
// This ensures image-reflector-controller continues to work with both system and user-provided CA certificates.
144+
var tlsOpts = []secrets.TLSConfigOption{secrets.WithSystemCertPool()}
145+
tlsConfig, err := secrets.TLSConfigFromSecretRef(ctx, r.Client, certSecretRef, registryURL.String(), tlsOpts...)
142146
if err != nil {
143147
return nil, err
144148
}

0 commit comments

Comments
 (0)