@@ -354,9 +354,19 @@ func (r *OCIRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
354354 return sreconcile .ResultEmpty , e
355355 }
356356
357+ proxyURL , err := r .getProxyURL (ctx , obj )
358+ if err != nil {
359+ e := serror .NewGeneric (
360+ fmt .Errorf ("failed to get proxy address: %w" , err ),
361+ sourcev1 .AuthenticationFailedReason ,
362+ )
363+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
364+ return sreconcile .ResultEmpty , e
365+ }
366+
357367 if _ , ok := keychain .(soci.Anonymous ); obj .Spec .Provider != ociv1 .GenericOCIProvider && ok {
358368 var authErr error
359- auth , authErr = soci .OIDCAuth (ctxTimeout , obj .Spec .URL , obj .Spec .Provider )
369+ auth , authErr = soci .OIDCAuth (ctxTimeout , obj .Spec .URL , obj .Spec .Provider , proxyURL )
360370 if authErr != nil && ! errors .Is (authErr , oci .ErrUnconfiguredProvider ) {
361371 e := serror .NewGeneric (
362372 fmt .Errorf ("failed to get credential from %s: %w" , obj .Spec .Provider , authErr ),
@@ -368,7 +378,7 @@ func (r *OCIRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
368378 }
369379
370380 // Generate the transport for remote operations
371- transport , err := r .transport (ctx , obj )
381+ transport , err := r .transport (ctx , obj , proxyURL )
372382 if err != nil {
373383 e := serror .NewGeneric (
374384 fmt .Errorf ("failed to generate transport for '%s': %w" , obj .Spec .URL , err ),
@@ -927,7 +937,7 @@ func (r *OCIRepositoryReconciler) keychain(ctx context.Context, obj *ociv1.OCIRe
927937// the returned transport will include the TLS client and/or CA certificates.
928938// If the insecure flag is set, the transport will skip the verification of the server's certificate.
929939// Additionally, if a proxy is specified, transport will use it.
930- func (r * OCIRepositoryReconciler ) transport (ctx context.Context , obj * ociv1.OCIRepository ) (* http.Transport , error ) {
940+ func (r * OCIRepositoryReconciler ) transport (ctx context.Context , obj * ociv1.OCIRepository , proxyURL * url. URL ) (* http.Transport , error ) {
931941 transport := remote .DefaultTransport .(* http.Transport ).Clone ()
932942
933943 tlsConfig , err := r .getTLSConfig (ctx , obj )
@@ -938,10 +948,6 @@ func (r *OCIRepositoryReconciler) transport(ctx context.Context, obj *ociv1.OCIR
938948 transport .TLSClientConfig = tlsConfig
939949 }
940950
941- proxyURL , err := r .getProxyURL (ctx , obj )
942- if err != nil {
943- return nil , err
944- }
945951 if proxyURL != nil {
946952 transport .Proxy = http .ProxyURL (proxyURL )
947953 }
0 commit comments