client

package
v1.4.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 51 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client is a generated GoMock package.

Index

Constants

View Source
const (
	ComposeOverrideFilename      = "99-compose-flightctl-agent.override.yaml"
	ComposeDockerProjectLabelKey = "com.docker.compose.project"
)
View Source
const (
	// CRIRuntimeCRIO is the RuntimeName value reported by CRI-O.
	CRIRuntimeCRIO = "cri-o"
	// CRIRuntimeContainerd is the RuntimeName value reported by containerd.
	CRIRuntimeContainerd = "containerd"
)
View Source
const (

	// PodmanEventsConfigFilename names the process-scoped containers.conf override.
	PodmanEventsConfigFilename = ".flightctl-podman-events.conf"
	PodmanEventsConfigContents = "[engine]\nevents_container_create_inspect_data = true\n"

	// PodmanImageDigestsListFormat lists registry digests in one Podman invocation.
	PodmanImageDigestsListFormat = `{{printf "%s\t%s" .Digest (json .RepoDigests)}}`
)
View Source
const (
	PodmanDeltaVolumeApplicationLabel = "io.flightctl.delta.application"
	PodmanDeltaVolumeLifetimeLabel    = "io.flightctl.delta.lifetime"
	PodmanDeltaVolumeReferenceLabel   = "io.flightctl.delta.reference"
	PodmanDeltaVolumeDigestLabel      = "io.flightctl.delta.digest"
	PodmanDeltaVolumeOwnerLabel       = "io.flightctl.delta.owner"
	PodmanDeltaVolumeOCITypeLabel     = "io.flightctl.delta.oci-type"
)
View Source
const (
	BootcCmd = "bootc"
)
View Source
const (

	// HelmChartsDir is the subdirectory within the data directory where helm charts are cached.
	HelmChartsDir = "helm/charts"
)
View Source
const (
	QuadletProjectLabelKey = "io.flightctl.quadlet.project"
)

Variables

View Source
var (
	ErrEmptyResponse  = errors.New("empty response")
	ErrDeviceNotFound = errors.New("device not found - certificate should be wiped and agent restarted")
)
View Source
var (
	ErrNoSystemDUnits = errors.New("no units defined")
)

Functions

func ExecuterForUser added in v1.1.0

func ExecuterForUser(username v1beta1.Username) (executer.Executer, error)

func IsCommandAvailable added in v0.3.0

func IsCommandAvailable(cmdName string) bool

IsCommandAvailable checks if a command is available in the PATH.

func IsImmutablePodmanImageID added in v1.4.0

func IsImmutablePodmanImageID(value string) bool

IsImmutablePodmanImageID reports whether value is a full local Podman image ID.

func IsPodmanRootless added in v0.3.0

func IsPodmanRootless() bool

func NewFromConfig

func NewFromConfig(config *baseclient.Config, log *log.PrefixLogger, opts ...HTTPClientOption) (*client.ClientWithResponses, error)

NewFromConfig returns a new Flight Control API client from the given config.

func ParseComposeSpecFromDir added in v0.4.0

func ParseComposeSpecFromDir(reader fileio.Reader, dir string) (*common.ComposeSpec, error)

ParseComposeSpecFromDir reads a compose spec from the given directory and will perform a merge of the base {docker,podman}-compose.yaml and -override.yaml files.

func ParseQuadletReferencesFromDir added in v1.0.0

func ParseQuadletReferencesFromDir(reader fileio.Reader, dir string) (map[string]*common.QuadletReferences, error)

ParseQuadletReferencesFromDir reads quadlet specs from the given directory. It returns a map where the key is the filename and the value is the parsed QuadletSpec.

func SanitizeChartRef added in v1.1.0

func SanitizeChartRef(chartRef string) string

SanitizeChartRef converts a chart reference into a filesystem-safe directory name.

func SanitizePodmanLabel added in v0.4.0

func SanitizePodmanLabel(name string) string

SanitizePodmanLabel sanitizes a string to be used as a label in Podman. Podman labels must be lowercase and can only contain alpha numeric characters, hyphens, and underscores. Any other characters are replaced with an underscore.

func TryReload added in v1.1.0

func TryReload(m Management) (bool, error)

TryReload is a best-effort helper: if m supports Reloadable it reloads it. It returns (true, err) when Reload was attempted, and (false, nil) otherwise.

func WithResponseHook added in v0.10.0

func WithResponseHook(hook ResponseHook) func(ctx context.Context, req *http.Request) error

WithResponseHook creates a RequestEditorFn that adds a response hook to the request context The hook will be called before retry decisions are made

Types

type ArtifactInspect added in v1.0.0

type ArtifactInspect struct {
	Manifest ArtifactManifest `json:"Manifest"`
	Name     string           `json:"Name"`
	Digest   string           `json:"Digest"`
}

ArtifactInspect represents the structure of artifact inspect output

type ArtifactLayer added in v1.0.0

type ArtifactLayer struct {
	Annotations map[string]string `json:"annotations,omitempty"`
}

type ArtifactManifest added in v1.0.0

type ArtifactManifest struct {
	Layers []ArtifactLayer `json:"layers"`
}

type Bootc added in v0.4.0

type Bootc interface {
	// Status returns the current bootc status.
	Status(ctx context.Context) (*container.BootcHost, error)
	// Switch targets a new container image reference to boot.
	Switch(ctx context.Context, image string) error
	// SwitchOCI stages a reconstructed OCI layout directory for the next boot.
	SwitchOCI(ctx context.Context, layoutDir string) error
	// SwitchRegistry stages the registry image so bootc records the spec name.
	SwitchRegistry(ctx context.Context, image string) error
	// Rollback stages the previous deployment for the next boot.
	Rollback(ctx context.Context) error
	// UsrOverlay adds a transient writable overlayfs on `/usr` that will be discarded on reboot.
	UsrOverlay(ctx context.Context) error
	// Apply restart or reboot into the new target image.
	Apply(ctx context.Context) error
}

func NewBootc added in v0.4.0

func NewBootc(log *log.PrefixLogger, executer executer.Executer) Bootc

NewBootc creates a new bootc client.

type CLIClients added in v1.1.0

type CLIClients interface {
	Podman() *Podman
	Skopeo() *Skopeo
	Kube() *Kube
	Helm() *Helm
	CRI() *CRI
}

CLIClients provides access to CLI-based clients for container and Kubernetes operations.

func NewCLIClients added in v1.1.0

func NewCLIClients(opts ...CLIClientsOption) CLIClients

NewCLIClients creates a new CLIClients instance with the provided options.

type CLIClientsOption added in v1.1.0

type CLIClientsOption func(*cliClients)

CLIClientsOption is a functional option for configuring CLIClients.

func WithCRIClient added in v1.1.0

func WithCRIClient(cri *CRI) CLIClientsOption

WithCRIClient sets the CRI client.

func WithHelmClient added in v1.1.0

func WithHelmClient(h *Helm) CLIClientsOption

WithHelmClient sets the Helm client.

func WithKubeClient added in v1.1.0

func WithKubeClient(k *Kube) CLIClientsOption

WithKubeClient sets the Kubernetes CLI client.

func WithPodmanClient added in v1.1.0

func WithPodmanClient(p *Podman) CLIClientsOption

WithPodmanClient sets the Podman client.

func WithSkopeoClient added in v1.1.0

func WithSkopeoClient(s *Skopeo) CLIClientsOption

WithSkopeoClient sets the Skopeo client.

type CRI added in v1.1.0

type CRI struct {
	// contains filtered or unexported fields
}

CRI provides a client for executing crictl CLI commands.

func NewCRI added in v1.1.0

func NewCRI(log *log.PrefixLogger, exec executer.Executer, readWriter fileio.ReadWriter, backoff poll.Config) *CRI

NewCRI creates a new CRI client for interacting with container runtimes via crictl.

func (*CRI) ContainerdImagePlatformDigest added in v1.4.0

func (c *CRI) ContainerdImagePlatformDigest(ctx context.Context, endpoint, repositoryDigest string, opts ...ClientOption) (string, error)

