resourcemanager

package
v0.121.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeoutCheckpointDeployerCleanupOrphaned                 = "deployer: cleanup orphaned"
	TimeoutCheckpointDeployerProcessManagedResourceManifests = "deployer: process managed resource manifests"
	TimeoutCheckpointDeployerProcessManifests                = "deployer: process manifests"
	TimeoutCheckpointDeployerApplyManifests                  = "deployer: apply manifests"
)
View Source
const (
	ExecutionGroupCRD = iota
	ExecutionGroupClusterwide
	ExecutionGroupNamespaced
)
View Source
const TimeoutCheckpointDeployerDeleteResources = "deployer: delete resources"

Variables

This section is empty.

Functions

func AnnotateAndPatchBeforeDelete added in v0.110.0

func AnnotateAndPatchBeforeDelete(ctx context.Context, mr *managedresource.ManagedResourceStatus, targetClient client.Client) (notFound bool, err error)

func ApplyManifests

ApplyManifests creates or updates all configured manifests.

func DeleteManagedResources

func DeleteManagedResources(
	ctx context.Context,
	lsUncachedClient client.Client,
	managedResources managedresource.ManagedResourceStatusList,
	groupDefinitions []managedresource.DeletionGroupDefinition,
	targetClient client.Client,
	deployItem *lsv1alpha1.DeployItem,
	interruptionChecker interruption.InterruptionChecker,
	lsRestConfig *rest.Config,
) error

func FilterByPolicy

func FilterByPolicy(ctx context.Context, mr *managedresource.ManagedResourceStatus, targetClient client.Client, deployItemName string) (bool, error)

FilterByPolicy is used during the deletion of manifest deployitems and manifest-only helm deployitems. It returns true if the deployitem can be deleted according to its policy, and false if it must not be deleted.

Types

type ApiResourceHandler

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

func CreateApiResourceHandler

func CreateApiResourceHandler(clientset kubernetes.Interface) *ApiResourceHandler

func (*ApiResourceHandler) GetApiResource

func (a *ApiResourceHandler) GetApiResource(manifest *Manifest) (metav1.APIResource, error)

func (*ApiResourceHandler) GetApiResourceForType

func (a *ApiResourceHandler) GetApiResourceForType(typeMeta metav1.TypeMeta) (metav1.APIResource, error)

type CRDMatcher

type CRDMatcher struct{}

func (*CRDMatcher) Match

type ClusterScopedMatcher

type ClusterScopedMatcher struct{}

func (*ClusterScopedMatcher) Match

type CustomMatcher

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

func (*CustomMatcher) Match

type DeletionGroup

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

func NewDeletionGroup

func NewDeletionGroup(
	ctx context.Context,
	lsUncachedClient client.Client,
	definition managedresource.DeletionGroupDefinition,
	deployItem *lsv1alpha1.DeployItem,
	primaryTargetClient client.Client,
	interruptionChecker interruption.InterruptionChecker,
	lsRestConfig *rest.Config,
) (group *DeletionGroup, err error)

func (*DeletionGroup) AddResource

func (*DeletionGroup) Delete

func (g *DeletionGroup) Delete(ctx context.Context) (err error)

func (*DeletionGroup) GetAllResources

func (*DeletionGroup) GetManagedResources

func (g *DeletionGroup) GetManagedResources() []*managedresource.ManagedResourceStatus

func (*DeletionGroup) Match

type EmptyMatcher

type EmptyMatcher struct{}

func (*EmptyMatcher) Match

type Exporter

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

Exporter defines the export of data from manifests.

func NewExporter

func NewExporter(opts ExporterOptions) *Exporter

NewExporter creates a new exporter.

func (*Exporter) Export

func (e *Exporter) Export(ctx context.Context, exports *managedresource.Exports) (map[string]interface{}, error)

type ExporterOptions

type ExporterOptions struct {
	KubeClient          client.Client
	InterruptionChecker interruption.InterruptionChecker
	LsClient            client.Client
	DeployItem          *lsv1alpha1.DeployItem
	LsRestConfig        *rest.Config
}

ExporterOptions defines the options for the exporter.

type Manifest

type Manifest struct {
	TypeMeta metav1.TypeMeta
	// Policy defines the manage policy for that resource.
	Policy managedresource.ManifestPolicy `json:"policy,omitempty"`
	// Manifest defines the raw k8s manifest.
	Manifest *runtime.RawExtension `json:"manifest,omitempty"`
	// AnnotateBeforeCreate defines annotations that are being set before the manifest is being created.
	AnnotateBeforeCreate map[string]string `json:"annotateBeforeCreate,omitempty"`
	// AnnotateBeforeDelete defines annotations that are being set before the manifest is being deleted.
	AnnotateBeforeDelete map[string]string `json:"annotateBeforeDelete,omitempty"`
	// PatchAfterDeployment defines a patch that is being applied after an object has been deployed.
	PatchAfterDeployment *runtime.RawExtension `json:"patchAfterDeployment,omitempty"`
	// PatchBeforeDelete defines a patch that is being applied before an object is being deleted.
	PatchBeforeDelete *runtime.RawExtension `json:"patchBeforeDelete,omitempty"`
}

Manifest is the internal representation of a manifest

type ManifestApplier

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

ManifestApplier creates or updated manifest based on their definition.

func NewManifestApplier

func NewManifestApplier(opts ManifestApplierOptions) *ManifestApplier

NewManifestApplier creates a new manifest deployer

func (*ManifestApplier) Apply

func (a *ManifestApplier) Apply(ctx context.Context) ([]*PatchInfo, error)

Apply creates or updates all configured manifests.

func (*ManifestApplier) GetManagedResourcesStatus

func (a *ManifestApplier) GetManagedResourcesStatus() managedresource.ManagedResourceStatusList

GetManagedResourcesStatus returns the managed resources of the applier.

func (*ManifestApplier) PatchAfterDeployment added in v0.110.0

func (a *ManifestApplier) PatchAfterDeployment(ctx context.Context, patchInfos []*PatchInfo) error

type ManifestApplierOptions

type ManifestApplierOptions struct {
	Decoder          runtime.Decoder
	KubeClient       client.Client
	Clientset        kubernetes.Interface
	DefaultNamespace string

	DeployItemName   string
	DeployItem       *lsv1alpha1.DeployItem
	UpdateStrategy   manifestv1alpha2.UpdateStrategy
	Manifests        []managedresource.Manifest
	ManagedResources managedresource.ManagedResourceStatusList
	// Labels defines additional labels that are automatically injected into all resources.
	Labels                     map[string]string
	DeletionGroupsDuringUpdate []managedresource.DeletionGroupDefinition
	InterruptionChecker        interruption.InterruptionChecker

	LsUncachedClient client.Client
	LsRestConfig     *rest.Config
}

ManifestApplierOptions describes options for the manifest applier

type Matcher

type Matcher interface {
	Match(*managedresource.ManagedResourceStatus) bool
}

type NamespacedMatcher

type NamespacedMatcher struct{}

func (*NamespacedMatcher) Match

type PatchInfo added in v0.110.0

type PatchInfo struct {
	Resource *unstructured.Unstructured
	Patch    *runtime.RawExtension
}

Jump to

Keyboard shortcuts

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