Documentation
¶
Index ¶
- Variables
- func HTTPBootPathFromMetadata(meta *ImageMetadata) string
- func JoinServeURLPath(serveURL, path string) (string, error)
- type ClusterInfo
- type ClusterInfoProvider
- type FileResolver
- func (f *FileResolver) HTTPBootPath(node *v1alpha3.Machine) (string, error)
- func (f *FileResolver) HTTPBootURL(node *v1alpha3.Machine) (string, error)
- func (f *FileResolver) LookupNodeByIP(ctx context.Context, ip string) (*v1alpha3.Machine, error)
- func (f *FileResolver) NetbootImageRef(node *v1alpha3.Machine) string
- func (f *FileResolver) ResolveFileByPath(ctx context.Context, path string, node *v1alpha3.Machine, imageRef string) (*ResolvedFile, error)
- func (f *FileResolver) ResolveFileByPathForIP(ctx context.Context, path string, node *v1alpha3.Machine, ...) (*ResolvedFile, error)
- type HTTPServer
- type ImageMetadata
- type MediaProvider
- func (p *MediaProvider) LookupAttestationMachine(r *http.Request) (*v1alpha3.Machine, error)
- func (p *MediaProvider) OpenISO(ctx context.Context, name string) (*os.File, error)
- func (p *MediaProvider) Prepare(ctx context.Context, machine *v1alpha3.Machine, op *v1alpha3.MachineOperation, ...) (bootmedia.Source, error)
- func (p *MediaProvider) Release(_ context.Context, id string) error
- func (p *MediaProvider) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type OCICache
- func (c *OCICache) DigestFor(imageRef string) string
- func (c *OCICache) DigestForArchitecture(imageRef, architecture string) string
- func (c *OCICache) DiskDir(digest string) string
- func (c *OCICache) DiskDirForArchitecture(digest, architecture string) string
- func (c *OCICache) ImageDir(digest string) string
- func (c *OCICache) ImageDirForArchitecture(digest, architecture string) string
- func (c *OCICache) InvalidateRef(imageRef string)
- func (c *OCICache) InvalidateRefForArchitecture(imageRef, architecture string)
- func (c *OCICache) IsCached(digest string) bool
- func (c *OCICache) IsCachedForArchitecture(digest, architecture string) bool
- func (c *OCICache) Metadata(digest string) (*ImageMetadata, error)
- func (c *OCICache) MetadataForArchitecture(digest, architecture string) (*ImageMetadata, error)
- func (c *OCICache) MetadataForRef(imageRef string) (*ImageMetadata, error)
- func (c *OCICache) MetadataForRefArchitecture(imageRef, architecture string) (*ImageMetadata, error)
- func (c *OCICache) ResolvePath(imageRef, reqPath string) (diskPath string, isTemplate bool, err error)
- func (c *OCICache) ResolvePathForArchitecture(imageRef, architecture, reqPath string) (diskPath string, isTemplate bool, err error)
- func (c *OCICache) SetDigest(imageRef, digest string)
- func (c *OCICache) SetDigestForArchitecture(imageRef, architecture, digest string)
- type OCIReconciler
- type ResolvedFile
- type StaticClusterInfo
- type StatusRecorder
- type TFTPServer
- type TFTPStatusRecorder
Constants ¶
This section is empty.
Variables ¶
var ErrNotYetDownloaded = fmt.Errorf("file not yet downloaded")
ErrNotYetDownloaded is returned when an OCI image has not yet been pulled and unpacked to the local cache.
Functions ¶
func HTTPBootPathFromMetadata ¶ added in v0.1.20
func HTTPBootPathFromMetadata(meta *ImageMetadata) string
func JoinServeURLPath ¶ added in v0.1.20
Types ¶
type ClusterInfo ¶
ClusterInfo holds the API server URL and CA certificate discovered from the cluster-info ConfigMap in kube-public. These values may change at runtime (e.g. API server URL rotation), so they are provided through ClusterInfoProvider rather than stored statically.
type ClusterInfoProvider ¶
type ClusterInfoProvider interface {
ClusterInfo() ClusterInfo
}
ClusterInfoProvider returns the current cluster-info snapshot. Implementations should be safe for concurrent use.
type FileResolver ¶
type FileResolver struct {
Cache *OCICache
Reader client.Reader
Cluster ClusterInfoProvider
ServeURL string
DefaultNetbootRef string
KubernetesVersion string
ClusterDNS string
ProviderLabels map[string]string
}
func (*FileResolver) HTTPBootPath ¶ added in v0.1.20
func (f *FileResolver) HTTPBootPath(node *v1alpha3.Machine) (string, error)
func (*FileResolver) HTTPBootURL ¶ added in v0.1.20
func (f *FileResolver) HTTPBootURL(node *v1alpha3.Machine) (string, error)
func (*FileResolver) LookupNodeByIP ¶
func (*FileResolver) NetbootImageRef ¶ added in v0.1.20
func (f *FileResolver) NetbootImageRef(node *v1alpha3.Machine) string
func (*FileResolver) ResolveFileByPath ¶
func (f *FileResolver) ResolveFileByPath(ctx context.Context, path string, node *v1alpha3.Machine, imageRef string) (*ResolvedFile, error)
func (*FileResolver) ResolveFileByPathForIP ¶ added in v0.1.21
func (f *FileResolver) ResolveFileByPathForIP(ctx context.Context, path string, node *v1alpha3.Machine, imageRef, requestIP string) (*ResolvedFile, error)
type HTTPServer ¶
type HTTPServer struct {
BindAddr string
Port int
Client client.Client
Mux *http.ServeMux
FileResolver
StatusRecorder StatusRecorder
Media *MediaProvider
}
func (*HTTPServer) NeedLeaderElection ¶
func (h *HTTPServer) NeedLeaderElection() bool
type ImageMetadata ¶
type MediaProvider ¶ added in v0.15.0
type MediaProvider struct {
// Site must match the frozen media site exactly; empty is not a wildcard.
Site string
Resolver *FileResolver
Client client.Client
CacheDir string
TFTPServer string
// Run optionally replaces the bounded command runner for tests.
Run func(context.Context, string, ...string) error
// contains filtered or unexported fields
}
MediaProvider builds operation-owned hybrid ISOs (El Torito plus GPT ESP). Configure Site, Resolver, Client (an uncached API client), CacheDir, and an advertised IPv4 TFTPServer. Share this instance through HTTPServer.Media and TFTPServer.Media. The controller must persist BootMedia and digest-pinned Netboot inputs first. Tokens are capabilities on the isolated management/provisioning network; TFTP has no source authentication. HTTP config and callbacks also require the first frozen lease's source IP, without trusting forwarding headers.
func (*MediaProvider) LookupAttestationMachine ¶ added in v0.15.0
LookupAttestationMachine uses direct-peer media ownership before legacy IP lookup. Unlike datasource lookup, it returns the live Machine spec for status updates.
func (*MediaProvider) OpenISO ¶ added in v0.15.0
OpenISO authorizes a rack TFTP request before any host source-IP lookup.
func (*MediaProvider) Release ¶ added in v0.15.0
func (p *MediaProvider) Release(_ context.Context, id string) error
Release removes only local bytes. Durable Cleaned/terminal state revokes the capability and must be saved by the controller before calling Release.
func (*MediaProvider) ServeHTTP ¶ added in v0.15.0
func (p *MediaProvider) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves only operation-scoped control requests. Ordinary artifact downloads stay on the HTTP root, where frozen media lease claims take precedence over the host source-IP lookup, including revoked claims.
type OCICache ¶
type OCICache struct {
CacheDir string
// contains filtered or unexported fields
}
OCICache manages unpacked OCI images on the local filesystem. Images are stored under {cacheDir}/oci/{digest}/{architecture}/disk/... This follows the kubevirt containerDisk convention where image contents live under /disk/ in the OCI layer.
func NewOCICache ¶
func (*OCICache) DigestForArchitecture ¶ added in v0.1.20
func (*OCICache) DiskDirForArchitecture ¶ added in v0.1.20
DiskDirForArchitecture returns the /disk/ directory for a cached image.
func (*OCICache) ImageDirForArchitecture ¶ added in v0.1.20
ImageDirForArchitecture returns the base directory for a cached image by digest and target architecture.
func (*OCICache) InvalidateRef ¶
InvalidateRef removes the digest mapping for an image reference, so it will be re-pulled on next reconcile.
func (*OCICache) InvalidateRefForArchitecture ¶ added in v0.1.20
InvalidateRefForArchitecture removes the digest mapping for an image reference and target architecture, so it will be re-pulled on next reconcile.
func (*OCICache) IsCachedForArchitecture ¶ added in v0.1.20
IsCachedForArchitecture returns true if the image digest is already unpacked locally.
func (*OCICache) Metadata ¶
func (c *OCICache) Metadata(digest string) (*ImageMetadata, error)
Metadata returns the parsed metadata.yaml for a cached image, reading it from disk and caching in memory on first access.
func (*OCICache) MetadataForArchitecture ¶ added in v0.1.20
func (c *OCICache) MetadataForArchitecture(digest, architecture string) (*ImageMetadata, error)
MetadataForArchitecture returns the parsed metadata.yaml for a cached image.
func (*OCICache) MetadataForRef ¶
func (c *OCICache) MetadataForRef(imageRef string) (*ImageMetadata, error)
MetadataForRef returns the metadata for an image reference by resolving its digest first.
func (*OCICache) MetadataForRefArchitecture ¶ added in v0.1.20
func (c *OCICache) MetadataForRefArchitecture(imageRef, architecture string) (*ImageMetadata, error)
MetadataForRefArchitecture returns the metadata for an image reference and target architecture by resolving its digest first.
func (*OCICache) ResolvePath ¶
func (c *OCICache) ResolvePath(imageRef, reqPath string) (diskPath string, isTemplate bool, err error)
ResolvePath looks for a file at the given path under the disk directory for the given image reference. It follows the .tmpl convention: if the path doesn't end in .tmpl, it checks for path.tmpl first (template), then the path itself (static file).
reqPath must be a relative path with no ".." components that escape the cache directory; absolute paths and paths with volume names are rejected.
func (*OCICache) ResolvePathForArchitecture ¶ added in v0.1.20
func (c *OCICache) ResolvePathForArchitecture(imageRef, architecture, reqPath string) (diskPath string, isTemplate bool, err error)
ResolvePathForArchitecture looks for a file at the given path under the disk directory for the given image reference and target architecture.
func (*OCICache) SetDigestForArchitecture ¶ added in v0.1.20
type OCIReconciler ¶
type OCIReconciler struct {
Client client.Client
Cache *OCICache
Site string
DefaultNetbootRef string
DefaultNetbootPullSecretRef *v1alpha3.NamespacedSecretReference
}
OCIReconciler watches Machines and retained operation media for OCI images. Work items are deduplicated by image reference, architecture, and pull secret so machines sharing the same pull identity only trigger one download.
func (*OCIReconciler) SetupWithManager ¶
func (r *OCIReconciler) SetupWithManager(mgr ctrl.Manager) error
type ResolvedFile ¶
type ResolvedFile struct {
DiskPath string // on-disk path for static files
Data []byte // rendered content for template files
ContentType string // MIME type hint for the response
}
ResolvedFile is the result of resolving a file from an OCI image. For static files on disk, DiskPath is set so callers can stream from disk. For template files, Data holds the rendered content.
type StaticClusterInfo ¶
type StaticClusterInfo struct {
Info ClusterInfo
}
StaticClusterInfo is a ClusterInfoProvider that returns a fixed configuration. Useful for tests and simple deployments where runtime refresh is not needed.
func (*StaticClusterInfo) ClusterInfo ¶
func (s *StaticClusterInfo) ClusterInfo() ClusterInfo
type StatusRecorder ¶ added in v0.1.20
type StatusRecorder interface {
RecordBootLoaderDownloaded(ctx context.Context, machineName, filename string) error
RecordBootImageWritten(ctx context.Context, machineName string) error
RecordCloudInitDone(ctx context.Context, machineName string) error
RecordOperationCondition(ctx context.Context, machineName string, condition metav1.Condition) error
RecordPXEDisabled(ctx context.Context, machineName, imageName string) error
}
type TFTPServer ¶
type TFTPServer struct {
BindAddr string
FileResolver
StatusRecorder TFTPStatusRecorder
Media *MediaProvider
}
func (*TFTPServer) NeedLeaderElection ¶
func (t *TFTPServer) NeedLeaderElection() bool