ContainerdImagePlatformDigest resolves a locally cached image index to the manifest for this host without contacting its source registry.

func (*CRI) ImageExists added in v1.1.0

func (c *CRI) ImageExists(ctx context.Context, image string, opts ...ClientOption) bool

ImageExists checks if an image exists in the CRI runtime.

func (*CRI) ImageMetadata added in v1.4.0

func (c *CRI) ImageMetadata(ctx context.Context, image string, opts ...ClientOption) (CRIImageMetadata, error)

ImageMetadata returns the runtime identity and repository digests for a local CRI image.

func (*CRI) ImageReferences added in v1.4.0

func (c *CRI) ImageReferences(ctx context.Context, opts ...ClientOption) (map[string]string, error)

ImageReferences finds registry references keyed by repository digest in the configured CRI store with one image-list request.

func (*CRI) ImageRepoDigests added in v1.4.0

func (c *CRI) ImageRepoDigests(ctx context.Context, image string, opts ...ClientOption) ([]string, error)

ImageRepoDigests returns the registry digests recorded for a local CRI image.

func (*CRI) ImportContainerdImage added in v1.4.0

func (c *CRI) ImportContainerdImage(ctx context.Context, endpoint, archivePath, importBase, targetImage string, opts ...ClientOption) error

ImportContainerdImage imports a reconstructed OCI archive into Kubernetes' containerd namespace, then assigns the reference used by the workload.

func (*CRI) MountContainerdImage added in v1.4.0

func (c *CRI) MountContainerdImage(ctx context.Context, endpoint, image, mountPath string, opts ...ClientOption) error

MountContainerdImage mounts a locally cached image from containerd so oci-delta can use it as source data when reconstructing changed layers.

func (*CRI) Pull added in v1.1.0

func (c *CRI) Pull(ctx context.Context, image string, opts ...ClientOption) (string, error)

Pull pulls an image using crictl and returns the runtime's image reference. Logs progress periodically while the operation is in progress.

func (*CRI) RemoveImage added in v1.1.0

func (c *CRI) RemoveImage(ctx context.Context, image string, opts ...ClientOption) error

RemoveImage removes an image using crictl rmi.

func (*CRI) RuntimeInfo added in v1.4.0

func (c *CRI) RuntimeInfo(ctx context.Context, opts ...ClientOption) (*CRIRuntimeInfo, error)

RuntimeInfo returns the runtime connected to crictl and, for containerd, its socket path for ctr imports.

func (*CRI) TagContainerdImage added in v1.4.0

func (c *CRI) TagContainerdImage(ctx context.Context, endpoint, source, target string, opts ...ClientOption) error

TagContainerdImage force-binds an existing containerd image reference in the Kubernetes namespace to another reference.

func (*CRI) UnmountContainerdImage added in v1.4.0

func (c *CRI) UnmountContainerdImage(ctx context.Context, endpoint, mountPath string, opts ...ClientOption) error

UnmountContainerdImage releases a source image mount created by MountContainerdImage.

type CRIImageMetadata added in v1.4.0

type CRIImageMetadata struct {
	ID          string
	RepoDigests []string
}

CRIImageMetadata is the local image identity and repository metadata reported by CRI.

type CRIRuntimeInfo added in v1.4.0

type CRIRuntimeInfo struct {
	Name     string
	Endpoint string
}

CRIRuntimeInfo describes the local CRI implementation and the containerd socket used by Kubernetes, when applicable.

type ClientOption added in v0.4.0

type ClientOption func(*clientOptions)

ClientOption is a functional option for configuring the client.

func Timeout added in v0.9.0

func Timeout(timeout time.Duration) ClientOption

Timeout sets a custom timeout for the client operation. When defined, this value overrides the default client timeout.

func WithCRIConfig added in v1.1.0

func WithCRIConfig(path string) ClientOption

WithCRIConfig sets the path to the crictl configuration file. This is used for configuring the CRI runtime endpoint.

func WithDefaultAuth added in v1.4.0

func WithDefaultAuth() ClientOption

WithDefaultAuth lets Skopeo consult the process user's standard containers auth files when no explicit pull secret is set. Skopeo otherwise disables default credential lookup for noninteractive operations.

func WithPullSecret added in v0.5.0

func WithPullSecret(path string) ClientOption

WithPullSecret sets the path to the pull secret. If unset uses the default path for the runtime.

func WithRepositoryConfig added in v1.1.0

func WithRepositoryConfig(path string) ClientOption

WithRepositoryConfig sets the path to the Helm repository configuration file. This is used for authenticating with HTTP-based Helm chart repositories.

type Compose added in v0.3.0

type Compose struct {
	*Podman
}

func (*Compose) Down added in v0.3.0

func (p *Compose) Down(ctx context.Context, path string) error

func (*Compose) Stop added in v1.3.0

func (p *Compose) Stop(ctx context.Context, workDir, projectName string) error

Stop runs `podman compose -p projectName stop` from workDir to stop compose containers without removing them or their associated resources.

func (*Compose) Up added in v0.3.0

func (p *Compose) Up(ctx context.Context, path string) error

func (*Compose) UpFromWorkDir added in v0.3.0

func (p *Compose) UpFromWorkDir(ctx context.Context, workDir, projectName string, noRecreate bool, services ...string) error

UpFromWorkDir runs `podman compose up -d` from the given workDir using Compose file layering.

It searches for Compose files in the following order:

  1. One base file (required), chosen from appspec.BaseComposeFiles.
  2. One standard override file (optional), chosen from appspec.OverrideComposeFiles.
  3. An optional flightctl override file (ComposeOverrideFilename) if present.

The method builds the final compose command by layering the discovered files in order. The noRecreate flag, if true, adds `--no-recreate` to prevent recreating existing containers.

type Enrollment

type Enrollment interface {
	SetRPCMetricsCallback(cb RPCMetricsCallback)
	CreateEnrollmentRequest(ctx context.Context, req v1beta1.EnrollmentRequest, cb ...client.RequestEditorFn) (*v1beta1.EnrollmentRequest, error)
	GetEnrollmentRequest(ctx context.Context, id string, cb ...client.RequestEditorFn) (*v1beta1.EnrollmentRequest, error)
}

Enrollment is client the interface for managing device enrollment.

func NewEnrollment

func NewEnrollment(
	client *client.ClientWithResponses, cb RPCMetricsCallback,
) Enrollment

type HTTPClientOption added in v0.10.0

type HTTPClientOption func(*httpClientOptions)

HTTPClientOption is a functional option for configuring the HTTP client

func WithHTTPRetry added in v0.10.0

func WithHTTPRetry(config poll.Config) HTTPClientOption

WithHTTPRetry configures custom retry settings for the HTTP client

func WithHeader added in v1.0.0

func WithHeader(key, value string) HTTPClientOption

WithHeader returns an HTTPClientOption that sets the given HTTP header for outgoing requests.

func WithUserAgent added in v1.0.0

func WithUserAgent() HTTPClientOption

WithUserAgent returns an HTTPClientOption that sets the User-Agent header for outgoing requests using the flightctl-agent version and runtime information.

type Helm added in v1.1.0

type Helm struct {
	// contains filtered or unexported fields
}

Helm provides a client for executing helm CLI commands.

func NewHelm added in v1.1.0

func NewHelm(log *log.PrefixLogger, exec executer.Executer, readWriter fileio.ReadWriter, dataDir string, backoff poll.Config) *Helm

NewHelm creates a new Helm client with the specified logger, executor, and data directory.

func (*Helm) DependencyUpdate added in v1.1.0

func (h *Helm) DependencyUpdate(ctx context.Context, chartPath string, opts ...ClientOption) error

DependencyUpdate updates the dependencies for a chart at the specified path.

func (*Helm) DryRun added in v1.1.0

func (h *Helm) DryRun(ctx context.Context, releaseName, chartPath string, opts ...HelmOption) (string, error)

DryRun performs a helm upgrade --install --dry-run=server to validate the chart against the Kubernetes API server without actually installing it. Returns only the manifest (raw YAML) for compatibility with Template output.

