-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Revert "src: Use jobs not plain pods for auxiliary tasks (#1857)" This reverts commit cb6f33d. * refactor: move code from openshift This is needed to avoid circular package dependencies. Signed-off-by: Matej Vasek <[email protected]> * fix: set pod SC only on non-OpenShift Signed-off-by: Matej Vasek <[email protected]> --------- Signed-off-by: Matej Vasek <[email protected]>
- Loading branch information
1 parent
a2834c2
commit a270f9e
Showing
10 changed files
with
223 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package http | ||
|
||
import ( | ||
"context" | ||
"crypto/x509" | ||
"fmt" | ||
"strings" | ||
"sync" | ||
|
||
"knative.dev/func/pkg/k8s" | ||
) | ||
|
||
const openShiftRegistryHost = "image-registry.openshift-image-registry.svc" | ||
|
||
// WithOpenShiftServiceCA enables trust to OpenShift's service CA for internal image registry | ||
func WithOpenShiftServiceCA() Option { | ||
var err error | ||
var ca *x509.Certificate | ||
var o sync.Once | ||
|
||
selectCA := func(ctx context.Context, serverName string) (*x509.Certificate, error) { | ||
if strings.HasPrefix(serverName, openShiftRegistryHost) { | ||
o.Do(func() { | ||
ca, err = k8s.GetOpenShiftServiceCA(ctx) | ||
if err != nil { | ||
err = fmt.Errorf("cannot get CA: %w", err) | ||
} | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return ca, nil | ||
} | ||
return nil, nil | ||
} | ||
|
||
return WithSelectCA(selectCA) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.