Documentation
¶
Overview ¶
Package registrypush pushes a local Docker archive into the in-cluster registry without exposing it publicly. It runs a short-lived helper Pod in a workload namespace, streams the archive to it with a transfer token, and rewrites push targets between the public, ingress and cluster registry hosts.
Index ¶
- Constants
- func CopyReaderToTempFile(r io.Reader) (string, error)
- func EnsureHelperNamespace(ctx context.Context, client kubernetes.Interface, namespace string) error
- func ParsePortOrDefault(value string, def int) int
- func PushDockerArchive(ctx context.Context, client kubernetes.Interface, restConfig *rest.Config, ...) (retErr error)
- func ResolveHelperNamespace(ctx context.Context, client kubernetes.Interface, preferred string) (string, error)
- func RewritePushTarget(target string, hosts Hosts) string
- type Config
- type Hosts
Constants ¶
const ( HelperLabelKey = "app.kubernetes.io/name" HelperLabelValue = "registry-push-helper" )
HelperLabelKey and HelperLabelValue mark trusted publication helper pods. The registry NetworkPolicy admits only labeled pods to the backend port and grants them the egress needed for image transfer and token exchange.
const TransferTokenHeader = "X-Registry-Push-Transfer-Token" // #nosec G101 -- HTTP header name, not credential material.
TransferTokenHeader is the HTTP header carrying one-time registry push tar tokens.
Variables ¶
This section is empty.
Functions ¶
func CopyReaderToTempFile ¶
CopyReaderToTempFile writes r to a temporary docker archive file and returns its path.
func EnsureHelperNamespace ¶
func EnsureHelperNamespace(ctx context.Context, client kubernetes.Interface, namespace string) error
EnsureHelperNamespace verifies the helper namespace exists.
func ParsePortOrDefault ¶
ParsePortOrDefault parses a service port string or returns def.
func PushDockerArchive ¶
func PushDockerArchive(ctx context.Context, client kubernetes.Interface, restConfig *rest.Config, tarPath, target string, cfg Config) (retErr error)
PushDockerArchive pushes a docker save tar to target using a short-lived skopeo helper pod inside the cluster.
func ResolveHelperNamespace ¶
func ResolveHelperNamespace(ctx context.Context, client kubernetes.Interface, preferred string) (string, error)
ResolveHelperNamespace keeps native-auth helpers with their publisher Secret. The live registry configuration is authoritative, including after activation.
func RewritePushTarget ¶
RewritePushTarget replaces the registry host in target when it matches a bundled internal registry hostname. Targets already using cluster DNS or external registries are returned unchanged.
Types ¶
type Config ¶
type Config struct {
// AuthSecretName optionally selects a Docker config Secret in the trusted helper namespace.
AuthSecretName string
HelperNamespace string
SkopeoImage string
HelperTimeout time.Duration
Hosts Hosts
// TarFetchURL, when set, skips exec-based tar copy and runs a one-shot helper
// pod that downloads the archive from this URL before invoking skopeo.
TarFetchURL string
// TarFetchToken is sent as X-Registry-Push-Transfer-Token when fetching TarFetchURL.
TarFetchToken string
}
Config controls in-cluster registry push helper behavior.