remote

package
v0.0.0-...-6d903a3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFoundAndKCPKymaUnderDeleting = errors.New("not found and kcp kyma under deleting")
View Source
var ErrSkrClientContextNotFound = errors.New("skr client context not found")

Functions

func CRDNotFoundErr

func CRDNotFoundErr(err error) bool

func ContainsLatestVersion

func ContainsLatestVersion(crdFromRuntime *apiextensionsv1.CustomResourceDefinition, latestVersion string) bool

func FilterAllowedModuleTemplates

func FilterAllowedModuleTemplates(
	moduleTemplates []v1beta2.ModuleTemplate,
	moduleReleaseMetas []v1beta2.ModuleReleaseMeta,
) []v1beta2.ModuleTemplate

FilterAllowedModuleTemplates filters out ModuleTemplates that are not allowed. A ModuleTemplate is allowed if it is not mandatory, does not have sync disabled, and if it is referenced by a ModuleReleaseMeta that is synced.

func IsAllowedModuleReleaseMeta

func IsAllowedModuleReleaseMeta(moduleReleaseMeta v1beta2.ModuleReleaseMeta, kyma *v1beta2.Kyma) bool

IsAllowedModuleReleaseMeta determines whether the given ModuleReleaseMeta is allowed for the given Kyma. If the ModuleReleaseMeta is Beta, it is allowed only if the Kyma is also Beta. If the ModuleReleaseMeta is Internal, it is allowed only if the Kyma is also Internal.

func ReplaceSpec

func ReplaceSpec(controlPlaneKyma *v1beta2.Kyma, remoteKyma *v1beta2.Kyma)

ReplaceSpec replaces 'spec' attributes in control plane Kyma with values from Remote Kyma.

Types

type Client

type Client interface {
	client.Client
	Config() *rest.Config
}

type ClientCache

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

func NewClientCache

func NewClientCache() *ClientCache

func (*ClientCache) Add

func (c *ClientCache) Add(key client.ObjectKey, value Client)

func (*ClientCache) Contains

func (c *ClientCache) Contains(key client.ObjectKey) bool

func (*ClientCache) Delete

func (c *ClientCache) Delete(key client.ObjectKey)

func (*ClientCache) Get

func (c *ClientCache) Get(key client.ObjectKey) Client

func (*ClientCache) Size

func (c *ClientCache) Size() int

type ConfigAndClient

type ConfigAndClient struct {
	client.Client
	// contains filtered or unexported fields
}

func NewClientWithConfig

func NewClientWithConfig(clnt client.Client, cfg *rest.Config) *ConfigAndClient

func (*ConfigAndClient) Config

func (c *ConfigAndClient) Config() *rest.Config

type CrdType

type CrdType string
const (
	KCP CrdType = "KCP"
	SKR CrdType = "SKR"
)

type KymaSkrContextProvider

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

func NewKymaSkrContextProvider

func NewKymaSkrContextProvider(kcpClient Client, clientCache *ClientCache, event event.Event) *KymaSkrContextProvider

func (*KymaSkrContextProvider) Get

func (*KymaSkrContextProvider) Init

func (*KymaSkrContextProvider) InvalidateCache

func (k *KymaSkrContextProvider) InvalidateCache(kyma types.NamespacedName)

type RemoteCatalog

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

func NewRemoteCatalogFromKyma

func NewRemoteCatalogFromKyma(kcpClient client.Client, skrContextFactory SkrContextProvider,
	remoteSyncNamespace string,
) *RemoteCatalog

func (*RemoteCatalog) Delete

func (c *RemoteCatalog) Delete(
	ctx context.Context,
	kyma types.NamespacedName,
) error

func (*RemoteCatalog) GetModuleReleaseMetasToSync

func (c *RemoteCatalog) GetModuleReleaseMetasToSync(
	ctx context.Context,
	kyma *v1beta2.Kyma,
) ([]v1beta2.ModuleReleaseMeta, error)

GetModuleReleaseMetasToSync returns a list of ModuleReleaseMetas that should be synced to the SKR. A ModuleReleaseMeta that is Beta or Internal is synced only if the Kyma is also Beta or Internal.

func (*RemoteCatalog) GetModuleTemplatesToSync

func (c *RemoteCatalog) GetModuleTemplatesToSync(
	ctx context.Context,
	moduleReleaseMetas []v1beta2.ModuleReleaseMeta,
) ([]v1beta2.ModuleTemplate, error)

GetModuleTemplatesToSync returns a list of ModuleTemplates that should be synced to the SKR. A ModuleTemplate is synced if it is not mandatory and does not have sync disabled, and if it is referenced by a ModuleReleaseMeta that is synced.

func (*RemoteCatalog) GetOldModuleTemplatesToSync

func (c *RemoteCatalog) GetOldModuleTemplatesToSync(
	ctx context.Context,
	kyma *v1beta2.Kyma,
) ([]v1beta2.ModuleTemplate, error)

https://github.com/kyma-project/lifecycle-manager/issues/2096 Remove this function after the migration to the new ModuleTemplate format is completed.

func (*RemoteCatalog) SyncModuleCatalog

func (c *RemoteCatalog) SyncModuleCatalog(ctx context.Context, kyma *v1beta2.Kyma) error

type Settings

type Settings struct {
	// this namespace flag can be used to override the namespace in which all ModuleTemplates should be applied.
	Namespace       string
	SSAPatchOptions *client.PatchOptions
}

type SkrContext

type SkrContext struct {
	Client
	// contains filtered or unexported fields
}

func NewSkrContext

func NewSkrContext(client Client, event event.Event) *SkrContext

func (*SkrContext) CreateKymaNamespace

func (s *SkrContext) CreateKymaNamespace(ctx context.Context) error

func (*SkrContext) CreateOrFetchKyma

func (s *SkrContext) CreateOrFetchKyma(
	ctx context.Context, kcpClient client.Client, kyma *v1beta2.Kyma,
) (*v1beta2.Kyma, error)

func (*SkrContext) DeleteKyma

func (s *SkrContext) DeleteKyma(ctx context.Context) error

func (*SkrContext) RemoveFinalizersFromKyma

func (s *SkrContext) RemoveFinalizersFromKyma(ctx context.Context) error

func (*SkrContext) SynchronizeKyma

func (s *SkrContext) SynchronizeKyma(ctx context.Context, kcpKyma, remoteKyma *v1beta2.Kyma) error

type SkrContextProvider

type SkrContextProvider interface {
	Get(kyma types.NamespacedName) (*SkrContext, error)
	Init(ctx context.Context, kyma types.NamespacedName) error
	InvalidateCache(kyma types.NamespacedName)
}

type SyncCrdsUseCase

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

func NewSyncCrdsUseCase

func NewSyncCrdsUseCase(kcpClient client.Client, skrContextFactory SkrContextProvider,
	cache *crd.Cache,
) SyncCrdsUseCase

func (*SyncCrdsUseCase) Execute

func (s *SyncCrdsUseCase) Execute(ctx context.Context, kyma *v1beta2.Kyma) (bool, error)

Jump to

Keyboard shortcuts

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