Documentation
¶
Index ¶
- Variables
- func BuildRegistryValue(source *v1alpha1.ModuleSource) *addonmodules.Registry
- func Dial(repository string) string
- func GenerateRegistryOptions(ri *RegistryConfig, logger *log.Logger) []cr.Option
- func GenerateRegistryOptionsFromModuleSource(ms *v1alpha1.ModuleSource, clusterUUID string, logger *log.Logger) []cr.Option
- func GetClusterUUID(ctx context.Context, cli client.Client) string
- func GetNotificationConfig(ctx context.Context, cli client.Client) (releaseUpdater.NotificationConfig, error)
- func GetUpdatePolicyByModule(ctx context.Context, cli client.Client, ...) (*v1alpha2.ModuleUpdatePolicy, error)
- func ModulePullOverrideExists(ctx context.Context, cli client.Client, moduleName string) (bool, error)
- func ModulePullOverrideHasDeployed(ctx context.Context, cli client.Client, moduleName string) (bool, error)
- func Update[Object client.Object](ctx context.Context, cli client.Client, object Object, ...) error
- func UpdateStatus[Object client.Object](ctx context.Context, cli client.Client, object Object, ...) error
- func WithAgentAuthority(path string) func()
- type DeckhouseRegistrySecret
- type FakeLayer
- func (fl FakeLayer) Compressed() (io.ReadCloser, error)
- func (fl FakeLayer) DiffID() (v1.Hash, error)
- func (fl FakeLayer) Digest() (v1.Hash, error)
- func (fl FakeLayer) MediaType() (types.MediaType, error)
- func (fl FakeLayer) Size() (int64, error)
- func (fl FakeLayer) Uncompressed() (io.ReadCloser, error)
- type RegistryConfig
Constants ¶
This section is empty.
Variables ¶
var ErrAddressFieldIsNotFound = errors.New("secret has no address field")
var ErrCAFieldIsNotFound = errors.New("secret has no ca field")
var ErrClusterIsBootstrappedFieldIsNotFound = errors.New("secret has no clusterIsBootstrapped field")
var ErrDockerConfigFieldIsNotFound = errors.New("secret has no .dockerconfigjson field")
var ErrImageRegistryFieldIsNotFound = errors.New("secret has no imagesRegistry field")
var ErrPathFieldIsNotFound = errors.New("secret has no path field")
var ErrSchemeFieldIsNotFound = errors.New("secret has no scheme field")
Functions ¶
func BuildRegistryValue ¶ added in v1.73.0
func BuildRegistryValue(source *v1alpha1.ModuleSource) *addonmodules.Registry
func Dial ¶ added in v1.78.0
Dial is the address to actually connect to in order to reach a repository.
Everything the cluster records names the in-cluster registry, because a recorded address is read by more than one party: it ends up in pod image references, in a ModuleSource, in a status. The loopback address belongs in none of those — it is node-local, and a cluster-wide object naming it is wrong even where it happens to work. What made that concrete was a ModuleSource whose repository named the loopback: the pods kept running on content their nodes already held, while the agent answered 502 to every fresh pull, since a request naming the agent as its own registry is a loop and is refused.
So the translation happens here, at the one place that has to dial, and nowhere else.
func GenerateRegistryOptions ¶
func GenerateRegistryOptions(ri *RegistryConfig, logger *log.Logger) []cr.Option
func GenerateRegistryOptionsFromModuleSource ¶ added in v1.65.0
func GenerateRegistryOptionsFromModuleSource(ms *v1alpha1.ModuleSource, clusterUUID string, logger *log.Logger) []cr.Option
GenerateRegistryOptionsFromModuleSource fetches settings from ModuleSource and generate registry options from them
func GetClusterUUID ¶ added in v1.67.0
GetClusterUUID gets uuid from the secret or generate a new one
func GetNotificationConfig ¶ added in v1.67.0
func GetNotificationConfig(ctx context.Context, cli client.Client) (releaseUpdater.NotificationConfig, error)
GetNotificationConfig gets config from discovery secret
func GetUpdatePolicyByModule ¶ added in v1.75.0
func GetUpdatePolicyByModule(ctx context.Context, cli client.Client, embeddedPolicy *helpers.ModuleUpdatePolicySpecContainer, moduleName string) (*v1alpha2.ModuleUpdatePolicy, error)
GetUpdatePolicyByModule returns policy for the module, if no policy, embeddedPolicy is returned
func ModulePullOverrideExists ¶ added in v1.67.0
func ModulePullOverrideExists(ctx context.Context, cli client.Client, moduleName string) (bool, error)
ModulePullOverrideExists checks if module pull override for the module exists
func ModulePullOverrideHasDeployed ¶ added in v1.77.7
func ModulePullOverrideHasDeployed(ctx context.Context, cli client.Client, moduleName string) (bool, error)
ModulePullOverrideHasDeployed checks if module pull override for the module exists and has deployed the module
func Update ¶ added in v1.67.0
func Update[Object client.Object](ctx context.Context, cli client.Client, object Object, updater func(obj Object) bool) error
Update updates object with retryOnConflict to avoid conflict
func UpdateStatus ¶ added in v1.67.0
func UpdateStatus[Object client.Object](ctx context.Context, cli client.Client, object Object, updater func(obj Object) bool) error
UpdateStatus updates object status with retryOnConflict to avoid conflict
func WithAgentAuthority ¶ added in v1.78.0
func WithAgentAuthority(path string) func()
WithAgentAuthority points the agent-authority lookup at path and returns a function that puts it back. It exists for tests in other packages: whether the agent serves the pull path is decided by a file under /etc/kubernetes, which a test cannot create, and the behaviour on each side of that decision is reached through this package from several of them.
Types ¶
type DeckhouseRegistrySecret ¶ added in v1.65.0
type DeckhouseRegistrySecret struct {
DockerConfig string
Address string
ClusterIsBootstrapped bool
ImageRegistry string
Path string
Scheme string
CA string
// FetchRegistry is where THIS process fetches from, which is not always the registry
// ImageRegistry names.
//
// Its own field because the two have different readers. ImageRegistry is the registry as
// seen from outside the cluster — dhctl reads it from wherever it is run and will not
// touch a cluster whose docker config has no credentials for the host it names — while
// this one is read only in the cluster, where the registry module may have put a node
// agent in front of every pull. Going through that agent is what makes a change of
// registry reach this process: nothing writes a registry address into the secret when the
// module moves the pull path.
//
// Empty on a cluster whose secret predates the field, and then ImageRegistry is used.
FetchRegistry string
}
func ParseDeckhouseRegistrySecret ¶ added in v1.65.0
func ParseDeckhouseRegistrySecret(data map[string][]byte) (*DeckhouseRegistrySecret, error)
func (*DeckhouseRegistrySecret) Fetch ¶ added in v1.78.0
func (s *DeckhouseRegistrySecret) Fetch() string
Fetch is the repository this process pulls from, ready to be dialled.
func (*DeckhouseRegistrySecret) RegistryConfig ¶ added in v1.78.0
func (s *DeckhouseRegistrySecret) RegistryConfig(userAgent string, logger *log.Logger) *RegistryConfig
RegistryConfig is what a client for the registry this secret describes is built from.
type FakeLayer ¶ added in v1.60.0
func (FakeLayer) Compressed ¶ added in v1.78.0
func (fl FakeLayer) Compressed() (io.ReadCloser, error)
func (FakeLayer) Uncompressed ¶ added in v1.60.0
func (fl FakeLayer) Uncompressed() (io.ReadCloser, error)
type RegistryConfig ¶ added in v1.65.0
type RegistryConfig struct {
DockerConfig string
Login string
Password string
CA string
Scheme string
UserAgent string
}
func (*RegistryConfig) ForRepository ¶ added in v1.78.0
func (rc *RegistryConfig) ForRepository(repository string, logger *log.Logger) *RegistryConfig
ForRepository adjusts a registry client configuration for the repository it will fetch from, and does nothing at all unless that repository is served by the node agent.
The agent is what the registry module puts in front of every pull once it manages the pull path, and a process — unlike a container runtime, which is handed a drop-in that redirects it — has to dial the agent to fetch through it. Three things about the agent are not properties of the registry the cluster was told about, and cannot be:
- it serves HTTPS whatever the upstream behind it speaks, so the configured scheme would send a plaintext request to a TLS listener;
- its authority is generated on the node at bootstrap and never leaves it, because a node's ability to pull must not wait for cluster-wide certificate material — hence the host mount;
- nothing authenticates to it: it holds credentials of its own for the registry behind it.
The last is why the credentials are cleared rather than left unused: a docker config is looked up by host, and one with no entry for the host being dialled makes building the client fail outright, which takes the whole pull path down the moment the module takes it over.