Documentation
¶
Overview ¶
Package buildkit provides a component for managing a persistent BuildKit daemon using containerd. BuildKit is used for building container images with layer caching across builds.
Index ¶
- type Component
- func (c *Component) Client(ctx context.Context) (*buildkitclient.Client, error)
- func (c *Component) IsRunning() bool
- func (c *Component) SetRegistryIP(ip string) error
- func (c *Component) SocketPath() string
- func (c *Component) Start(ctx context.Context, config Config) error
- func (c *Component) Stop(ctx context.Context) error
- type Config
- type TracesExport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct {
Log *slog.Logger
CC *containerd.Client
Namespace string
DataPath string
// contains filtered or unexported fields
}
Component manages a persistent BuildKit daemon as a containerd container, or connects to an external BuildKit daemon via Unix socket.
func NewComponent ¶
NewComponent creates a new BuildKit component that manages an embedded daemon.
func NewExternalComponent ¶
NewExternalComponent creates a BuildKit component that connects to an external daemon. No container lifecycle management is performed - it only provides client access.
func (*Component) SetRegistryIP ¶
SetRegistryIP updates the hosts file with the registry IP address for cluster.local. This can be called after Start() once the registry IP is known.
func (*Component) SocketPath ¶
SocketPath returns the path to the BuildKit Unix socket.
type Config ¶
type Config struct {
// SocketDir is the directory where the Unix socket will be created (e.g., /run/miren/buildkit)
SocketDir string
// RegistryIP is the IP address for cluster.local registry (optional, can be set later via SetRegistryIP)
RegistryIP string
// GCKeepStorage is the maximum bytes of cache to keep (default: 10GB)
GCKeepStorage int64
// GCKeepDuration is how long to keep cache entries in seconds (default: 7 days)
GCKeepDuration int64
// RegistryHost is the hostname for the cluster-local registry (e.g., cluster.local:5000)
RegistryHost string
// DNSNameservers are the nameserver addresses build steps resolve against.
// See generateConfig for why we override buildkit's default here.
DNSNameservers []string
// Traces is where buildkitd exports its spans.
Traces TracesExport
}
Config contains configuration for the BuildKit component.
type TracesExport ¶ added in v0.17.0
type TracesExport struct {
// Endpoint replaces OTEL_EXPORTER_OTLP_ENDPOINT, for a destination that
// came from server config rather than the env.
Endpoint string
// Relayed means Endpoint is the server's loopback relay, which holds the
// credentials. buildkitd lives far longer than a workload identity token
// and has no way to refresh one, so it gets no collector credentials at
// all, only RelaySecret, and speaks the only protocol the relay does.
Relayed bool
// RelaySecret is what the relay requires of its callers. It is stable
// across server restarts, so it doesn't make buildkitd's container churn.
RelaySecret string
// Disabled keeps buildkitd from exporting traces. It is what traces get
// when they need a token and the relay isn't there to supply one: better
// no build spans than a static credential the operator asked to retire.
Disabled bool
}
TracesExport says where buildkitd sends its spans, as the server resolved it. The zero value forwards the server's OTel env untouched.