func (*Helm) GetChartPath added in v1.1.0

func (h *Helm) GetChartPath(chartRef string) string

GetChartPath returns the local filesystem path for a cached chart.

func (*Helm) Install added in v1.1.0

func (h *Helm) Install(ctx context.Context, releaseName, chartPath string, opts ...HelmOption) error

Install installs a helm chart as a release with the specified name.

func (*Helm) IsResolved added in v1.1.0

func (h *Helm) IsResolved(chartRef string) (bool, error)

IsResolved returns true if the chart has been fully resolved (pulled and dependencies updated).

func (*Helm) Lint added in v1.1.0

func (h *Helm) Lint(ctx context.Context, chartPath string, opts ...HelmOption) error

Lint runs helm lint on a chart to validate its structure and templates.

func (*Helm) Pull added in v1.1.0

func (h *Helm) Pull(ctx context.Context, chartRef, destDir string, opts ...ClientOption) error

Pull downloads a helm chart from a registry to the specified destination directory.

func (*Helm) RemoveChart added in v1.1.0

func (h *Helm) RemoveChart(chartRef string) error

RemoveChart removes a cached helm chart by its reference. The chart reference format is: oci://registry/chart:version or registry/chart:version

func (*Helm) Resolve added in v1.1.0

func (h *Helm) Resolve(ctx context.Context, chartRef string, opts ...ClientOption) error

Resolve ensures a chart is pulled and its dependencies are updated.

func (*Helm) Template added in v1.1.0

func (h *Helm) Template(ctx context.Context, releaseName, chartPath string, opts ...HelmOption) (string, error)

Template renders a helm chart and returns the resulting Kubernetes manifests.

func (*Helm) Uninstall added in v1.1.0

func (h *Helm) Uninstall(ctx context.Context, releaseName string, opts ...HelmOption) error

Uninstall removes a helm release from the cluster.

func (*Helm) Upgrade added in v1.1.0

func (h *Helm) Upgrade(ctx context.Context, releaseName, chartPath string, opts ...HelmOption) error

Upgrade upgrades an existing helm release to a new chart version.

func (*Helm) Version added in v1.1.0

func (h *Helm) Version(ctx context.Context) (*HelmVersion, error)

Version returns the installed helm CLI version.

type HelmOption added in v1.1.0

type HelmOption func(*helmOptions)

HelmOption is a functional option for configuring helm operations.

func WithAtomic added in v1.1.0

func WithAtomic() HelmOption

WithAtomic enables atomic mode for helm install/upgrade operations.

func WithCreateNamespace added in v1.1.0

func WithCreateNamespace() HelmOption

WithCreateNamespace enables automatic namespace creation for helm operations.

func WithHelmEnv added in v1.1.0

func WithHelmEnv(env map[string]string) HelmOption

WithHelmEnv sets custom environment variables for this helm operation.

func WithHelmTimeout added in v1.1.0

func WithHelmTimeout(timeout time.Duration) HelmOption

WithHelmTimeout sets a custom timeout for helm operations.

func WithIgnoreNotFound added in v1.1.0

func WithIgnoreNotFound() HelmOption

WithIgnoreNotFound treats "release not found" as a successful uninstall.

func WithInstall added in v1.1.0

func WithInstall() HelmOption

WithInstall enables the --install flag for helm upgrade operations.

func WithKubeconfig added in v1.1.0

func WithKubeconfig(path string) HelmOption

WithKubeconfig sets the kubeconfig file path for helm operations.

func WithNamespace added in v1.1.0

func WithNamespace(namespace string) HelmOption

WithNamespace sets the Kubernetes namespace for helm operations.

func WithPostRenderer added in v1.1.0

func WithPostRenderer(path string, args ...string) HelmOption

WithPostRenderer sets the post-renderer binary path and arguments. The post-renderer is invoked after Helm renders templates, allowing modification of the manifests before they are applied.

func WithRollbackOnFailure added in v1.1.0

func WithRollbackOnFailure() HelmOption

WithRollbackOnFailure enables the --rollback-on-failure flag for helm upgrade operations. This is the Helm 4.x replacement for --atomic.

func WithValuesFile added in v1.1.0

func WithValuesFile(path string) HelmOption

WithValuesFile sets a single values file path for helm operations.

func WithValuesFiles added in v1.1.0

func WithValuesFiles(paths []string) HelmOption

WithValuesFiles sets multiple values file paths for helm operations.

type HelmVersion added in v1.1.0

type HelmVersion struct {
	Major int
	Minor int
	Patch int
}

HelmVersion represents a parsed helm CLI version.

func (HelmVersion) GreaterOrEqual added in v1.1.0

func (v HelmVersion) GreaterOrEqual(major, minor int) bool

GreaterOrEqual returns true if this version is greater than or equal to the specified major.minor version.

type Journalctl added in v1.0.0

type Journalctl struct {
	// contains filtered or unexported fields
}

func NewJournalctl added in v1.0.0

func NewJournalctl(exec executer.Executer, user v1beta1.Username) *Journalctl

func (*Journalctl) Logs added in v1.0.0

func (j *Journalctl) Logs(ctx context.Context, options ...LogOptions) ([]string, error)

type Kube added in v1.1.0

type Kube struct {
	// contains filtered or unexported fields
}

Kube provides a client for executing kubectl/oc CLI commands.

func NewKube added in v1.1.0

func NewKube(
	log *log.PrefixLogger,
	exec executer.Executer,
	readWriter fileio.ReadWriter,
	opts ...KubernetesOption,
) *Kube

NewKube creates a new Kube client. Binary discovery and kubeconfig resolution are deferred until first use.

func (*Kube) Binary added in v1.1.0

func (k *Kube) Binary() string

Binary returns the kubectl/oc binary path being used. This triggers resolution if not already done. Returns empty string if no kubernetes CLI binary is available.

func (*Kube) EnsureNamespace added in v1.1.0

func (k *Kube) EnsureNamespace(ctx context.Context, namespace string, opts ...KubeOption) error

EnsureNamespace creates a namespace if it doesn't exist and applies any specified labels.

func (*Kube) IsAvailable added in v1.1.0

func (k *Kube) IsAvailable() bool

IsAvailable returns true if kubernetes is fully configured. This attempts to resolve binary and kubeconfig if not already done.

func (*Kube) Kustomize added in v1.1.0

func (k *Kube) Kustomize(ctx context.Context, dir string) (stdout, stderr string, exitCode int)

Kustomize runs kubectl kustomize on the specified directory and returns the output.

func (*Kube) NamespaceExists added in v1.1.0

func (k *Kube) NamespaceExists(ctx context.Context, namespace string, opts ...KubeOption) (bool, error)

NamespaceExists checks if a namespace exists in the cluster.

func (*Kube) ResolveKubeconfig added in v1.1.0

func (k *Kube) ResolveKubeconfig() (string, error)

ResolveKubeconfig resolves and returns the kubeconfig path. This also ensures the binary is resolved. The result is cached after the first successful resolution.

func (*Kube) ScaleWorkloadsByLabel added in v1.3.0

func (k *Kube) ScaleWorkloadsByLabel(ctx context.Context, namespace, labelSelector string, replicas int, opts ...KubeOption) error

ScaleWorkloadsByLabel scales all Deployments and StatefulSets in namespace that match labelSelector to the given replica count.

func (*Kube) WatchPodsCmd added in v1.1.0

func (k *Kube) WatchPodsCmd(ctx context.Context, opts ...KubeOption) (*exec.Cmd, error)

WatchPodsCmd returns an exec.Cmd configured to watch pod events across all namespaces. Use WithKubeLabels to filter pods by label selector.

type KubeOption added in v1.1.0

type KubeOption func(*kubeOptions)

KubeOption is a functional option for configuring individual kube operations.

func WithKubeKubeconfig added in v1.1.0

func WithKubeKubeconfig(path string) KubeOption

WithKubeKubeconfig sets the kubeconfig file path for kube operations.

