overridemanager

package
v1.10.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// CommandString command string
	CommandString = "command"
	// ArgsString args string
	ArgsString = "args"
)
View Source
const (
	// OverrideManagerName is the manager name that will be used when reporting events.
	OverrideManagerName = "override-manager"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppliedOverrides added in v0.5.0

type AppliedOverrides struct {
	// AppliedItems is the list of applied overriders.
	AppliedItems []OverridePolicyShadow `json:"appliedItems,omitempty"`
}

AppliedOverrides is the list of applied overriders.

func (*AppliedOverrides) Add added in v0.5.0

func (ao *AppliedOverrides) Add(policyName string, overriders policyv1alpha1.Overriders)

Add appends an item to AppliedItems.

func (*AppliedOverrides) AscendOrder added in v0.5.0

func (ao *AppliedOverrides) AscendOrder()

AscendOrder sort the applied items in ascending order.

func (*AppliedOverrides) MarshalJSON added in v0.5.0

func (ao *AppliedOverrides) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of applied overrides.

type GeneralOverridePolicy added in v1.0.0

type GeneralOverridePolicy interface {
	// GetName returns the name of OverridePolicy
	GetName() string
	// GetNamespace returns the namespace of OverridePolicy
	GetNamespace() string
	// GetOverrideSpec returns the OverrideSpec of OverridePolicy
	GetOverrideSpec() policyv1alpha1.OverrideSpec
}

GeneralOverridePolicy is an abstract object of ClusterOverridePolicy and OverridePolicy

type OverrideManager

type OverrideManager interface {
	// ApplyOverridePolicies overrides the object if one or more override policies exist and matches the target cluster.
	// For cluster scoped resource:
	// - Apply ClusterOverridePolicy by policies name in ascending
	// For namespaced scoped resource, apply order is:
	// - First apply ClusterOverridePolicy;
	// - Then apply OverridePolicy;
	ApplyOverridePolicies(rawObj *unstructured.Unstructured, cluster string) (appliedClusterPolicies *AppliedOverrides, appliedNamespacedPolicies *AppliedOverrides, err error)
}

OverrideManager managers override policies operation

func New

func New(client client.Client, eventRecorder record.EventRecorder) OverrideManager

New builds an OverrideManager instance.

type OverridePolicyShadow added in v0.5.0

type OverridePolicyShadow struct {
	// PolicyName is the name of the referencing policy.
	PolicyName string `json:"policyName"`

	// Overriders is the overrider list of the referencing policy.
	Overriders policyv1alpha1.Overriders `json:"overriders"`
}

OverridePolicyShadow is the condensed version of a OverridePolicy or ClusterOverridePolicy.

Jump to

Keyboard shortcuts

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