container

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Type lsv1alpha1.DeployItemType = "landscaper.gardener.cloud/container"
	Name string                    = "container.deployer.landscaper.gardener.cloud"
)
View Source
const (
	TimeoutCheckpointContainerStartReconcile = "container deployer: start reconcile"
	TimeoutCheckpointContainerStartDelete    = "container deployer: start delete"
)
View Source
const PodTokenPath = "/var/run/secrets/kubernetes.io/serviceaccount/token"

PodTokenPath is the path in the pod that contains the service account token.

Variables

View Source
var (
	Scheme = runtime.NewScheme()
)

Functions

func BluePrintPullSecretName

func BluePrintPullSecretName(deployItemNamespace, deployItemName string) string

BluePrintPullSecretName generates the secret name for the image pull secret. todo: use container identity

func CleanupDeployItem

func CleanupDeployItem(ctx context.Context, deployItem *lsv1alpha1.DeployItem, lsClient, hostClient client.Client, hostNamespace string) error

CleanupDeployItem deletes all secrets from a host cluster which belong to a deploy item.

func CleanupPod

func CleanupPod(ctx context.Context, hostClient client.Client, pod *corev1.Pod, keepPod bool) error

CleanupPod cleans up a pod that was started with the container deployer.

func CleanupRBAC

func CleanupRBAC(ctx context.Context, deployItem *lsv1alpha1.DeployItem, hostClient client.Client, hostNamespace string) error

CleanupRBAC removes all service accounts, roles and rolebindings that belong to the deploy item

func ComponentDescriptorPullSecretName

func ComponentDescriptorPullSecretName(deployItemNamespace, deployItemName string) string

ComponentDescriptorPullSecretName generates the secret name for the image pull secret. todo: use container identity

func ConfigurationSecretName

func ConfigurationSecretName(deployItemNamespace, deployItemName string) string

ConfigurationSecretName generates the secret name for the imported secret. todo: use container identity

func DecodeProviderStatus

func DecodeProviderStatus(raw *runtime.RawExtension) (*containerv1alpha1.ProviderStatus, error)

DecodeProviderStatus decodes a RawExtension to a container status.

func DefaultConfiguration

func DefaultConfiguration(obj *containerv1alpha1.Configuration)

DefaultConfiguration sets the defaults for the container deployer configuration.

func DefaultLabels

func DefaultLabels(deployerId, deployerName, diName, diNamespace string) map[string]string

DefaultLabels returns the default labels for a resource generated by the container deployer.

func DeployItemExportSecretName

func DeployItemExportSecretName(deployItemName string) string

DeployItemExportSecretName generates the secret name for the exported secret

func ExportSecretName

func ExportSecretName(deployItemNamespace, deployItemName string) string

ExportSecretName generates the secret name for the exported secret

func ImagePullSecretName

func ImagePullSecretName(deployItemNamespace, deployItemName string) string

ImagePullSecretName generates the secret name for the image pull secret. todo: use container identity

func InitContainerServiceAccountName

func InitContainerServiceAccountName(di *lsv1alpha1.DeployItem) string

InitContainerServiceAccountName generates the service account name for the init container

func InjectDefaultLabels

func InjectDefaultLabels(obj client.Object, defaultLabels map[string]string)

InjectDefaultLabels injects default labels into the given object.

func NewDeployItemBuilder

func NewDeployItemBuilder() *utils.DeployItemBuilder

NewDeployItemBuilder creates a new deployitem builder for container deployitems

func NewDeployer

func NewDeployer(lsUncachedClient, lsCachedClient, hostUncachedClient, hostCachedClient client.Client,
	log logging.Logger,
	config containerv1alpha1.Configuration) (*deployer, error)

NewDeployer creates a new deployer that reconciles deploy items of type "landscaper.gardener.cloud/container".

func OCMConfigConfigMapName added in v0.106.0

func OCMConfigConfigMapName(deployItemNamespace, deployItemName string) string

OCMConfigConfigMapName generates the secret name for the imported secret. todo: use container identity

func TargetSecretName

func TargetSecretName(deployItemNamespace, deployItemName string) string

TargetSecretName generates the secret name for the imported secret. todo: use container identity

func WaitAndGetServiceAccountSecret

func WaitAndGetServiceAccountSecret(ctx context.Context, log logging.Logger, c client.Client, serviceAccount *corev1.ServiceAccount, labels map[string]string) (types.NamespacedName, error)

WaitAndGetServiceAccountSecret waits until a service accounts secret is available and returns the secrets name.

func WaitContainerServiceAccountName

func WaitContainerServiceAccountName(di *lsv1alpha1.DeployItem) string

WaitContainerServiceAccountName generates the service account name for the wait container

Types

type Container