func WithKubeLabels added in v1.1.0

func WithKubeLabels(labels []string) KubeOption

WithKubeLabels sets labels to apply during kube operations. Each label should be in the format "key=value".

type KubernetesOption added in v1.1.0

type KubernetesOption func(*kubernetesOptions)

KubernetesOption is a functional option for configuring the Kube client.

func WithBinary added in v1.1.0

func WithBinary(binary string) KubernetesOption

WithBinary sets a specific kubectl/oc binary path instead of auto-discovering.

func WithKubeconfigPath added in v1.1.0

func WithKubeconfigPath(path string) KubernetesOption

WithKubeconfigPath pre-configures the kubeconfig path, skipping resolution.

type LogOptions added in v1.0.0

type LogOptions func(*logOptions)

func WithLogSince added in v1.0.0

func WithLogSince(t time.Time) LogOptions

func WithLogTag added in v1.0.0

func WithLogTag(tag string) LogOptions

func WithLogUnit added in v1.0.0

func WithLogUnit(unit string) LogOptions

type Management

type Management interface {
	UpdateDeviceStatus(ctx context.Context, name string, device v1beta1.Device, rcb ...client.RequestEditorFn) error
	GetRenderedDevice(ctx context.Context, name string, params *v1beta1.GetRenderedDeviceParams, rcb ...client.RequestEditorFn) (*v1beta1.Device, int, error)
	PatchDeviceStatus(ctx context.Context, name string, patch v1beta1.PatchRequest, rcb ...client.RequestEditorFn) error
	SetRPCMetricsCallback(cb RPCMetricsCallback)
	CreateCertificateSigningRequest(ctx context.Context, csr v1beta1.CertificateSigningRequest, rcb ...client.RequestEditorFn) (*v1beta1.CertificateSigningRequest, int, error)
	GetCertificateSigningRequest(ctx context.Context, name string, rcb ...client.RequestEditorFn) (*v1beta1.CertificateSigningRequest, int, error)
}

Management is the client interface for managing devices.

func NewManagement

func NewManagement(
	client *client.ClientWithResponses, cb RPCMetricsCallback,
) Management

type ManagementDelegate added in v1.1.0

type ManagementDelegate struct {
	// contains filtered or unexported fields
}

ManagementDelegate delegates Management calls to a swappable underlying client.

func NewManagementDelegate added in v1.1.0

func NewManagementDelegate(factory ManagementFactory) (*ManagementDelegate, error)

NewManagementDelegate creates a Management client wrapper that delegates all calls to an underlying Management instance produced by the given factory.

The delegate allows the underlying client to be atomically replaced at runtime (via Reload), which is useful for scenarios such as client TLS certificate rotation, transport reconfiguration, or full client rebuilds.

Callers should treat the returned Management as long-lived and stable, while the delegate transparently swaps the actual client implementation underneath without requiring re-wiring of consumers.

func (*ManagementDelegate) CreateCertificateSigningRequest added in v1.1.0

func (*ManagementDelegate) GetCertificateSigningRequest added in v1.1.0

func (d *ManagementDelegate) GetCertificateSigningRequest(
	ctx context.Context,
	name string,
	rcb ...agentclient.RequestEditorFn,
) (*api.CertificateSigningRequest, int, error)

func (*ManagementDelegate) GetRenderedDevice added in v1.1.0

func (d *ManagementDelegate) GetRenderedDevice(
	ctx context.Context,
	name string,
	params *api.GetRenderedDeviceParams,
	rcb ...agentclient.RequestEditorFn,
) (*api.Device, int, error)

func (*ManagementDelegate) PatchDeviceStatus added in v1.1.0

func (d *ManagementDelegate) PatchDeviceStatus(
	ctx context.Context,
	name string,
	patch api.PatchRequest,
	rcb ...agentclient.RequestEditorFn,
) error

func (*ManagementDelegate) Reload added in v1.1.0

func (d *ManagementDelegate) Reload() error

Reload forces re-creation of the underlying client (e.g., after cert rotation).

func (*ManagementDelegate) SetRPCMetricsCallback added in v1.1.0

func (d *ManagementDelegate) SetRPCMetricsCallback(cb RPCMetricsCallback)

func (*ManagementDelegate) UpdateDeviceStatus added in v1.1.0

func (d *ManagementDelegate) UpdateDeviceStatus(
	ctx context.Context,
	name string,
	device api.Device,
	rcb ...agentclient.RequestEditorFn,
) error

type ManagementFactory added in v1.1.0

type ManagementFactory func() (Management, error)

ManagementFactory creates a new underlying Management client.

type MockBootc added in v0.4.0

type MockBootc struct {
	// contains filtered or unexported fields
}

MockBootc is a mock of Bootc interface.

func NewMockBootc added in v0.4.0

func NewMockBootc(ctrl *gomock.Controller) *MockBootc

NewMockBootc creates a new mock instance.

func (*MockBootc) Apply added in v0.4.0

func (m *MockBootc) Apply(ctx context.Context) error

Apply mocks base method.

func (*MockBootc) EXPECT added in v0.4.0

func (m *MockBootc) EXPECT() *MockBootcMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBootc) Rollback added in v1.2.0

func (m *MockBootc) Rollback(ctx context.Context) error

Rollback mocks base method.

func (*MockBootc) Status added in v0.4.0

func (m *MockBootc) Status(ctx context.Context) (*container.BootcHost, error)

Status mocks base method.

func (*MockBootc) Switch added in v0.4.0

func (m *MockBootc) Switch(ctx context.Context, image string) error

Switch mocks base method.

func (*MockBootc) SwitchOCI added in v1.4.0

func (m *MockBootc) SwitchOCI(ctx context.Context, layoutDir string) error

SwitchOCI mocks base method.

func (*MockBootc) SwitchRegistry added in v1.4.0

func (m *MockBootc) SwitchRegistry(ctx context.Context, image string) error

SwitchRegistry mocks base method.

func (*MockBootc) UsrOverlay added in v0.4.0

func (m *MockBootc) UsrOverlay(ctx context.Context) error

UsrOverlay mocks base method.

type MockBootcMockRecorder added in v0.4.0

type MockBootcMockRecorder struct {
	// contains filtered or unexported fields
}

MockBootcMockRecorder is the mock recorder for MockBootc.

func (*MockBootcMockRecorder) Apply added in v0.4.0

func (mr *MockBootcMockRecorder) Apply(ctx any) *gomock.Call

Apply indicates an expected call of Apply.

func (*MockBootcMockRecorder) Rollback added in v1.2.0

func (mr *MockBootcMockRecorder) Rollback(ctx any) *gomock.Call

Rollback indicates an expected call of Rollback.

func (*MockBootcMockRecorder) Status added in v0.4.0

func (mr *MockBootcMockRecorder) Status(ctx any) *gomock.Call

Status indicates an expected call of Status.

func (*MockBootcMockRecorder) Switch added in v0.4.0

func (mr *MockBootcMockRecorder) Switch(ctx, image any) *gomock.Call

Switch indicates an expected call of Switch.

func (*MockBootcMockRecorder) SwitchOCI added in v1.4.0

func (mr *MockBootcMockRecorder) SwitchOCI(ctx, layoutDir any) *gomock.Call

SwitchOCI indicates an expected call of SwitchOCI.

func (*MockBootcMockRecorder) SwitchRegistry added in v1.4.0

func (mr *MockBootcMockRecorder) SwitchRegistry(ctx, image any) *gomock.Call

SwitchRegistry indicates an expected call of SwitchRegistry.

func (*MockBootcMockRecorder) UsrOverlay added in v0.4.0

func (mr *MockBootcMockRecorder) UsrOverlay(ctx any) *gomock.Call

UsrOverlay indicates an expected call of UsrOverlay.

type MockEnrollment

type MockEnrollment struct {
	// contains filtered or unexported fields
}

MockEnrollment is a mock of Enrollment interface.

func NewMockEnrollment

func NewMockEnrollment(ctrl *gomock.Controller) *MockEnrollment

