config

package
v0.62.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultConfigString

func NewDefaultConfigString() string

Types

type APIGroupKindMatcher added in v0.62.0

type APIGroupKindMatcher struct {
	APIGroup string `json:"apiGroup"`
	Kind     string
}

type APIVersionKindMatcher

type APIVersionKindMatcher struct {
	APIVersion string `json:"apiVersion"`
	Kind       string
}

type AllMatcher added in v0.62.0

type AllMatcher struct{}

type AndMatcher added in v0.62.0

type AndMatcher struct {
	Matchers []ResourceMatcher
}

type AnyMatcher added in v0.62.0

type AnyMatcher struct {
	Matchers []ResourceMatcher
}

type ChangeGroupBinding added in v0.62.0

type ChangeGroupBinding struct {
	Name             string
	ResourceMatchers []ResourceMatcher
}

type ChangeRuleBinding added in v0.62.0

type ChangeRuleBinding struct {
	Rules            []string
	IgnoreIfCyclical bool
	ResourceMatchers []ResourceMatcher
}

type Conf

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

func NewConfFromResources

func NewConfFromResources(resources []ctlres.Resource) ([]ctlres.Resource, Conf, error)

func NewConfFromResourcesWithDefaults

func NewConfFromResourcesWithDefaults(resources []ctlres.Resource) ([]ctlres.Resource, Conf, error)

func (Conf) AdditionalLabels added in v0.6.0

func (c Conf) AdditionalLabels() map[string]string

func (Conf) ChangeGroupBindings added in v0.62.0

func (c Conf) ChangeGroupBindings() []ChangeGroupBinding

func (Conf) ChangeRuleBindings added in v0.62.0

func (c Conf) ChangeRuleBindings() []ChangeRuleBinding

func (Conf) DiffAgainstExistingFieldExclusionMods added in v0.62.0

func (c Conf) DiffAgainstExistingFieldExclusionMods() []ctlres.FieldRemoveMod

func (Conf) DiffAgainstLastAppliedFieldExclusionMods added in v0.14.0

func (c Conf) DiffAgainstLastAppliedFieldExclusionMods() []ctlres.FieldRemoveMod

func (Conf) DiffMaskRules added in v0.62.0

func (c Conf) DiffMaskRules() []DiffMaskRule

func (Conf) LabelScopingMods

func (c Conf) LabelScopingMods(defaultRules bool) func(kvs map[string]string) []ctlres.StringMapAppendMod

func (Conf) OwnershipLabelMods

func (c Conf) OwnershipLabelMods() func(kvs map[string]string) []ctlres.StringMapAppendMod

func (Conf) PreflightRules added in v0.62.0

func (c Conf) PreflightRules() []PreflightRule

func (Conf) RebaseMods

func (c Conf) RebaseMods() []ctlres.ResourceModWithMultiple

func (Conf) TemplateRules

func (c Conf) TemplateRules() []TemplateRule

func (Conf) WaitRules added in v0.62.0

func (c Conf) WaitRules() []WaitRule

type Config

type Config struct {
	APIVersion string `json:"apiVersion"`
	Kind       string

	MinimumRequiredVersion string `json:"minimumRequiredVersion,omitempty"`

	RebaseRules         []RebaseRule
	WaitRules           []WaitRule
	OwnershipLabelRules []OwnershipLabelRule
	LabelScopingRules   []LabelScopingRule
	TemplateRules       []TemplateRule
	DiffMaskRules       []DiffMaskRule
	PreflightRules      []PreflightRule

	AdditionalLabels                          map[string]string
	DiffAgainstLastAppliedFieldExclusionRules []DiffAgainstLastAppliedFieldExclusionRule
	DiffAgainstExistingFieldExclusionRules    []DiffAgainstExistingFieldExclusionRule

	// TODO additional?
	// TODO validations
	ChangeGroupBindings []ChangeGroupBinding
	ChangeRuleBindings  []ChangeRuleBinding
}

func NewConfigFromResource

func NewConfigFromResource(res ctlres.Resource) (Config, error)

func (Config) Validate added in v0.62.0

func (c Config) Validate() error

type CustomResourceMatcher added in v0.62.0

type CustomResourceMatcher struct{}

type DiffAgainstExistingFieldExclusionRule added in v0.62.0

type DiffAgainstExistingFieldExclusionRule struct {
	ResourceMatchers []ResourceMatcher
	Path             ctlres.Path
}

func (DiffAgainstExistingFieldExclusionRule) AsMod added in v0.62.0

type DiffAgainstLastAppliedFieldExclusionRule added in v0.14.0

type DiffAgainstLastAppliedFieldExclusionRule struct {
	ResourceMatchers []ResourceMatcher
	Path             ctlres.Path
}

func (DiffAgainstLastAppliedFieldExclusionRule) AsMod added in v0.62.0

type DiffMaskRule added in v0.62.0

type DiffMaskRule struct {
	ResourceMatchers []ResourceMatcher
	Path             ctlres.Path
}