type Container struct {
	Configuration containerv1alpha1.Configuration

	DeployItem            *lsv1alpha1.DeployItem
	Context               *lsv1alpha1.Context
	ProviderStatus        *containerv1alpha1.ProviderStatus
	ProviderConfiguration *containerv1alpha1.ProviderConfiguration
	Target                *lsv1alpha1.ResolvedTarget

	InitContainerServiceAccountSecret types.NamespacedName
	WaitContainerServiceAccountSecret types.NamespacedName
	// contains filtered or unexported fields
}

Container is the internal representation of a DeployItem of Type Container

func New

func New(lsUncachedClient, lsCachedClient, hostUncachedClient, hostCachedClient client.Client,
	config containerv1alpha1.Configuration,
	item *lsv1alpha1.DeployItem,
	lsCtx *lsv1alpha1.Context,
	rt *lsv1alpha1.ResolvedTarget) (*Container, error)

New creates a new internal container item

func (*Container) CleanupPod

func (c *Container) CleanupPod(ctx context.Context, pod *corev1.Pod) error

CleanupPod cleans up a pod that was started with the container deployer.

func (*Container) Delete

func (c *Container) Delete(ctx context.Context) error

Delete handles the delete flow for container deploy item.

func (*Container) Reconcile

func (c *Container) Reconcile(ctx context.Context, operation container.OperationType) error

Reconcile handles the reconcile flow for a container deploy item. todo: do retries on failure: difference between main container failure and init/wait container failure

func (*Container) SyncConfiguration

func (c *Container) SyncConfiguration(ctx context.Context, defaultLabels map[string]string) error

SyncConfiguration syncs the provider configuration data as secret to the host cluster.

func (*Container) SyncExport

func (c *Container) SyncExport(ctx context.Context) error

SyncExport syncs the export secret from the wait container to the deploy item export.

func (*Container) SyncOCMConfiguration added in v0.106.0

func (c *Container) SyncOCMConfiguration(ctx context.Context, defaultLabels map[string]string) error

func (*Container) SyncTarget

func (c *Container) SyncTarget(ctx context.Context, defaultLabels map[string]string) error

SyncTarget syncs the deployitem's target content as secret to the host cluster.

type EnsureServiceAccountsResult

type EnsureServiceAccountsResult struct {
	InitContainerServiceAccountSecret types.NamespacedName
	WaitContainerServiceAccountSecret types.NamespacedName
}

EnsureServiceAccountsResult describes the result of the ensureServiceAccounts func

func EnsureServiceAccounts

func EnsureServiceAccounts(ctx context.Context, hostClient client.Client, deployItem *lsv1alpha1.DeployItem, hostNamespace string, labels map[string]string) (*EnsureServiceAccountsResult, error)

EnsureServiceAccounts ensures that the service accounts for the init and wait container are created and have the necessary permissions.

type GarbageCollector

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

func AddControllerToManager

func AddControllerToManager(lsUncachedClient, lsCachedClient, hostUncachedClient, hostCachedClient client.Client,
	finishedObjectCache *utils.FinishedObjectCache,
	logger logging.Logger, hostMgr, lsMgr manager.Manager, config containerv1alpha1.Configuration,
	callerName string) (*GarbageCollector, error)

AddControllerToManager adds all necessary deployer controllers to a controller manager.

func NewGarbageCollector

func NewGarbageCollector(
	lsUncachedClient, lsCachedClient, hostUncachedClient, hostCachedClient client.Client,
	log logging.Logger,
	deployerID,
	hostNamespace string,
	config containerv1alpha1.GarbageCollection,
	keepPods bool) *GarbageCollector

NewGarbageCollector creates a new Garbage collector that cleanups leaked service accounts, rbac rules and pods.

func (*GarbageCollector) Cleanup

func (gc *GarbageCollector) Cleanup(ctx context.Context)

func (*GarbageCollector) StartDeployerJob

func (gc *GarbageCollector) StartDeployerJob(ctx context.Context) error

type PodOptions

type PodOptions struct {
	DeployerID string

	ProviderConfiguration             *containerv1alpha1.ProviderConfiguration
	InitContainer                     containerv1alpha1.ContainerSpec
	WaitContainer                     containerv1alpha1.ContainerSpec
	InitContainerServiceAccountSecret types.NamespacedName
	WaitContainerServiceAccountSecret types.NamespacedName
	ConfigurationSecretName           string
	TargetSecretName                  string
	ImagePullSecret                   string
	BluePrintPullSecret               string
	ComponentDescriptorPullSecret     string

	OCMConfigConfigMapName string

	Name                 string
	Namespace            string
	DeployItemName       string
	DeployItemNamespace  string
	DeployItemGeneration int64

	Operation container.OperationType

	Debug bool
	// contains filtered or unexported fields
}

PodOptions contains the configuration that is needed for the scheduled pod

func (*PodOptions) Complete

func (o *PodOptions) Complete() error

Complete completes the the Blueprint provider configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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