remote

package
v0.0.0-...-d6154db Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const KubeConfigKey = "config"

Variables

View Source
var ErrAccessSecretNotFound = errors.New("access secret not found")
View Source
var ErrIsNoSyncContext = errors.New("the given value is not a pointer to a kyma synchronization context")
View Source
var ErrTemplateCRDNotReady = errors.New("module template crd for catalog sync is not ready")

Functions

func CRDNotFoundErr

func CRDNotFoundErr(err error) bool

func ContainsLatestVersion

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

func DeleteRemotelySyncedKyma

func DeleteRemotelySyncedKyma(
	ctx context.Context, remoteSyncNamespace string,
) error

func InitializeSyncContext

func InitializeSyncContext(ctx context.Context, kyma *v1beta2.Kyma,
	syncNamespace string, kcp Client, cache *ClientCache,
) (context.Context, error)

func RemoveFinalizersFromRemoteKyma

func RemoveFinalizersFromRemoteKyma(
	ctx context.Context, remoteSyncNamespace string,
) error

func ReplaceModules

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

ReplaceModules replaces modules specification from control plane Kyma with Remote Kyma specifications.

Types

type Catalog

type Catalog interface {
	CreateOrUpdate(ctx context.Context, moduleTemplateList *v1beta2.ModuleTemplateList) error
	Delete(ctx context.Context) error
}

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) 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 ClientFunc

type ClientFunc func() *rest.Config
var (
	//nolint:gochecknoglobals // used for testing
	LocalClient                        ClientFunc
	ErrNotFoundAndKCPKymaUnderDeleting = errors.New("not found and kcp kyma under deleting")
)

type ClientLookup

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

func NewClientLookup

func NewClientLookup(kcp Client, cache *ClientCache, strategy v1beta2.SyncStrategy) *ClientLookup

func (*ClientLookup) Lookup

func (l *ClientLookup) Lookup(ctx context.Context, key client.ObjectKey) (Client, error)

type ClusterClient

type ClusterClient struct {
	logr.Logger
	DefaultClient client.Client
}

func (*ClusterClient) GetRestConfigFromSecret

func (cc *ClusterClient) GetRestConfigFromSecret(ctx context.Context, name, namespace string) (*rest.Config, error)

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 KymaSynchronizationContext

type KymaSynchronizationContext struct {
	ControlPlaneClient Client
	RuntimeClient      Client
}

func InitializeKymaSynchronizationContext

func InitializeKymaSynchronizationContext(ctx context.Context, kcp Client, cache *ClientCache,
	kyma *v1beta2.Kyma, syncNamespace string,
) (*KymaSynchronizationContext, error)

func SyncContextFromContext

func SyncContextFromContext(ctx context.Context) (*KymaSynchronizationContext, error)

func (*KymaSynchronizationContext) CreateOrFetchRemoteKyma

func (c *KymaSynchronizationContext) CreateOrFetchRemoteKyma(
	ctx context.Context, kyma *v1beta2.Kyma, remoteSyncNamespace string,
) (*v1beta2.Kyma, error)

func (*KymaSynchronizationContext) CreateOrUpdateCRD

func (c *KymaSynchronizationContext) CreateOrUpdateCRD(ctx context.Context, plural string) error

func (*KymaSynchronizationContext) GetRemotelySyncedKyma

func (c *KymaSynchronizationContext) GetRemotelySyncedKyma(
	ctx context.Context, remoteSyncNamespace string,
) (*v1beta2.Kyma, error)

func (*KymaSynchronizationContext) SyncWatcherLabelsAnnotations

func (c *KymaSynchronizationContext) SyncWatcherLabelsAnnotations(controlPlaneKyma, remoteKyma *v1beta2.Kyma)

SyncWatcherLabelsAnnotations inserts labels into the given KymaCR, which are needed to ensure a working e2e-flow for the runtime-watcher.

func (*KymaSynchronizationContext) SynchronizeRemoteKyma

func (c *KymaSynchronizationContext) SynchronizeRemoteKyma(
	ctx context.Context,
	controlPlaneKyma, remoteKyma *v1beta2.Kyma,
) error

type RemoteCatalog

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

func NewRemoteCatalog

func NewRemoteCatalog(
	settings Settings,
) *RemoteCatalog

NewRemoteCatalog uses 2 Clients from a Sync Context to create a Catalog in a remote Cluster.

func NewRemoteCatalogFromKyma

func NewRemoteCatalogFromKyma(remoteSyncNamespace string) *RemoteCatalog

func (*RemoteCatalog) CreateModuleTemplateCRDInRuntime

func (c *RemoteCatalog) CreateModuleTemplateCRDInRuntime(ctx context.Context, plural string) error

func (*RemoteCatalog) CreateOrUpdate

func (c *RemoteCatalog) CreateOrUpdate(
	ctx context.Context,
	kcpModules []v1beta2.ModuleTemplate,
) error

CreateOrUpdate first lists all currently available moduleTemplates in the Runtime. If there is a NoMatchError, it will attempt to install the CRD but only if there are available crs to copy. It will use a 2 stage process: 1. All ModuleTemplates that either have to be created based on the given Control Plane Templates 2. All ModuleTemplates that have to be removed as they were deleted form the Control Plane Templates It uses Server-Side-Apply Patches to optimize the turnaround required.

func (*RemoteCatalog) Delete

func (c *RemoteCatalog) Delete(
	ctx context.Context,
) 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 SyncCrdsUseCase

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

func NewSyncCrdsUseCase

func NewSyncCrdsUseCase(cache *crd.Cache) SyncCrdsUseCase

func (*SyncCrdsUseCase) Execute

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

Jump to

Keyboard shortcuts

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