NewMockEnrollment creates a new mock instance.

func (*MockEnrollment) CreateEnrollmentRequest

CreateEnrollmentRequest mocks base method.

func (*MockEnrollment) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockEnrollment) GetEnrollmentRequest

func (m *MockEnrollment) GetEnrollmentRequest(ctx context.Context, id string, cb ...client.RequestEditorFn) (*v1beta1.EnrollmentRequest, error)

GetEnrollmentRequest mocks base method.

func (*MockEnrollment) SetRPCMetricsCallback

func (m *MockEnrollment) SetRPCMetricsCallback(cb RPCMetricsCallback)

SetRPCMetricsCallback mocks base method.

type MockEnrollmentMockRecorder

type MockEnrollmentMockRecorder struct {
	// contains filtered or unexported fields
}

MockEnrollmentMockRecorder is the mock recorder for MockEnrollment.

func (*MockEnrollmentMockRecorder) CreateEnrollmentRequest

func (mr *MockEnrollmentMockRecorder) CreateEnrollmentRequest(ctx, req any, cb ...any) *gomock.Call

CreateEnrollmentRequest indicates an expected call of CreateEnrollmentRequest.

func (*MockEnrollmentMockRecorder) GetEnrollmentRequest

func (mr *MockEnrollmentMockRecorder) GetEnrollmentRequest(ctx, id any, cb ...any) *gomock.Call

GetEnrollmentRequest indicates an expected call of GetEnrollmentRequest.

func (*MockEnrollmentMockRecorder) SetRPCMetricsCallback

func (mr *MockEnrollmentMockRecorder) SetRPCMetricsCallback(cb any) *gomock.Call

SetRPCMetricsCallback indicates an expected call of SetRPCMetricsCallback.

type MockManagement

type MockManagement struct {
	// contains filtered or unexported fields
}

MockManagement is a mock of Management interface.

func NewMockManagement

func NewMockManagement(ctrl *gomock.Controller) *MockManagement

NewMockManagement creates a new mock instance.

func (*MockManagement) CreateCertificateSigningRequest added in v0.10.0

CreateCertificateSigningRequest mocks base method.

func (*MockManagement) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockManagement) GetCertificateSigningRequest added in v0.10.0

func (m *MockManagement) GetCertificateSigningRequest(ctx context.Context, name string, rcb ...client.RequestEditorFn) (*v1beta1.CertificateSigningRequest, int, error)

GetCertificateSigningRequest mocks base method.

func (*MockManagement) GetRenderedDevice added in v0.5.0

func (m *MockManagement) GetRenderedDevice(ctx context.Context, name string, params *v1beta1.GetRenderedDeviceParams, rcb ...client.RequestEditorFn) (*v1beta1.Device, int, error)

GetRenderedDevice mocks base method.

func (*MockManagement) PatchDeviceStatus added in v0.6.0

func (m *MockManagement) PatchDeviceStatus(ctx context.Context, name string, patch v1beta1.PatchRequest, rcb ...client.RequestEditorFn) error

PatchDeviceStatus mocks base method.

func (*MockManagement) SetRPCMetricsCallback added in v0.9.0

func (m *MockManagement) SetRPCMetricsCallback(cb RPCMetricsCallback)

SetRPCMetricsCallback mocks base method.

func (*MockManagement) UpdateDeviceStatus

func (m *MockManagement) UpdateDeviceStatus(ctx context.Context, name string, device v1beta1.Device, rcb ...client.RequestEditorFn) error

UpdateDeviceStatus mocks base method.

type MockManagementMockRecorder

type MockManagementMockRecorder struct {
	// contains filtered or unexported fields
}

MockManagementMockRecorder is the mock recorder for MockManagement.

func (*MockManagementMockRecorder) CreateCertificateSigningRequest added in v0.10.0

func (mr *MockManagementMockRecorder) CreateCertificateSigningRequest(ctx, csr any, rcb ...any) *gomock.Call

CreateCertificateSigningRequest indicates an expected call of CreateCertificateSigningRequest.

func (*MockManagementMockRecorder) GetCertificateSigningRequest added in v0.10.0

func (mr *MockManagementMockRecorder) GetCertificateSigningRequest(ctx, name any, rcb ...any) *gomock.Call

GetCertificateSigningRequest indicates an expected call of GetCertificateSigningRequest.

func (*MockManagementMockRecorder) GetRenderedDevice added in v0.5.0

func (mr *MockManagementMockRecorder) GetRenderedDevice(ctx, name, params any, rcb ...any) *gomock.Call

GetRenderedDevice indicates an expected call of GetRenderedDevice.

func (*MockManagementMockRecorder) PatchDeviceStatus added in v0.6.0

func (mr *MockManagementMockRecorder) PatchDeviceStatus(ctx, name, patch any, rcb ...any) *gomock.Call

PatchDeviceStatus indicates an expected call of PatchDeviceStatus.

func (*MockManagementMockRecorder) SetRPCMetricsCallback added in v0.9.0

func (mr *MockManagementMockRecorder) SetRPCMetricsCallback(cb any) *gomock.Call

SetRPCMetricsCallback indicates an expected call of SetRPCMetricsCallback.

func (*MockManagementMockRecorder) UpdateDeviceStatus

func (mr *MockManagementMockRecorder) UpdateDeviceStatus(ctx, name, device any, rcb ...any) *gomock.Call

UpdateDeviceStatus indicates an expected call of UpdateDeviceStatus.

type OCIDelta added in v1.4.0

type OCIDelta struct {
	// contains filtered or unexported fields
}

func NewOCIDelta added in v1.4.0

func NewOCIDelta(log *log.PrefixLogger, exec executer.Executer, timeout time.Duration) *OCIDelta

func (*OCIDelta) Apply added in v1.4.0

func (d *OCIDelta) Apply(ctx context.Context, deltaRef, dest string) error

Apply reconstructs an OCI image from a pulled delta artifact into dest. dest is an oci-delta output reference (oci:PATH or oci-archive:PATH).

func (*OCIDelta) ApplyFromDirectory added in v1.4.0

func (d *OCIDelta) ApplyFromDirectory(ctx context.Context, sourceDir, deltaRef, dest string) error

ApplyFromDirectory reconstructs an OCI image from a delta using source content in an unpacked root filesystem. dest is an oci-delta output reference (oci:PATH or oci-archive:PATH).

func (*OCIDelta) Import added in v1.4.0

func (d *OCIDelta) Import(ctx context.Context, deltaRef, targetRef string) error

Import reconstructs an OCI image directly in containers/storage. An empty targetRef imports the image without assigning it a name.

func (*OCIDelta) SourceImageDigests added in v1.4.0

func (d *OCIDelta) SourceImageDigests(ctx context.Context) (map[string]struct{}, error)

SourceImageDigests returns cached host image digests in the OSTree repository used by Apply. It does not consult the separate application containers/storage store.

func (*OCIDelta) SourceImageExists added in v1.4.0

func (d *OCIDelta) SourceImageExists(ctx context.Context, sourceDigest string) (bool, error)

SourceImageExists checks cached host images in the OSTree repository used by Apply.

type OCIDeltaFactory added in v1.4.0

type OCIDeltaFactory func(v1beta1.Username) (*OCIDelta, error)

OCIDeltaFactory creates an OCI delta client for the given storage owner.

func NewOCIDeltaFactory added in v1.4.0

func NewOCIDeltaFactory(log *log.PrefixLogger, timeout time.Duration) OCIDeltaFactory

NewOCIDeltaFactory creates OCI delta clients that run as the storage owner.

type OCIDescriptor added in v1.0.0

type OCIDescriptor struct {
	MediaType string `json:"mediaType"`
	Digest    string `json:"digest"`
	Size      int64  `json:"size"`
}

OCIDescriptor represents a content descriptor in an OCI manifest

type OCIIndex added in v1.4.0

type OCIIndex struct {
	SchemaVersion int           `json:"schemaVersion"`
	MediaType     string        `json:"mediaType,omitempty"`
	Manifests     []OCIReferrer `json:"manifests"`
}