type EmptyFieldMatcher added in v0.62.0

type EmptyFieldMatcher struct {
	Path ctlres.Path
}

type FuncContractV1 added in v0.62.0

type FuncContractV1 struct {
	Resource string `json:"resource.star"`
}

type HasAnnotationMatcher added in v0.62.0

type HasAnnotationMatcher struct {
	Keys []string
}

type HasNamespaceMatcher added in v0.62.0

type HasNamespaceMatcher struct {
	Names []string
}

type KindNamespaceNameMatcher

type KindNamespaceNameMatcher struct {
	Kind      string
	Namespace string
	Name      string
}

type LabelScopingRule

type LabelScopingRule struct {
	ResourceMatchers []ResourceMatcher
	Path             ctlres.Path
	IsDefault        bool `json:"isDefault"`
}

func (LabelScopingRule) AsMod added in v0.62.0

type NotMatcher added in v0.62.0

type NotMatcher struct {
	Matcher ResourceMatcher
}

type OwnershipLabelRule

type OwnershipLabelRule struct {
	ResourceMatchers []ResourceMatcher
	Path             ctlres.Path
}

func (OwnershipLabelRule) AsMod added in v0.62.0

type PreflightRule added in v0.62.0

type PreflightRule struct {
	Name   string
	Config map[string]any
}

type RebaseRule

type RebaseRule struct {
	ResourceMatchers []ResourceMatcher

	Path    ctlres.Path
	Paths   []ctlres.Path
	Type    string
	Sources []ctlres.FieldCopyModSource

	Ytt *RebaseRuleYtt
}

func (RebaseRule) AsMods

func (RebaseRule) Validate added in v0.62.0

func (r RebaseRule) Validate() error

type RebaseRuleYtt added in v0.62.0

type RebaseRuleYtt struct {
	// Contracts are named (eg overlay) and versioned (eg v1)
	// to provide a stable interface to rule authors.
	// Multiple contracts will be offered at the same time
	// so that existing rules do not not break as we decide to evolve running environment.
	OverlayContractV1 *RebaseRuleYttOverlayContractV1 `json:"overlayContractV1"`
}

type RebaseRuleYttOverlayContractV1 added in v0.62.0

type RebaseRuleYttOverlayContractV1 struct {
	OverlayYAML string `json:"overlay.yml"`
}

type ResourceMatcher

type ResourceMatcher struct {
	AllMatcher               *AllMatcher // default
	AnyMatcher               *AnyMatcher
	NotMatcher               *NotMatcher
	AndMatcher               *AndMatcher
	APIGroupKindMatcher      *APIGroupKindMatcher
	APIVersionKindMatcher    *APIVersionKindMatcher `json:"apiVersionKindMatcher"`
	KindNamespaceNameMatcher *KindNamespaceNameMatcher
	HasAnnotationMatcher     *HasAnnotationMatcher
	HasNamespaceMatcher      *HasNamespaceMatcher
	CustomResourceMatcher    *CustomResourceMatcher
	EmptyFieldMatcher        *EmptyFieldMatcher
}

func (ResourceMatcher) AsResourceMatcher

func (m ResourceMatcher) AsResourceMatcher() ctlres.ResourceMatcher

type ResourceMatchers

type ResourceMatchers []ResourceMatcher

func (ResourceMatchers) AsResourceMatchers

func (ms ResourceMatchers) AsResourceMatchers() []ctlres.ResourceMatcher

type TemplateAffectedObjRef

type TemplateAffectedObjRef struct {
	ResourceMatchers []ResourceMatcher
	Path             ctlres.Path
	NameKey          string `json:"nameKey"`
}

type TemplateAffectedResources

type TemplateAffectedResources struct {
	ObjectReferences []TemplateAffectedObjRef
}

type TemplateRule

type TemplateRule struct {
	ResourceMatchers  []ResourceMatcher
	AffectedResources TemplateAffectedResources
}

type WaitRule added in v0.62.0

type WaitRule struct {
	SupportsObservedGeneration bool
	ConditionMatchers          []WaitRuleConditionMatcher
	ResourceMatchers           []ResourceMatcher
	Ytt                        *WaitRuleYtt
}

func (WaitRule) ResourceMatcher added in v0.62.0

func (r WaitRule) ResourceMatcher() ctlres.ResourceMatcher

type WaitRuleConditionMatcher added in v0.62.0

type WaitRuleConditionMatcher struct {
	Type                       string
	Status                     string
	Failure                    bool
	Success                    bool
	SupportsObservedGeneration bool
	UnblockChanges             bool
}

type WaitRuleYtt added in v0.62.0

type WaitRuleYtt struct {
	// Contracts are named and versioned (eg v1)
	// to provide a stable interface to rule authors.
	// Multiple contracts will be offered at the same time
	// so that existing rules do not not break as we decide to evolve running environment.
	FuncContractV1 *FuncContractV1 `json:"funcContractV1"`
}

Jump to

Keyboard shortcuts

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