Documentation ¶
Index ¶
- Constants
- Variables
- func BluePrintPullSecretName(deployItemNamespace, deployItemName string) string
- func CleanupDeployItem(ctx context.Context, deployItem *lsv1alpha1.DeployItem, ...) error
- func CleanupPod(ctx context.Context, hostClient client.Client, pod *corev1.Pod, keepPod bool) error
- func CleanupRBAC(ctx context.Context, deployItem *lsv1alpha1.DeployItem, ...) error
- func ComponentDescriptorPullSecretName(deployItemNamespace, deployItemName string) string
- func ConfigurationSecretName(deployItemNamespace, deployItemName string) string
- func DecodeProviderStatus(raw *runtime.RawExtension) (*containerv1alpha1.ProviderStatus, error)
- func DefaultConfiguration(obj *containerv1alpha1.Configuration)
- func DefaultLabels(deployerId, deployerName, diName, diNamespace string) map[string]string
- func DeployItemExportSecretName(deployItemName string) string
- func ExportSecretName(deployItemNamespace, deployItemName string) string
- func ImagePullSecretName(deployItemNamespace, deployItemName string) string
- func InitContainerServiceAccountName(di *lsv1alpha1.DeployItem) string
- func InjectDefaultLabels(obj client.Object, defaultLabels map[string]string)
- func NewDeployItemBuilder() *utils.DeployItemBuilder
- func NewDeployer(...) (*deployer, error)
- func OCMConfigConfigMapName(deployItemNamespace, deployItemName string) string
- func TargetSecretName(deployItemNamespace, deployItemName string) string
- func WaitAndGetServiceAccountSecret(ctx context.Context, log logging.Logger, c client.Client, ...) (types.NamespacedName, error)
- func WaitContainerServiceAccountName(di *lsv1alpha1.DeployItem) string
- type Container
- func (c *Container) CleanupPod(ctx context.Context, pod *corev1.Pod) error
- func (c *Container) Delete(ctx context.Context) error
- func (c *Container) Reconcile(ctx context.Context, operation container.OperationType) error
- func (c *Container) SyncConfiguration(ctx context.Context, defaultLabels map[string]string) error
- func (c *Container) SyncExport(ctx context.Context) error
- func (c *Container) SyncOCMConfiguration(ctx context.Context, defaultLabels map[string]string) error
- func (c *Container) SyncTarget(ctx context.Context, defaultLabels map[string]string) error
- type EnsureServiceAccountsResult
- type GarbageCollector
- type PodOptions
Constants ¶
const ( Type lsv1alpha1.DeployItemType = "landscaper.gardener.cloud/container" Name string = "container.deployer.landscaper.gardener.cloud" )
const ( TimeoutCheckpointContainerStartReconcile = "container deployer: start reconcile" TimeoutCheckpointContainerStartDelete = "container deployer: start delete" )
const PodTokenPath = "/var/run/secrets/kubernetes.io/serviceaccount/token"
PodTokenPath is the path in the pod that contains the service account token.
Variables ¶
var (
Scheme = runtime.NewScheme()
)
Functions ¶
func BluePrintPullSecretName ¶
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 ¶
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 ¶
ComponentDescriptorPullSecretName generates the secret name for the image pull secret. todo: use container identity
func ConfigurationSecretName ¶
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 ¶
DefaultLabels returns the default labels for a resource generated by the container deployer.
func DeployItemExportSecretName ¶
DeployItemExportSecretName generates the secret name for the exported secret
func ExportSecretName ¶
ExportSecretName generates the secret name for the exported secret
func ImagePullSecretName ¶
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 ¶
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
OCMConfigConfigMapName generates the secret name for the imported secret. todo: use container identity
func TargetSecretName ¶
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 ¶
CleanupPod cleans up a pod that was started with the container deployer.
func (*Container) Reconcile ¶
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 ¶
SyncConfiguration syncs the provider configuration data as secret to the host cluster.
func (*Container) SyncExport ¶
SyncExport syncs the export secret from the wait container to the deploy item export.
func (*Container) SyncOCMConfiguration ¶ added in v0.106.0
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