Skip to content

Commit 26abfa9

Browse files
committed
fixup! fixup! Migrate OCIRepository controller to runtime/secrets
Signed-off-by: cappyzawa <[email protected]>
1 parent abf4939 commit 26abfa9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/controller/ocirepository_controller.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,17 @@ func (r *OCIRepositoryReconciler) transport(ctx context.Context, obj *sourcev1.O
971971
return nil, err
972972
}
973973
if tlsConfig != nil {
974+
// Set ServerName for proper virtual hosting support.
975+
// This is crucial for OCI registries that use virtual hosting where multiple
976+
// registries are hosted on the same IP address. Without ServerName, the TLS
977+
// handshake would fail with a certificate mismatch error.
978+
// Note: runtime/secrets does not set ServerName, so this must be done at the
979+
// controller level to ensure proper TLS SNI (Server Name Indication) support.
980+
u, err := url.Parse(obj.Spec.URL)
981+
if err != nil {
982+
return nil, fmt.Errorf("cannot parse repository URL: %w", err)
983+
}
984+
tlsConfig.ServerName = u.Hostname()
974985
transport.TLSClientConfig = tlsConfig
975986
}
976987

0 commit comments

Comments
 (0)