OCIIndex is an OCI image index, including Referrers results.

type OCIManifest added in v1.0.0

type OCIManifest struct {
	MediaType    string            `json:"mediaType"`
	ArtifactType string            `json:"artifactType,omitempty"`
	Subject      *OCIDescriptor    `json:"subject,omitempty"`
	Annotations  map[string]string `json:"annotations,omitempty"`
	Config       *OCIDescriptor    `json:"config,omitempty"`
	Layers       []OCIDescriptor   `json:"layers,omitempty"`
	Manifests    json.RawMessage   `json:"manifests,omitempty"`
}

OCIManifest represents the minimal OCI manifest structure needed for type detection

type OCIPlatformReferrers added in v1.4.0

type OCIPlatformReferrers struct {
	TargetDigest string
	Referrers    *OCIIndex
}

OCIPlatformReferrers ties a referrer index to the exact platform manifest digest used to query it.

type OCIReferrer added in v1.4.0

type OCIReferrer struct {
	MediaType    string            `json:"mediaType"`
	Digest       string            `json:"digest"`
	Size         int64             `json:"size"`
	ArtifactType string            `json:"artifactType,omitempty"`
	Annotations  map[string]string `json:"annotations,omitempty"`
}

OCIReferrer is a descriptor in a Referrers index.

type Podman added in v0.3.0

type Podman struct {
	// contains filtered or unexported fields
}

func NewPodman added in v0.3.0

func NewPodman(log *log.PrefixLogger, exec executer.Executer, readWriter fileio.ReadWriter, backoff poll.Config) *Podman

func (*Podman) ArtifactDigest added in v1.0.0

func (p *Podman) ArtifactDigest(ctx context.Context, reference string) (string, error)

ArtifactDigest returns the digest of the specified artifact.

func (*Podman) ArtifactExists added in v0.9.0

func (p *Podman) ArtifactExists(ctx context.Context, artifact string) bool

ArtifactExists returns true if the artifact exists in storage otherwise false.

func (*Podman) Compose added in v0.3.0

func (p *Podman) Compose() *Compose

func (*Podman) Copy added in v0.3.0

func (p *Podman) Copy(ctx context.Context, src, dst string) error

func (*Podman) CopyContainerData added in v0.6.0

func (p *Podman) CopyContainerData(ctx context.Context, image, destPath string) error

func (*Podman) CreateVolume added in v0.8.1

func (p *Podman) CreateVolume(ctx context.Context, name string, labels []string) (string, error)

func (*Podman) EnsureArtifactSupport added in v1.0.0

func (p *Podman) EnsureArtifactSupport(ctx context.Context) error

EnsureArtifactSupport verifies the local podman version can execute artifact commands.

func (*Podman) EventsSinceCmd added in v0.3.0

func (p *Podman) EventsSinceCmd(ctx context.Context, events []string, sinceTime string) *exec.Cmd

EventsSinceCmd returns a command to get podman events since the given time. After creating the command, it should be started with exec.Start(). When the events are in sync with the current time a sync event is emitted.

func (*Podman) Exec added in v1.3.0

func (p *Podman) Exec(ctx context.Context, containerName string, cmd ...string) error

Exec runs a short-lived `podman exec <containerName> <cmd...>` and returns an error when the command exits non-zero. Used by console sessions to reap leftover in-container clients that survive host-side podman exec teardown.

func (*Podman) ExecInContainer added in v1.3.0

func (p *Podman) ExecInContainer(ctx context.Context, container string, args ...string) (string, string, int)

ExecInContainer runs the given command inside a container via `podman exec` and returns stdout, stderr, and the exit code.

func (*Podman) ExecStream added in v1.3.0

func (p *Podman) ExecStream(ctx context.Context, containerName string, cmd ...string) (io.ReadWriteCloser, error)

ExecStream starts `podman exec -i <containerName> <cmd...>` and returns the process's stdin/stdout as an io.ReadWriteCloser. Caller must Close() to release resources.

func (*Podman) ExtractArtifact added in v0.8.1

func (p *Podman) ExtractArtifact(ctx context.Context, artifact, destination string) (string, error)

ExtractArtifact to the given destination, which should be an already existing directory if the artifact contains multiple layers, otherwise podman will extract a single layer in the artifact to the destination path directly as a file.

See https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidelines-for-artifact-usage for details on the expected structure of artifacts. Regular images are considered artifacts by podman due to the intentional looseness of the spec.

func (*Podman) GetImageCopyTmpDir added in v0.9.0

func (p *Podman) GetImageCopyTmpDir(ctx context.Context) (string, error)

GetImageCopyTmpDir returns the image copy tmp dir exposed by the podman info API.

func (*Podman) ImageDigest added in v1.0.0

func (p *Podman) ImageDigest(ctx context.Context, image string) (string, error)

ImageDigest returns the digest of the specified image. Returns empty string and error if the image does not exist or cannot be inspected.

func (*Podman) ImageDigests added in v1.4.0

func (p *Podman) ImageDigests(ctx context.Context, image string) ([]string, error)

ImageDigests returns the content digest and repository digests of the specified image. Repo digests are needed to compare local images with a registry's manifest digest.

func (*Podman) ImageExists added in v0.3.0

func (p *Podman) ImageExists(ctx context.Context, image string) bool

func (*Podman) ImageID added in v1.4.0

func (p *Podman) ImageID(ctx context.Context, image string) (string, error)

ImageID returns the immutable local identity selected by an image reference. Callers use it transiently to inspect held content independently of moved tags.

func (*Podman) ImageMetadata added in v1.4.0

func (p *Podman) ImageMetadata(ctx context.Context, image string) (PodmanImageMetadata, error)

ImageMetadata returns the local image ID, content digest, and repository digests.

func (*Podman) ImmutableArtifactReference added in v1.4.0

func (p *Podman) ImmutableArtifactReference(ctx context.Context, reference string) (string, string, error)

ImmutableArtifactReference resolves a local artifact to a validated, digest-pinned reference and the manifest digest used for extraction.

func (*Podman) Inspect added in v0.3.0

func (p *Podman) Inspect(ctx context.Context, image string) (string, error)

Inspect returns the JSON output of the image inspection. The expectation is that the image exists in local container storage.

func (*Podman) InspectArtifactAnnotations added in v1.0.0

func (p *Podman) InspectArtifactAnnotations(ctx context.Context, reference string) (map[string]string, error)

InspectArtifactAnnotations inspects an OCI artifact and returns its annotations map.

func (*Podman) InspectLabels added in v0.3.0

func (p *Podman) InspectLabels(ctx context.Context, image string) (map[string]string, error)

func (*Podman) InspectVolume added in v1.4.0

func (p *Podman) InspectVolume(ctx context.Context, name string) (*PodmanVolumeInspect, error)

InspectVolume returns only public Podman volume fields. In particular, it does not infer an image ID from StorageID or inspect Podman's private state.

func (*Podman) InspectVolumeDriver added in v1.0.0

func (p *Podman) InspectVolumeDriver(ctx context.Context, name string) (string, error)

func (*Podman) InspectVolumeMount added in v0.8.1

func (p *Podman) InspectVolumeMount(ctx context.Context, name string) (string, error)

func (*Podman) InspectVolumeOptionType added in v1.3.0

func (p *Podman) InspectVolumeOptionType(ctx context.Context, name string) (string, error)

InspectVolumeOptionType returns the volume's "type" mount option (e.g. "tmpfs" for a tmpfs-backed local volume), or an empty string if not set.

func (*Podman) ListArtifacts added in v1.1.0

func (p *Podman) ListArtifacts(ctx context.Context) ([]string, error)

ListArtifacts returns a list of all OCI artifacts stored on the device.

func (*Podman) ListImageDigests added in v1.4.0

func (p *Podman) ListImageDigests(ctx context.Context) ([]string, error)

ListImageDigests returns the content and repository digests for all images with one Podman invocation.

func (*Podman) ListImages added in v1.1.0

func (p *Podman) ListImages(ctx context.Context) ([]string, error)

