clients

package
v0.0.7-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ClusterLocalRegistrySuffix = ".svc.cluster.local"

ClusterLocalRegistrySuffix marks in-cluster registries; those are not reachable from the hub, so existence/push probes are skipped for them.

Variables

View Source
var ErrAuthFailed = errors.New("registry authentication failed")

ErrAuthFailed indicates the registry rejected the request for auth reasons (401/403). Callers can use errors.Is to distinguish missing/invalid credentials from other failures.

View Source
var ErrRateLimited = errors.New("registry rate limited")

ErrRateLimited indicates the registry responded with a rate-limit signal (HTTP 429 / toomanyrequests) rather than a definitive answer. Callers can use errors.Is(err, ErrRateLimited) to soft-pass instead of treating it as a hard failure.

Functions

func NormalizeRegistryHost

func NormalizeRegistryHost(ref string) (string, error)

This is used by a user input as an image reference. NormalizeRegistryHost parses an image ref, repository ref, or bare registry host and returns the canonical registry host. Docker Hub aliases (docker.io, registry-1.docker.io) all normalize to name.DefaultRegistry.

func NormalizeRegistryHostInput

func NormalizeRegistryHostInput(host string) (string, error)

This used when users want to register a registry credential for a registry host. NormalizeRegistryHostInput normalizes a user-supplied registry host — as opposed to an image/repository reference — to its canonical form. Unlike NormalizeRegistryHost, a bare single-label string like "harbor" is treated as a host, never as a Docker Hub repository name.

Types

type KubernetesClient

type KubernetesClient interface {
	AttachablePodFromService(ctx context.Context, svcKey types.NamespacedName) (*corev1.Pod, error)
	StreamPodLogs(ctx context.Context, pod *corev1.Pod, logOpts PodLogStreamOptions) (<-chan *LogStreamObject, error)
	BuildPodForJob(ctx context.Context, namespace string, jobName string) (*corev1.Pod, error)

	GetNamespaceMetrics(ctx context.Context, namespace string) (*MetricsStreamObject, error)
	StreamNamespaceMetrics(ctx context.Context, namespace string, metricsStreamOpts MetricsStreamOptions) (<-chan *MetricsStreamObject, error)
}

func NewKubernetesClient

func NewKubernetesClient(spec KubernetesClientSpec) (KubernetesClient, error)

type KubernetesClientSpec

type KubernetesClientSpec struct {
	RestConfig              *rest.Config
	ControllerRuntimeClient client.Client
	Logger                  logger.Logger
}

type LogStreamObject

type LogStreamObject struct {
	Data  string
	Error error
}

type MetricsStreamObject

type MetricsStreamObject struct {
	NamespaceMetrics []metricsv1beta1.PodMetrics
	NodeCapacityMap  map[string]corev1.ResourceList
	Error            error
}

type MetricsStreamOptions

type MetricsStreamOptions interface {
	// PollInterval specifies how often to poll for metrics updates.
	PollInterval() time.Duration
	// MaxErrors returns the maximum number of errors to log before stopping the stream.
	MaxErrors() int
}

type PodLogStreamOptions

type PodLogStreamOptions interface {
	Follow() bool
	TailLines() int
	Since() string
	// Previous asks for the logs of the previously terminated container, which
	// is where a crash-looping workload's real error lives.
	Previous() bool
	// MaxErrors returns the maximum number of errors to log before stopping the stream.
	MaxErrors() int
}

type RegistryClient

type RegistryClient interface {
	CheckImage(ctx context.Context, imageRef string) (bool, error)
	// CheckPushAccess verifies that the client's credentials can authorize a
	// push to repoRef. It requests a push-scoped token and opens (then
	// cancels) a blob upload; it never pushes any content.
	CheckPushAccess(ctx context.Context, repoRef string) error
}

func NewRegistryClientAnonymous

func NewRegistryClientAnonymous() (RegistryClient, error)

func NewRegistryClientWithAuth

func NewRegistryClientWithAuth(username, password string) (RegistryClient, error)

Directories

Path Synopsis
Package githubapp is a thin GitHub App API client covering the manifest conversion, installation, and repository discovery flows.
Package githubapp is a thin GitHub App API client covering the manifest conversion, installation, and repository discovery flows.
Package turnstile verifies Cloudflare Turnstile challenge tokens.
Package turnstile verifies Cloudflare Turnstile challenge tokens.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL