Documentation ¶
Index ¶
- type Deployment
- func (d *Deployment) AddEventHandler(handler cache.ResourceEventHandler)
- func (d *Deployment) DeploymentsForTag(ctx context.Context, it *imagtagv1.Tag) ([]*appsv1.Deployment, error)
- func (d *Deployment) Get(ctx context.Context, ns, name string) (*appsv1.Deployment, error)
- func (d *Deployment) Sync(ctx context.Context, dep *appsv1.Deployment) error
- func (d *Deployment) UpdateDeploymentsForTag(ctx context.Context, it *imagtagv1.Tag) error
- type Importer
- func (i *Importer) DefaultPolicyContext() (*signature.PolicyContext, error)
- func (i *Importer) ImageRefForStringRef(ref string) (types.ImageReference, error)
- func (i *Importer) ImportTag(ctx context.Context, it *imagtagv1.Tag) (imagtagv1.HashReference, error)
- func (i *Importer) SplitRegistryDomain(imgPath string) (string, string)
- type LocalRegistryHostingV1
- type Metric
- type SysContext
- func (s *SysContext) AuthsFor(ctx context.Context, imgref types.ImageReference, namespace string) ([]*types.DockerAuthConfig, error)
- func (s *SysContext) CacheRegistryAddresses() (string, string, error)
- func (s *SysContext) CacheRegistryContext(ctx context.Context) *types.SystemContext
- func (s *SysContext) UnqualifiedRegistries(ctx context.Context) []string
- type Tag
- func (t *Tag) AddEventHandler(handler cache.ResourceEventHandler)
- func (t *Tag) CurrentReferenceForTagByName(namespace, name string) (string, error)
- func (t *Tag) Downgrade(ctx context.Context, namespace string, name string) (*imagtagv1.Tag, error)
- func (t *Tag) Get(ctx context.Context, ns, name string) (*imagtagv1.Tag, error)
- func (t *Tag) NewGeneration(ctx context.Context, namespace string, name string) (*imagtagv1.Tag, error)
- func (t *Tag) NewGenerationForImageRef(ctx context.Context, imgpath string) error
- func (t *Tag) PatchForPod(pod corev1.Pod) ([]jsonpatch.JsonPatchOperation, error)
- func (t *Tag) Sync(ctx context.Context, it *imagtagv1.Tag) error
- func (t *Tag) Upgrade(ctx context.Context, namespace string, name string) (*imagtagv1.Tag, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deployment ¶
type Deployment struct {
// contains filtered or unexported fields
}
Deployment gather all actions related to deployment objects.
func NewDeployment ¶
func NewDeployment( corcli corecli.Interface, corinf informers.SharedInformerFactory, taginf externalversions.SharedInformerFactory, ) *Deployment
NewDeployment returns a handler for all deployment related services. I have chosen to go with a lazy approach here, you can pass or omit (nil) the arguments, it is up to the caller to decide what is needed for each specific case. So far this is the best approach, I still plan to review this.
func (*Deployment) AddEventHandler ¶
func (d *Deployment) AddEventHandler(handler cache.ResourceEventHandler)
AddEventHandler adds a handler to Deployment related events.
func (*Deployment) DeploymentsForTag ¶
func (d *Deployment) DeploymentsForTag( ctx context.Context, it *imagtagv1.Tag, ) ([]*appsv1.Deployment, error)
DeploymentsForTag returns all deployments on tag's namespace that leverage the provided tag.
func (*Deployment) Get ¶
func (d *Deployment) Get(ctx context.Context, ns, name string) (*appsv1.Deployment, error)
Get returns a deployment by namespace/name pair.
func (*Deployment) Sync ¶
func (d *Deployment) Sync(ctx context.Context, dep *appsv1.Deployment) error
Sync verifies if the provided deployment leverages tags, if affirmative it creates an annotation into its template pointing to reference pointed by the tag. TODO add other containers here as well.
func (*Deployment) UpdateDeploymentsForTag ¶
UpdateDeploymentsForTag updates all deployments using provided tag. Triggers redeployment on deployments that have changed.
type Importer ¶
type Importer struct {
// contains filtered or unexported fields
}
Importer wrap srvices for tag import related operations.
func NewImporter ¶
func NewImporter(corinf informers.SharedInformerFactory) *Importer
NewImporter returns a handler for tag related services. I have chosen to go with a lazy approach here, you can pass or omit (nil) the argument, it is up to the caller to decide what is needed for each specific case. So far this is the best approach, I still plan to review this.
func (*Importer) DefaultPolicyContext ¶
func (i *Importer) DefaultPolicyContext() (*signature.PolicyContext, error)
DefaultPolicyContext returns the default policy context. XXX this should be reviewed.
func (*Importer) ImageRefForStringRef ¶
func (i *Importer) ImageRefForStringRef(ref string) (types.ImageReference, error)
ImageRefForStringRef parses provided string into a types.ImageReference.
type LocalRegistryHostingV1 ¶
type LocalRegistryHostingV1 struct { // Host documents the host (hostname and port) of the registry, as seen from // outside the cluster. // // This is the registry host that tools outside the cluster should push images // to. Host string `yaml:"host,omitempty"` // HostFromClusterNetwork documents the host (hostname and port) of the // registry, as seen from networking inside the container pods. // // This is the registry host that tools running on pods inside the cluster // should push images to. If not set, then tools inside the cluster should // assume the local registry is not available to them. HostFromClusterNetwork string `yaml:"hostFromClusterNetwork,omitempty"` // HostFromContainerRuntime documents the host (hostname and port) of the // registry, as seen from the cluster's container runtime. // // When tools apply Kubernetes objects to the cluster, this host should be // used for image name fields. If not set, users of this field should use the // value of Host instead. // // Note that it doesn't make sense semantically to define this field, but not // define Host or HostFromClusterNetwork. That would imply a way to pull // images without a way to push images. HostFromContainerRuntime string `yaml:"hostFromContainerRuntime,omitempty"` // Help contains a URL pointing to documentation for users on how to set // up and configure a local registry. // // Tools can use this to nudge users to enable the registry. When possible, // the writer should use as permanent a URL as possible to prevent drift // (e.g., a version control SHA). // // When image pushes to a registry host specified in one of the other fields // fail, the tool should display this help URL to the user. The help URL // should contain instructions on how to diagnose broken or misconfigured // registries. Help string `yaml:"help,omitempty"` }
LocalRegistryHostingV1 describes a local registry that developer tools can connect to. A local registry allows clients to load images into the local cluster by pushing to this registry. This is a verbatim copy of what is on the enhancement proposal in https://github.com/kubernetes/enhancements/ repo: keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry
type Metric ¶
type Metric struct {
// contains filtered or unexported fields
}
Metric is a struc containing all metrics within the system.
func NewMetrics ¶
func NewMetrics() *Metric
NewMetrics returns a singleton instance of Metric struct.
func (*Metric) ReportImportDuration ¶
ReportImportDuration registers a new import duration on a prometheus metric.
func (*Metric) ReportImportFailure ¶
func (m *Metric) ReportImportFailure()
ReportImportFailure increases the number of tag import failures.
func (*Metric) ReportImportSuccess ¶
func (m *Metric) ReportImportSuccess()
ReportImportSuccess increases the number of tag import failures.
func (*Metric) ReportWorker ¶
ReportWorker registers work activivy state. If active is true it means a running worker is running, false means a worker finished its job.
type SysContext ¶
type SysContext struct {
// contains filtered or unexported fields
}
SysContext groups tasks related to system context/configuration, deal with things such as configured docker authentications or unqualified registries configs.
func NewSysContext ¶
func NewSysContext(corinf informers.SharedInformerFactory) *SysContext
NewSysContext returns a new SysContext helper.
func (*SysContext) AuthsFor ¶
func (s *SysContext) AuthsFor( ctx context.Context, imgref types.ImageReference, namespace string, ) ([]*types.DockerAuthConfig, error)
AuthsFor return configured authentications for the registry hosting the image reference. Namespace is the namespace from where read docker authentications.
func (*SysContext) CacheRegistryAddresses ¶
func (s *SysContext) CacheRegistryAddresses() (string, string, error)
CacheRegistryAddresses returns the configured registry address used for caching images during tags. This is implemented to comply with KEP at https://github.com/kubernetes/enhancements/ repository, see keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry We evaluate if CACHE_REGISTRY_ADDRESS environment variable is set before moving on to the implementation following the KEP. This returns one address for connections starting from within the cluster and another for connections started from the cluster container runtime.
func (*SysContext) CacheRegistryContext ¶
func (s *SysContext) CacheRegistryContext(ctx context.Context) *types.SystemContext
CacheRegistryContext returns the context to be used when talking to the the registry used for caching tags.
func (*SysContext) UnqualifiedRegistries ¶
func (s *SysContext) UnqualifiedRegistries(ctx context.Context) []string
UnqualifiedRegistries returns the list of unqualified registries configured on the system. XXX here we should return the cluster wide configuration for unqualified registries.
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
Tag gather all actions related to image tag objects.
func NewTag ¶
func NewTag( corcli corecli.Interface, corinf informers.SharedInformerFactory, tagcli tagclient.Interface, taginf taginform.SharedInformerFactory, ) *Tag
NewTag returns a handler for all image tag related services. I have chosen to go with a lazy approach here, you can pass or omit (nil) any parameter, it is up to the caller to decide what is needed for each specific case. So far this is the best approach, I still plan to review this.
func (*Tag) AddEventHandler ¶
func (t *Tag) AddEventHandler(handler cache.ResourceEventHandler)
AddEventHandler adds a handler to tag related events.
func (*Tag) CurrentReferenceForTagByName ¶
CurrentReferenceForTagByName returns the image reference a tag is pointing to. If we can't find the image tag by namespace and name an empty string is returned instead.
func (*Tag) Downgrade ¶
func (t *Tag) Downgrade( ctx context.Context, namespace string, name string, ) (*imagtagv1.Tag, error)
Downgrade increments the expected (spec) generation for a tag. This function updates the object through the kubernetes api.
func (*Tag) NewGeneration ¶
func (t *Tag) NewGeneration( ctx context.Context, namespace string, name string, ) (*imagtagv1.Tag, error)
NewGeneration creates a new generation for a tag. The new generation is set to 'last import generation + 1'. If no generation was imported then the next generation is zero.
func (*Tag) NewGenerationForImageRef ¶
NewGenerationForImageRef looks through all image tags we have and creates a new generation in all of those who point to the provided image path. Image path looks like "quay.io/repo/image:tag". TODO add unqualified registries support and consider also empty tag as "latest".
func (*Tag) PatchForPod ¶
PatchForPod creates and returns a json patch to be applied on top of a pod in order to make it point to an already imported image tag. May returns nil if no patch is needed (i.e. pod does not use image tag).