ListImages returns a list of all container images stored on the device. Returns image references in the format "repository:tag" or image ID for untagged images.

func (*Podman) ListNetworks added in v0.3.0

func (p *Podman) ListNetworks(ctx context.Context, labels []string, filters []string) ([]string, error)

func (*Podman) ListPods added in v1.0.0

func (p *Podman) ListPods(ctx context.Context, labels []string) ([]string, error)

func (*Podman) ListVolumes added in v1.0.0

func (p *Podman) ListVolumes(ctx context.Context, labels []string, filters []string) ([]string, error)

func (*Podman) Mount added in v0.3.0

func (p *Podman) Mount(ctx context.Context, image string) (string, error)

func (*Podman) Pull added in v0.3.0

func (p *Podman) Pull(ctx context.Context, image string, opts ...ClientOption) (string, error)

Pull pulls an image from the registry with optional retry and authentication via a pull secret. Logs progress periodically while the operation is in progress.

func (*Podman) PullArtifact added in v0.8.1

func (p *Podman) PullArtifact(ctx context.Context, artifact string, opts ...ClientOption) (string, error)

PullArtifact pulls an artifact from the registry with optional retry and authentication via a pull secret. Logs progress periodically while the operation is in progress.

func (*Podman) RemoveArtifact added in v1.1.0

func (p *Podman) RemoveArtifact(ctx context.Context, artifact string) error

RemoveArtifact removes the specified OCI artifact from Podman. Returns an error if the removal fails. Handles non-existent artifacts gracefully.

func (*Podman) RemoveContainer added in v0.3.0

func (p *Podman) RemoveContainer(ctx context.Context, labels []string) error

func (*Podman) RemoveImage added in v1.1.0

func (p *Podman) RemoveImage(ctx context.Context, image string) error

RemoveImage removes the specified container image from Podman. Returns an error if the removal fails. Handles non-existent images gracefully.

func (*Podman) RemoveNetworks added in v0.3.0

func (p *Podman) RemoveNetworks(ctx context.Context, networks ...string) error

func (*Podman) RemovePods added in v1.0.0

func (p *Podman) RemovePods(ctx context.Context, pods ...string) error

func (*Podman) RemoveVolumes added in v0.3.0

func (p *Podman) RemoveVolumes(ctx context.Context, volumes ...string) error

func (*Podman) StopContainers added in v0.3.0

func (p *Podman) StopContainers(ctx context.Context, labels []string) error

func (*Podman) Tag added in v1.4.0

func (p *Podman) Tag(ctx context.Context, source, target string) error

Tag binds an existing local image identity to another local image reference.

func (*Podman) Unmount added in v0.3.0

func (p *Podman) Unmount(ctx context.Context, image string) error

func (*Podman) Unshare added in v0.3.0

func (p *Podman) Unshare(ctx context.Context, args ...string) (string, error)

func (*Podman) Version added in v0.8.1

func (p *Podman) Version(ctx context.Context) (*PodmanVersion, error)

Version returns the major and monor versions of podman.

func (*Podman) VolumeExists added in v0.8.1

func (p *Podman) VolumeExists(ctx context.Context, name string) bool

type PodmanContainerConfig added in v0.6.0

type PodmanContainerConfig struct {
	Labels map[string]string `json:"Labels"`
}

type PodmanContainerIdentity added in v1.4.0

type PodmanContainerIdentity struct {
	ID          string `json:"Id"`
	IsInfra     bool   `json:"IsInfra"`
	Image       string `json:"Image"`
	ImageDigest string `json:"ImageDigest"`
}

PodmanContainerIdentity retains only image evidence from a create-event snapshot. Podman encodes ContainerInspectData as a JSON string containing inspect JSON.

func (*PodmanContainerIdentity) UnmarshalJSON added in v1.4.0

func (identity *PodmanContainerIdentity) UnmarshalJSON(data []byte) error

type PodmanContainerState added in v0.6.0

type PodmanContainerState struct {
	OciVersion  string `json:"OciVersion"`
	Status      string `json:"Status"`
	Running     bool   `json:"Running"`
	Paused      bool   `json:"Paused"`
	Restarting  bool   `json:"Restarting"`
	OOMKilled   bool   `json:"OOMKilled"`
	Dead        bool   `json:"Dead"`
	Pid         int    `json:"Pid"`
	ExitCode    int    `json:"ExitCode"`
	Error       string `json:"Error"`
	StartedAt   string `json:"StartedAt"`
	FinishedAt  string `json:"FinishedAt"`
	Healthcheck string `json:"Healthcheck"`
}

ContainerState represents the container state part of the podman inspect output

type PodmanEvent added in v0.6.0

type PodmanEvent struct {
	// StoreOwner is attached by the watcher, never trusted from event JSON.
	StoreOwner           *v1beta1.Username        `json:"-"`
	ContainerInspectData *PodmanContainerIdentity `json:"ContainerInspectData,omitempty"`
	ContainerExitCode    *int                     `json:"ContainerExitCode,omitempty"`
	ID                   string                   `json:"ID"`
	Image                string                   `json:"Image"`
	Name                 string                   `json:"Name"`
	Status               string                   `json:"Status"`
	Type                 string                   `json:"Type"`
	TimeNano             int64                    `json:"timeNano"`
	HealthStatus         string                   `json:"health_status,omitempty"`
	Attributes           map[string]string        `json:"Attributes"`
}

PodmanEvent represents the structure of a podman event as produced via a CLI events command. It should be noted that the CLI represents events differently from libpod. (notably the time properties) https://github.com/containers/podman/blob/main/cmd/podman/system/events.go#L81-L96

type PodmanFactory added in v1.1.0

type PodmanFactory func(user v1beta1.Username) (*Podman, error)

PodmanFactory creates a podman client. A blank username means to use the process user.

func NewPodmanFactory added in v1.1.0

func NewPodmanFactory(log *log.PrefixLogger, backoff poll.Config, rwFactory fileio.ReadWriterFactory) PodmanFactory

type PodmanImageMetadata added in v1.4.0

type PodmanImageMetadata struct {
	ID          string   `json:"Id"`
	Digest      string   `json:"Digest"`
	RepoDigests []string `json:"RepoDigests"`
}

PodmanImageMetadata is the digest and runtime identity reported by Podman.

func (PodmanImageMetadata) Digests added in v1.4.0

func (m PodmanImageMetadata) Digests() []string

Digests returns the content digest and repository digests reported by Podman.

type PodmanInspect added in v0.6.0

type PodmanInspect struct {
	IsInfra     bool                  `json:"IsInfra"`
	Image       string                `json:"Image"`
	ImageDigest string                `json:"ImageDigest"`
	Restarts    int                   `json:"RestartCount"`
	State       PodmanContainerState  `json:"State"`
	Config      PodmanContainerConfig `json:"Config"`
}

PodmanInspect represents the overall structure of podman inspect output

type PodmanVersion added in v0.8.1

type PodmanVersion struct {
	Major int
	Minor int
}

func (PodmanVersion) GreaterOrEqual added in v0.8.1

func (v PodmanVersion) GreaterOrEqual(major, minor int) bool

type PodmanVolumeInspect added in v1.4.0

type PodmanVolumeInspect struct {
	Name      string            `json:"Name"`
	Driver    string            `json:"Driver"`
	CreatedAt string            `json:"CreatedAt"`
	Labels    map[string]string `json:"Labels"`
	Options   map[string]string `json:"Options"`
}

PodmanVolumeInspect contains the public volume identity needed to associate an application volume with installed image content. It intentionally omits Podman's private storage-image identity.

type RPCMetricsCallback added in v0.9.0

type RPCMetricsCallback func(operation string, durationSeconds float64, err error)

RPCMetricsCallback defines the signature for RPC metrics callback functions.

type RPMOSTree added in v0.4.0

type RPMOSTree struct {
	// contains filtered or unexported fields
}

func NewRPMOSTree added in v0.4.0

func NewRPMOSTree(exec executer.Executer) *RPMOSTree

