utils

package
v2.7.8 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 34 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ArgoCDSecretTypeLabel   = "argocd.argoproj.io/secret-type"
	ArgoCDSecretTypeCluster = "cluster"
)

Variables

View Source
var Policies = map[string]Policy{
	"sync":          &SyncPolicy{},
	"create-only":   &CreateOnlyPolicy{},
	"create-update": &CreateUpdatePolicy{},
	"create-delete": &CreateDeletePolicy{},
}

Policies is a registry of available policies.

Functions

func CheckInvalidGenerators

func CheckInvalidGenerators(applicationSetInfo *argoappsv1.ApplicationSet) error

Log a warning if there are unrecognized generators

func CombineStringMaps

func CombineStringMaps(aSI map[string]interface{}, bSI map[string]interface{}) (map[string]string, error)

func CombineStringMapsAllowDuplicates

func CombineStringMapsAllowDuplicates(aSI map[string]interface{}, bSI map[string]interface{}) (map[string]string, error)

CombineStringMapsAllowDuplicates merges two maps. Where there are duplicates, take the latter map's value.

func ConvertToMapStringInterface added in v2.5.0

func ConvertToMapStringInterface(mapStringString map[string]string) map[string]interface{}

func ConvertToMapStringString added in v2.5.0

func ConvertToMapStringString(mapStringInterface map[string]interface{}) map[string]string

func CreateOrUpdate

CreateOrUpdate overrides "sigs.k8s.io/controller-runtime" function in sigs.k8s.io/controller-runtime/pkg/controller/controllerutil/controllerutil.go to add equality for argov1alpha1.ApplicationDestination argov1alpha1.ApplicationDestination has a private variable, so the default implementation fails to compare it.

CreateOrUpdate creates or updates the given object in the Kubernetes cluster. The object's desired state must be reconciled with the existing state inside the passed in callback MutateFn.

The MutateFn is called regardless of creating or updating an object.

It returns the executed operation and an error.

func ListClusters

func ListClusters(ctx context.Context, clientset kubernetes.Interface, namespace string) (*appv1.ClusterList, error)

func NormalizeBitbucketBasePath

func NormalizeBitbucketBasePath(basePath string) string

func SanitizeName added in v2.5.0

func SanitizeName(name string) string

SanitizeName sanitizes the name in accordance with the below rules 1. contain no more than 253 characters 2. contain only lowercase alphanumeric characters, '-' or '.' 3. start and end with an alphanumeric character

func ValidateDestination

func ValidateDestination(ctx context.Context, dest *appv1.ApplicationDestination, clientset kubernetes.Interface, namespace string) error

ValidateDestination checks: if we used destination name we infer the server url if we used both name and server then we return an invalid spec error

Types

type ByKey added in v2.5.18

type ByKey []Requirement

ByKey sorts requirements by key to obtain deterministic parser

func (ByKey) Len added in v2.5.18

func (a ByKey) Len() int

func (ByKey) Less added in v2.5.18

func (a ByKey) Less(i, j int) bool

func (ByKey) Swap added in v2.5.18

func (a ByKey) Swap(i, j int)

type CreateDeletePolicy added in v2.6.0

type CreateDeletePolicy struct{}

func (*CreateDeletePolicy) Delete added in v2.6.0

func (p *CreateDeletePolicy) Delete() bool

func (*CreateDeletePolicy) Update added in v2.6.0

func (p *CreateDeletePolicy) Update() bool

type CreateOnlyPolicy

type CreateOnlyPolicy struct{}

func (*CreateOnlyPolicy) Delete

func (p *CreateOnlyPolicy) Delete() bool

func (*CreateOnlyPolicy) Update

func (p *CreateOnlyPolicy) Update() bool

type CreateUpdatePolicy

type CreateUpdatePolicy struct{}

func (*CreateUpdatePolicy) Delete

func (p *CreateUpdatePolicy) Delete() bool

func (*CreateUpdatePolicy) Update

func (p *CreateUpdatePolicy) Update() bool

type Policy

type Policy interface {
	Update() bool
	Delete() bool
}

Policy allows to apply different rules to a set of changes.

type Render

type Render struct {
}

func (*Render) RenderGeneratorParams added in v2.5.14

func (r *Render) RenderGeneratorParams(gen *argoappsv1.ApplicationSetGenerator, params map[string]interface{}, useGoTemplate bool) (*argoappsv1.ApplicationSetGenerator, error)

func (*Render) RenderTemplateParams

func (r *Render) RenderTemplateParams(tmpl *argoappsv1.Application, syncPolicy *argoappsv1.ApplicationSetSyncPolicy, params map[string]interface{}, useGoTemplate bool) (*argoappsv1.Application, error)

func (*Render) Replace added in v2.5.0

func (r *Render) Replace(tmpl string, replaceMap map[string]interface{}, useGoTemplate bool) (string, error)

Replace executes basic string substitution of a template with replacement values. remaining in the substituted template.

type Renderer

type Renderer interface {
	RenderTemplateParams(tmpl *argoappsv1.Application, syncPolicy *argoappsv1.ApplicationSetSyncPolicy, params map[string]interface{}, useGoTemplate bool) (*argoappsv1.Application, error)
}

type Requirement added in v2.5.18

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

Requirement contains values, a key, and an operator that relates the key and values. The zero value of Requirement is invalid. Requirement implements both set based match and exact match Requirement should be initialized via NewRequirement constructor for creating a valid Requirement. +k8s:deepcopy-gen=true

func (*Requirement) Matches added in v2.5.18

func (r *Requirement) Matches(ls labels.Labels) bool

type Selector added in v2.5.18

type Selector interface {
	// Matches returns true if this selector matches the given set of labels.
	Matches(labels.Labels) bool

	// Add adds requirements to the Selector
	Add(r ...Requirement) Selector
}

Selector represents a label selector.

func LabelSelectorAsSelector added in v2.5.18

func LabelSelectorAsSelector(ps *v1.LabelSelector) (Selector, error)

LabelSelectorAsSelector converts the LabelSelector api type into a struct that implements labels.Selector Note: This function should be kept in sync with the selector methods in pkg/labels/selector.go

type SyncPolicy

type SyncPolicy struct{}

func (*SyncPolicy) Delete

func (p *SyncPolicy) Delete() bool

func (*SyncPolicy) Update

func (p *SyncPolicy) Update() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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