{"modulePath":"github.com/Stackdome/stackdome","version":"v0.0.7-alpha","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package clients\n\n## Constants\n\n```go\nconst ClusterLocalRegistrySuffix = \".svc.cluster.local\"\n```\nClusterLocalRegistrySuffix marks in-cluster registries; those are not reachable from the hub, so existence/push probes are skipped for them.\n\n## Variables\n\n```go\nvar ErrAuthFailed = errors.New(\"registry authentication failed\")\n```\nErrAuthFailed indicates the registry rejected the request for auth reasons (401/403). Callers can use errors.Is to distinguish missing/invalid credentials from other failures.\n\n```go\nvar ErrRateLimited = errors.New(\"registry rate limited\")\n```\nErrRateLimited 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.\n\n## Functions\n\n```go\nfunc NormalizeRegistryHost(ref string) (string, error)\n```\nThis 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.\n\n```go\nfunc NormalizeRegistryHostInput(host string) (string, error)\n```\nThis 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.\n\n## Types\n\n```go\ntype KubernetesClient interface {\n\tAttachablePodFromService(ctx context.Context, svcKey types.NamespacedName) (*corev1.Pod, error)\n\tStreamPodLogs(ctx context.Context, pod *corev1.Pod, logOpts PodLogStreamOptions) (\u003c-chan *LogStreamObject, error)\n\tBuildPodForJob(ctx context.Context, namespace string, jobName string) (*corev1.Pod, error)\n\n\tGetNamespaceMetrics(ctx context.Context, namespace string) (*MetricsStreamObject, error)\n\tStreamNamespaceMetrics(ctx context.Context, namespace string, metricsStreamOpts MetricsStreamOptions) (\u003c-chan *MetricsStreamObject, error)\n}\n```\n\n```go\nfunc NewKubernetesClient(spec KubernetesClientSpec) (KubernetesClient, error)\n```\n\n```go\ntype KubernetesClientSpec struct {\n\tRestConfig              *rest.Config\n\tControllerRuntimeClient client.Client\n\tLogger                  logger.Logger\n}\n```\n\n```go\ntype LogStreamObject struct {\n\tData  string\n\tError error\n}\n```\n\n```go\ntype MetricsStreamObject struct {\n\tNamespaceMetrics []metricsv1beta1.PodMetrics\n\tNodeCapacityMap  map[string]corev1.ResourceList\n\tError            error\n}\n```\n\n```go\ntype MetricsStreamOptions interface {\n\t// PollInterval specifies how often to poll for metrics updates.\n\tPollInterval() time.Duration\n\t// MaxErrors returns the maximum number of errors to log before stopping the stream.\n\tMaxErrors() int\n}\n```\n\n```go\ntype PodLogStreamOptions interface {\n\tFollow() bool\n\tTailLines() int\n\tSince() string\n\t// Previous asks for the logs of the previously terminated container, which\n\t// is where a crash-looping workload's real error lives.\n\tPrevious() bool\n\t// MaxErrors returns the maximum number of errors to log before stopping the stream.\n\tMaxErrors() int\n}\n```\n\n```go\ntype RegistryClient interface {\n\tCheckImage(ctx context.Context, imageRef string) (bool, error)\n\t// CheckPushAccess verifies that the client's credentials can authorize a\n\t// push to repoRef. It requests a push-scoped token and opens (then\n\t// cancels) a blob upload; it never pushes any content.\n\tCheckPushAccess(ctx context.Context, repoRef string) error\n}\n```\n\n```go\nfunc NewRegistryClientAnonymous() (RegistryClient, error)\n```\n\n```go\nfunc NewRegistryClientWithAuth(username, password string) (RegistryClient, error)\n```\n\n","path":"github.com/Stackdome/stackdome/pkg/clients","name":"clients","synopsis":"","isRedistributable":true}
