Documentation
¶
Index ¶
- type PackageDefinition
- type PackageReleaseChannelService
- type PackageReleaseService
- type PackageService
- type PackageVersionMetadata
- type PackageVersionService
- func (s *PackageVersionService) GetMetadata(ctx context.Context, tag string) (*PackageVersionMetadata, error)
- func (s *PackageVersionService) HasModuleDefinition(ctx context.Context, tag string) (bool, error)
- func (s *PackageVersionService) ReadPackageDefinition(ctx context.Context, tag string) (*PackageDefinition, error)
- type PackagesService
- type ServiceManager
- type ServiceManagerInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PackageDefinition ¶ added in v1.76.0
type PackageDefinition struct {
Type string `yaml:"type"`
}
PackageDefinition represents the minimal parsed content of package.yaml. It's needed for fallback type detection if the package type label is not set in both version and release images for some reason.
type PackageReleaseChannelService ¶ added in v1.78.0
type PackageReleaseChannelService struct {
*PackageVersionService
}
PackageReleaseChannelService reads the <package>/release-channel path, where each tag names a channel.
type PackageReleaseService ¶ added in v1.76.0
type PackageReleaseService struct {
*PackageVersionService
}
PackageReleaseService is <package>/release, the legacy v1alpha1 release repository. A release image carries the same metadata files as a version one, so the reads are the same.
type PackageService ¶
type PackageService struct {
*service.BasicService
// contains filtered or unexported fields
}
PackageService addresses one package in the repository.
A PackageRepository serves several shapes at once: v1alpha2 packages publish their releases under version/, legacy v1alpha1 modules under release/, and either may publish release-channel/, where a channel tag points at the version it currently names. All three hold release images — metadata-only images carrying version.json beside a manifest — so one reader serves them all, and this type carries one per path.
func NewPackageService ¶
func NewPackageService(client registry.Client, logger *log.Logger) *PackageService
func (*PackageService) GetRoot ¶
func (s *PackageService) GetRoot() string
GetRoot gets path of the registry root
func (*PackageService) Release ¶ added in v1.76.0
func (s *PackageService) Release() *PackageReleaseService
Release returns the service for accessing <package>/release path (legacy v1alpha1 modules).
func (*PackageService) ReleaseChannels ¶
func (s *PackageService) ReleaseChannels() *PackageReleaseChannelService
ReleaseChannels returns the service for accessing <package>/release-channel path, where the version image a channel points to is published under the channel name.
func (*PackageService) Versions ¶ added in v1.76.0
func (s *PackageService) Versions() *PackageVersionService
Versions returns the service for accessing <package>/version path (new v1alpha2 modules).
type PackageVersionMetadata ¶
PackageVersionMetadata is what a release image declares about itself: the version it publishes, and the changelog it ships if it ships one.
type PackageVersionService ¶
PackageVersionService is <package>/version, the v1alpha2 release repository.
It is built on the registry library's release reader rather than on a sub-tree wrapper, because the three paths below a package differ only in their segment: each holds release images, and a snapshot of one serves every file it carries from a single pull.
func (*PackageVersionService) GetMetadata ¶
func (s *PackageVersionService) GetMetadata(ctx context.Context, tag string) (*PackageVersionMetadata, error)
GetMetadata reads the metadata of the image at tag. One pull serves both fields, so asking for the pair costs no more than asking for either.
A missing file is not a failure: an image that carries no version.json, or declares no version in it, reports an empty Version, and one without a changelog reports none. Only an unreadable image, or a version.json that cannot be decoded, is an error.
func (*PackageVersionService) HasModuleDefinition ¶ added in v1.76.0
HasModuleDefinition checks whether the image contains a module.yaml (or module.yml) file. It tells a module image apart from one that carries the version alone.
Returns (false, nil) if the image does not exist.
func (*PackageVersionService) ReadPackageDefinition ¶ added in v1.76.0
func (s *PackageVersionService) ReadPackageDefinition(ctx context.Context, tag string) (*PackageDefinition, error)
ReadPackageDefinition reads package.yaml from the version image and parses its type field. It's needed if for some reason we haven't set the package type label in both version and release images.
Returns nil if package.yaml is not found or the image does not exist, and an empty definition when the file is present but cannot be parsed — the caller tells those apart to distinguish "too old to carry a type" from "carries an unusable one".
type PackagesService ¶
type PackagesService struct {
*service.BasicService
// contains filtered or unexported fields
}
PackagesService is the package catalog a PackageRepository points at.
func NewPackagesService ¶
func NewPackagesService(client registry.Client, logger *log.Logger) *PackagesService
func (*PackagesService) Package ¶
func (s *PackagesService) Package(packageName string) *PackageService
type ServiceManager ¶
type ServiceManager[T any] struct { // contains filtered or unexported fields }
func NewPackageServiceManager ¶
func NewPackageServiceManager(logger *log.Logger) *ServiceManager[PackagesService]
func (*ServiceManager[T]) Service ¶
func (m *ServiceManager[T]) Service(registryURL string, config utils.RegistryConfig) (*T, error)
Service returns a client for a package registry, resolving both halves of "how to reach it" here.
Callers pass the address as the cluster RECORDS it, which since the registry module took over the pull path is not always an address this process can dial: `registry.d8-system.svc:5001` belongs to the node agent, nothing in the cluster serves it without in-cluster storage, and the agent answers on the node's loopback asking for no credentials.
Both facts have to be applied before dialling, and both already have a home: `utils.Dial` translates the recorded name into the agent's address, and `RegistryConfig.ForRepository` drops the docker config for it and reads the agent's authority instead. Without them a fetch fails first with `credentials not found in the dockerCfg` and then, once credentials are supplied, with `lookup registry.d8-system.svc: no such host`. Applied here rather than in each controller, because this is the one place that dials and there are three callers.
type ServiceManagerInterface ¶
type ServiceManagerInterface[T any] interface { Service(registryURL string, config utils.RegistryConfig) (*T, error) }