manifest

package
v0.0.0-...-55d04ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

README

Internal Manifest Library

This package contains internal reference coding that is used for translating and implementing the Manifest Reconciler parts that are not generically solved by the declarative library.

It contains various aspects to:

  1. Translate the Manifest CR into a declarative specification in a custom specification resolver. Use the layer parsing methods to download and resolve OCI image layers from the Manifest to make them accessible to the declarative library.
  2. Look up the correct Client for Single or Dual Cluster Mode based on the SKR Client Lookup and a ClusterClient to read Secret Data as if they were a kubeconfig
  3. Look up the correct Keychain to access image layers contained in private registries through a Keychain
  4. Interact with Default Data supplied to the Manifest CR for initializing a module with Pre/Post-Hooks
  5. Check for Module Readiness not only by looking at the resources supplied in the chart, but also to introspect the already mentioned CustomResource using a custom ReadyCheck

Documentation

Index

Constants

View Source
const (
	ToWarningDuration = 5 * time.Minute

	ModuleCRWithCustomCheckWarning   = "module CR state not found or given customStateCheck.jsonPath is not exists"
	ModuleCRWithNoCustomCheckWarning = "module CR state not found"
)

Variables

View Source
var (
	ErrNotSupportedState    = errors.New("module CR state not support")
	ErrRequiredStateMissing = errors.New("required Ready and Error state mapping are missing")
)
View Source
var (
	ErrRenderModeInvalid                   = errors.New("render mode is invalid")
	ErrInvalidObjectPassedToSpecResolution = errors.New("invalid object passed to spec resolution")
)
View Source
var ErrImageLayerPull = errors.New("failed to pull layer")
View Source
var ErrMoreThanOneSecretFound = errors.New("more than one secret found")

Functions

func GenerateCacheKey

func GenerateCacheKey(values ...string) string

func HandleState

func HandleState(manifest *v1beta2.Manifest, moduleCR *unstructured.Unstructured) (declarativev2.StateInfo, error)

func PostRunCreateCR

func PostRunCreateCR(
	ctx context.Context, skr declarativev2.Client, kcp client.Client, obj declarativev2.Object,
) error

PostRunCreateCR is a hook for creating the manifest default custom resource if not available in the cluster It is used to provide the controller with default data in the Runtime.

func PreDeleteDeleteCR

func PreDeleteDeleteCR(
	ctx context.Context, skr declarativev2.Client, kcp client.Client, obj declarativev2.Object,
) error

PreDeleteDeleteCR is a hook for deleting the module CR if available in the cluster. It uses DeletePropagationBackground to delete module CR. Only if module CR is not found (indicated by NotFound error), it continues to remove Manifest finalizer, and we consider the CR removal successful.

Types

type ClusterClient

type ClusterClient struct {
	DefaultClient client.Client
}

func (*ClusterClient) GetRESTConfig

func (cc *ClusterClient) GetRESTConfig(
	ctx context.Context, kymaOwner, kymaNameLabel, namespace string,
) (*rest.Config, error)

type CustomResourceReadyCheck

type CustomResourceReadyCheck struct{}

func NewCustomResourceReadyCheck

func NewCustomResourceReadyCheck() *CustomResourceReadyCheck

NewCustomResourceReadyCheck creates a readiness check that verifies that the Resource in the Manifest returns the ready state, if not it returns not ready.

func (*CustomResourceReadyCheck) Run

type ModuleCRDeletionCheck

type ModuleCRDeletionCheck struct{}

func NewModuleCRDeletionCheck

func NewModuleCRDeletionCheck() *ModuleCRDeletionCheck

NewModuleCRDeletionCheck creates a check that verifies that the Resource CR in the remote cluster is deleted.

func (*ModuleCRDeletionCheck) Run

type PathExtractor

type PathExtractor struct {
	// contains filtered or unexported fields
}

func NewPathExtractor

func NewPathExtractor(cache *filemutex.MutexCache) *PathExtractor

func (PathExtractor) GetPathFromRawManifest

func (p PathExtractor) GetPathFromRawManifest(ctx context.Context,
	imageSpec v1beta2.ImageSpec,
	keyChain authn.Keychain,
) (string, error)

type RESTConfigGetter

type RESTConfigGetter func() (*rest.Config, error)

type RawManifestInfo

type RawManifestInfo struct {
	Path   string
	OCIRef string
}

RawManifestInfo defines raw manifest information.

type RemoteClusterLookup

type RemoteClusterLookup struct {
	KCP          *declarativev2.ClusterInfo
	ConfigGetter RESTConfigGetter
}

func (*RemoteClusterLookup) ConfigResolver

type SpecResolver

type SpecResolver struct {
	KCP *declarativev2.ClusterInfo

	ChartCache string
	// contains filtered or unexported fields
}

func NewSpecResolver

func NewSpecResolver(kcp *declarativev2.ClusterInfo, extractor *PathExtractor) *SpecResolver

func (*SpecResolver) Spec

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL