Documentation
¶
Index ¶
- Variables
- type ClusterInfo
- type ClusterInfoProvider
- type FileResolver
- type HTTPServer
- type ImageMetadata
- type OCICache
- func (c *OCICache) DigestFor(imageRef string) string
- func (c *OCICache) DiskDir(digest string) string
- func (c *OCICache) ImageDir(digest string) string
- func (c *OCICache) InvalidateRef(imageRef string)
- func (c *OCICache) IsCached(digest string) bool
- func (c *OCICache) Metadata(digest string) (*ImageMetadata, error)
- func (c *OCICache) MetadataForRef(imageRef string) (*ImageMetadata, error)
- func (c *OCICache) ResolvePath(imageRef, reqPath string) (diskPath string, isTemplate bool, err error)
- func (c *OCICache) SetDigest(imageRef, digest string)
- type OCIReconciler
- type ResolvedFile
- type StaticClusterInfo
- type TFTPServer
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 ¶
This section is empty.
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
KubernetesVersion string
ClusterDNS string
ProviderLabels map[string]string
}
func (*FileResolver) LookupNodeByIP ¶
func (*FileResolver) ResolveFileByPath ¶
func (f *FileResolver) ResolveFileByPath(ctx context.Context, path string, node *v1alpha3.Machine, imageRef string) (*ResolvedFile, error)
type HTTPServer ¶
type HTTPServer struct {
BindAddr string
Port int
Client client.Client
Mux *http.ServeMux
FileResolver
}
func (*HTTPServer) NeedLeaderElection ¶
func (h *HTTPServer) NeedLeaderElection() bool
type ImageMetadata ¶
type ImageMetadata struct {
DHCPBootImageName string `yaml:"dhcpBootImageName"`
}
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}/disk/... This follows the kubevirt containerDisk convention where image contents live under /disk/ in the OCI layer.
func NewOCICache ¶
func (*OCICache) InvalidateRef ¶
InvalidateRef removes the digest mapping for an image reference, so it will be re-pulled on next reconcile.
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) MetadataForRef ¶
func (c *OCICache) MetadataForRef(imageRef string) (*ImageMetadata, error)
MetadataForRef returns the metadata for an image reference 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.
type OCIReconciler ¶
OCIReconciler watches Machine CRs and pulls their referenced OCI images. Work items are deduplicated by image reference so that multiple machines sharing the same image only trigger a single 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 TFTPServer ¶
type TFTPServer struct {
BindAddr string
FileResolver
}
func (*TFTPServer) NeedLeaderElection ¶
func (t *TFTPServer) NeedLeaderElection() bool