NewRPMOSTree creates a new rpm-ostree client.

func (*RPMOSTree) Apply added in v0.4.0

func (c *RPMOSTree) Apply(ctx context.Context) error

func (*RPMOSTree) RemoveRollback added in v0.4.0

func (c *RPMOSTree) RemoveRollback(_ context.Context) error

func (*RPMOSTree) RemoveStaged added in v0.4.0

func (c *RPMOSTree) RemoveStaged(_ context.Context) error

func (*RPMOSTree) Rollback added in v1.2.0

func (c *RPMOSTree) Rollback(ctx context.Context) error

func (*RPMOSTree) Status added in v0.4.0

func (c *RPMOSTree) Status(_ context.Context) (*container.BootcHost, error)

func (*RPMOSTree) Switch added in v0.4.0

func (c *RPMOSTree) Switch(_ context.Context, target string) error

type Reloadable added in v1.1.0

type Reloadable interface {
	Reload() error
}

Reloadable is an optional interface that callers can use to force recreating the underlying client (e.g., after rotating client TLS certs).

type ResponseHook added in v0.10.0

type ResponseHook func(resp *http.Response, attempt int) bool

ResponseHook is called before retry decision is made Return true to continue with retry logic, false to stop retrying

type RetryTransport added in v0.10.0

type RetryTransport struct {
	// contains filtered or unexported fields
}

func NewRetryTransport added in v0.10.0

func NewRetryTransport(transport http.RoundTripper, log *log.PrefixLogger, pollConfig poll.Config) *RetryTransport

func (*RetryTransport) RoundTrip added in v0.10.0

func (r *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Skopeo added in v1.0.0

type Skopeo struct {
	// contains filtered or unexported fields
}

func NewSkopeo added in v1.0.0

func NewSkopeo(log *log.PrefixLogger, exec executer.Executer, readWriter fileio.ReadWriter) *Skopeo

func (*Skopeo) Copy added in v1.4.0

func (s *Skopeo) Copy(ctx context.Context, src, dest string, opts ...ClientOption) error

func (*Skopeo) CopyPreservingDigests added in v1.4.0

func (s *Skopeo) CopyPreservingDigests(ctx context.Context, src, dest string, opts ...ClientOption) error

CopyPreservingDigests copies an image while requiring its manifest digest to remain unchanged. It is used for local activation of already pinned content.

func (*Skopeo) InspectDigest added in v1.4.0

func (s *Skopeo) InspectDigest(ctx context.Context, image string, opts ...ClientOption) (string, error)

InspectDigest returns the manifest digest of image.

func (*Skopeo) InspectManifest added in v1.0.0

func (s *Skopeo) InspectManifest(ctx context.Context, image string, opts ...ClientOption) (*OCIManifest, error)

InspectManifest inspects an OCI image or artifact and returns the deserialized manifest. This is used to determine if a reference is an image or an artifact.

func (*Skopeo) InspectPlatformDigest added in v1.4.0

func (s *Skopeo) InspectPlatformDigest(ctx context.Context, image string, opts ...ClientOption) (string, error)

InspectPlatformDigest resolves an image index to the manifest for this host. Single-image manifests return their own content digest.

func (*Skopeo) ListPlatformReferrers added in v1.4.0

func (s *Skopeo) ListPlatformReferrers(ctx context.Context, image string, opts ...ClientOption) (*OCIPlatformReferrers, error)

ListPlatformReferrers resolves image to the host platform manifest and lists referrers for that exact manifest digest.

func (*Skopeo) ListReferrers added in v1.4.0

func (s *Skopeo) ListReferrers(ctx context.Context, image string, opts ...ClientOption) (*OCIIndex, error)

ListReferrers returns the referrers index for image. On Referrers-API 404, unknown subcommand, or manifest unknown, it inspects the Referrers Tag Schema tag on the same repository.

type SkopeoFactory added in v1.1.0

type SkopeoFactory func(v1beta1.Username) (*Skopeo, error)

SkopeoFactory creates a skopeo client. A blank username means to use the process user.

func NewSkopeoFactory added in v1.1.0

func NewSkopeoFactory(log *log.PrefixLogger, rwFactory fileio.ReadWriterFactory) SkopeoFactory

type SystemDUnitListEntry added in v1.0.0

type SystemDUnitListEntry struct {
	Unit        string `json:"unit"`
	LoadState   string `json:"load"`
	ActiveState string `json:"active"`
	SubState    string `json:"sub"`
	Description string `json:"description"`
}

type Systemd

type Systemd struct {
	// contains filtered or unexported fields
}

func NewSystemd

func NewSystemd(exec executer.Executer, user v1beta1.Username) *Systemd

func (*Systemd) DaemonReload

func (s *Systemd) DaemonReload(ctx context.Context) error

func (*Systemd) Disable

func (s *Systemd) Disable(ctx context.Context, name string) error

func (*Systemd) Enable

func (s *Systemd) Enable(ctx context.Context, name string) error

func (*Systemd) IsActive added in v1.1.0

func (s *Systemd) IsActive(ctx context.Context, name string) (bool, error)

IsActive checks if a systemd unit is currently active. Returns true if the unit is active, false otherwise.

func (*Systemd) IsEnabled added in v1.1.3

func (s *Systemd) IsEnabled(ctx context.Context, name string) (bool, error)

IsEnabled checks if a systemd unit is enabled (will start on boot). Returns true for enabled, enabled-runtime, static, indirect, and generated states. Returns false for disabled, masked, and not-found states.

func (*Systemd) ListDependencies added in v1.0.0

func (s *Systemd) ListDependencies(ctx context.Context, unit string) ([]string, error)

ListDependencies returns the list of units that the specified unit depends on. Uses `systemctl list-dependencies --plain --full` to get a flat list of dependencies. The --full flag prevents systemd from truncating long unit names.

func (*Systemd) ListJobs added in v0.10.0

func (s *Systemd) ListJobs(ctx context.Context) ([]SystemdJob, error)

ListJobs lists current systemd jobs in progress This is more reliable than is-active for detecting pending shutdown/reboot

func (*Systemd) ListUnitsByMatchPattern added in v0.4.0

func (s *Systemd) ListUnitsByMatchPattern(ctx context.Context, matchPatterns []string) ([]SystemDUnitListEntry, error)

func (*Systemd) Reboot added in v0.4.0

func (s *Systemd) Reboot(ctx context.Context) error

func (*Systemd) Reload

func (s *Systemd) Reload(ctx context.Context, name string) error

func (*Systemd) ResetFailed added in v1.0.0

func (s *Systemd) ResetFailed(ctx context.Context, units ...string) error

func (*Systemd) Restart

func (s *Systemd) Restart(ctx context.Context, name string) error

func (*Systemd) SdNotify added in v1.1.0

func (s *Systemd) SdNotify(ctx context.Context, messages ...string) error

SdNotify sends notification messages to systemd via the NOTIFY_SOCKET. The socket path is captured when NewSystemd is called, before bootstrap unsets it.

func (*Systemd) Show added in v1.0.0

func (s *Systemd) Show(ctx context.Context, unit string, opts ...SystemdShowOptions) ([]string, error)

func (*Systemd) ShowByMatchPattern added in v1.0.0

func (s *Systemd) ShowByMatchPattern(ctx context.Context, matchPatterns []string) ([]map[string]string, error)

func (*Systemd) Start

func (s *Systemd) Start(ctx context.Context, units ...string) error

func (*Systemd) Stop

func (s *Systemd) Stop(ctx context.Context, units ...string) error

type SystemdJob added in v0.10.0

type SystemdJob struct {
	Job     string
	Unit    string
	JobType string
	State   string
}

SystemdJob represents a systemd job from list-jobs

type SystemdShowOptions added in v1.0.0

type SystemdShowOptions func(*systemdShowOpts)

func WithShowLoadState added in v1.0.0

func WithShowLoadState() SystemdShowOptions

func WithShowRestarts added in v1.0.0

func WithShowRestarts() SystemdShowOptions

Jump to

Keyboard shortcuts

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