Skip to content

Commit 80b44ae

Browse files
authored
Merge pull request #806 from cappyzawa/remove-tlsconfig-servername-pinning
Remove TLS ServerName pinning in TLS config creation
2 parents 535721d + 1ebe44f commit 80b44ae

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
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.78.0
18+
github.com/fluxcd/pkg/runtime v0.80.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.78.0 h1:xwNZqnazmgURGuLiHDbzST6BI5K9fvZuNS4eMVY35Es=
185-
github.com/fluxcd/pkg/runtime v0.78.0/go.mod h1:iGhdaEq+lMJQTJNAFEPOU4gUJ7kt3yeDcJPZy7O9IUw=
184+
github.com/fluxcd/pkg/runtime v0.80.0 h1:vknT2vdQSGTFnAhz4xGk2ZXUWCrXh3whsISStgA57Go=
185+
github.com/fluxcd/pkg/runtime v0.80.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: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,11 @@ func (r *AuthOptionsGetter) GetOptions(ctx context.Context, repo *imagev1.ImageR
126126
Namespace: certSecret.Namespace,
127127
}
128128

129-
// Build target URL for TLS server name validation.
130-
// The image spec contains repository name without scheme (e.g., "127.0.0.1:5000/foo/bar"),
131-
// but TLSConfigFromSecretRef requires a proper URL for ServerName extraction.
132-
ref, err := ParseImageReference(repo.Spec.Image, repo.Spec.Insecure)
133-
if err != nil {
134-
return nil, err
135-
}
136-
registry := ref.Context().Registry
137-
registryURL := &url.URL{
138-
Scheme: registry.Scheme(),
139-
Host: registry.Name(),
140-
}
141129
// NOTE: Use WithSystemCertPool to maintain backward compatibility with the existing
142130
// extend approach (system CAs + user CA) rather than the default replace approach (user CA only).
143131
// This ensures image-reflector-controller continues to work with both system and user-provided CA certificates.
144132
var tlsOpts = []secrets.TLSConfigOption{secrets.WithSystemCertPool()}
145-
tlsConfig, err := secrets.TLSConfigFromSecretRef(ctx, r.Client, certSecretRef, registryURL.String(), tlsOpts...)
133+
tlsConfig, err := secrets.TLSConfigFromSecretRef(ctx, r.Client, certSecretRef, tlsOpts...)
146134
if err != nil {
147135
return nil, err
148136
}

0 commit comments

Comments
 (0)