Documentation
¶
Index ¶
- Variables
- func CheckInvalidGenerators(applicationSetInfo *argoappsv1.ApplicationSet) error
- func CombineStringMaps(aSI map[string]any, bSI map[string]any) (map[string]any, error)
- func ConvertToMapStringString(mapStringInterface map[string]any) map[string]string
- func ConvertYAMLToJSON(str string) (string, error)
- func CreateOrUpdate(ctx context.Context, logCtx *log.Entry, c client.Client, ...) (controllerutil.OperationResult, error)
- func DefaultPolicy(appSetSyncPolicy *argov1alpha1.ApplicationSetSyncPolicy, ...) argov1alpha1.ApplicationsSyncPolicy
- func GetConfigMapData(ctx context.Context, k8sClient client.Client, ...) ([]byte, error)
- func GetOptionalHTTPClient(optionalHTTPClient ...*http.Client) *http.Client
- func GetSecretRef(ctx context.Context, k8sClient client.Client, ...) (string, error)
- func GetTlsConfig(scmRootCAPath string, insecure bool, caCerts []byte) *tls.Config
- func IsJSONStr(str string) bool
- func IsNamespaceAllowed(namespaces []string, namespace string) bool
- func LogPatch(logCtx *log.Entry, patch client.Patch, obj *argov1alpha1.Application)
- func NewAppsetLister(client ctrlclient.Client) listers.ApplicationSetLister
- func NewCacheSyncingClient(c client.Client, cache ctrlcache.Cache) client.Client
- func NormalizeBitbucketBasePath(basePath string) string
- func SanitizeName(name string) string
- func SecretsContainInClusterCredentials(secrets []corev1.Secret) bool
- func SlugifyName(args ...any) string
- func SpecsEquivalent(ignoreDifferences argov1alpha1.ApplicationSetIgnoreDifferences, ...) (bool, error)
- type AppsetLister
- type ByKey
- type ClusterSpecifier
- type Render
- func (r *Render) RenderGeneratorParams(gen *argoappsv1.ApplicationSetGenerator, params map[string]any, ...) (*argoappsv1.ApplicationSetGenerator, error)
- func (r *Render) RenderTemplateParams(tmpl *argoappsv1.Application, syncPolicy *argoappsv1.ApplicationSetSyncPolicy, ...) (*argoappsv1.Application, error)
- func (r *Render) Replace(tmpl string, replaceMap map[string]any, useGoTemplate bool, ...) (string, error)
- type Renderer
- type Requirement
- type Selector
Constants ¶
This section is empty.
Variables ¶
var ErrDisallowedSecretAccess = fmt.Errorf("secret must have label %q=%q", common.LabelKeySecretType, common.LabelValueSecretTypeSCMCreds)
var Policies = map[string]argov1alpha1.ApplicationsSyncPolicy{ "create-only": argov1alpha1.ApplicationsSyncPolicyCreateOnly, "create-update": argov1alpha1.ApplicationsSyncPolicyCreateUpdate, "create-delete": argov1alpha1.ApplicationsSyncPolicyCreateDelete, "sync": argov1alpha1.ApplicationsSyncPolicySync, "": argov1alpha1.ApplicationsSyncPolicySync, }
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 ConvertYAMLToJSON ¶
func CreateOrUpdate ¶
func CreateOrUpdate(ctx context.Context, logCtx *log.Entry, c client.Client, ignoreAppDifferences argov1alpha1.ApplicationSetIgnoreDifferences, ignoreNormalizerOpts normalizers.IgnoreNormalizerOpts, obj *argov1alpha1.Application, f controllerutil.MutateFn) (controllerutil.OperationResult, error)
func DefaultPolicy ¶
func DefaultPolicy(appSetSyncPolicy *argov1alpha1.ApplicationSetSyncPolicy, controllerPolicy argov1alpha1.ApplicationsSyncPolicy, enablePolicyOverride bool) argov1alpha1.ApplicationsSyncPolicy
func GetConfigMapData ¶
func GetConfigMapData(ctx context.Context, k8sClient client.Client, ref *argoprojiov1alpha1.ConfigMapKeyRef, namespace string) ([]byte, error)
func GetOptionalHTTPClient ¶ added in v3.1.0
func GetSecretRef ¶
func GetSecretRef(ctx context.Context, k8sClient client.Client, ref *argoprojiov1alpha1.SecretRef, namespace string, tokenRefStrictMode bool) (string, error)
GetSecretRef gets the value of the key for the specified Secret resource.
func GetTlsConfig ¶
func IsNamespaceAllowed ¶
func LogPatch ¶
func LogPatch(logCtx *log.Entry, patch client.Patch, obj *argov1alpha1.Application)
func NewAppsetLister ¶
func NewAppsetLister(client ctrlclient.Client) listers.ApplicationSetLister
func NewCacheSyncingClient ¶ added in v3.4.0
NewCacheSyncingClient returns a client that wraps the given client and syncs the cache after each Create, Update, Patch, or Delete operation on Application objects.
func SanitizeName ¶
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 SecretsContainInClusterCredentials ¶ added in v3.4.0
SecretsContainInClusterCredentials checks if any of the provided secrets represent the in-cluster configuration.
func SlugifyName ¶
SlugifyName generates a URL-friendly slug from the provided name and additional options. The slug is generated in accordance with the following rules: 1. The generated slug will be URL-safe and suitable for use in URLs. 2. The maximum length of the slug can be specified using the `maxSize` argument. 3. Smart truncation can be enabled or disabled using the `EnableSmartTruncate` argument. 4. The input name can be any string value that needs to be converted into a slug.
Args: - args: A variadic number of arguments where:
- The first argument (if provided) is an integer specifying the maximum length of the slug.
- The second argument (if provided) is a boolean indicating whether smart truncation is enabled.
- The last argument (if provided) is the input name that needs to be slugified. If no name is provided, an empty string will be used.
Returns: - string: The generated URL-friendly slug based on the input name and options.
func SpecsEquivalent ¶ added in v3.4.7
func SpecsEquivalent(ignoreDifferences argov1alpha1.ApplicationSetIgnoreDifferences, ignoreNormalizerOpts normalizers.IgnoreNormalizerOpts, live, desired *argov1alpha1.Application) (bool, error)
applyIgnoreDifferences applies the ignore differences rules to the found application. It modifies the applications in place. SpecsEquivalent reports whether the desired Application spec matches the live one, applying the same ignoreApplicationDifferences rules and normalization CreateOrUpdate applies before deciding whether to Patch. Callers asking "has the spec changed?" must use this rather than comparing specs directly: a difference the write path would not act on leaves the Application uncorrected and still reported as pending every reconcile. Scoped to the spec -- CreateOrUpdate compares whole objects, so a metadata-only change is patched without being reported here, which cannot loop.
The ordering below is load bearing and deliberately differs from master. Here CreateOrUpdate applies the ignore rules before normalizing, and its caller has already normalized the generated spec, so when the rules run the desired side is normalized and the live side is not. A rule selecting on a value that only appears after normalization therefore matches one side only. Reproducing that asymmetry is what keeps this answer and the write path's in step; normalizing both up front does not, and TestSpecComparisonAgreesWithWritePath fails if this is changed to match master.
Types ¶
type AppsetLister ¶
type AppsetLister struct {
Client ctrlclient.Client
}
Implements AppsetLister interface with controller-runtime client
func (*AppsetLister) ApplicationSets ¶
func (l *AppsetLister) ApplicationSets(namespace string) listers.ApplicationSetNamespaceLister
ApplicationSets returns an object that can list and get ApplicationSets.
func (*AppsetLister) List ¶
func (l *AppsetLister) List(_ labels.Selector) (ret []*v1alpha1.ApplicationSet, err error)
type ByKey ¶
type ByKey []Requirement
ByKey sorts requirements by key to obtain deterministic parser
type ClusterSpecifier ¶
ClusterSpecifier contains only the name and server URL of a cluster. We use this struct to avoid partially-populating the full Cluster struct, which would be misleading.
func ListClusters ¶
func ListClusters(clusterInformer *settings.ClusterInformer) ([]ClusterSpecifier, error)
ListClusters returns a list of cluster specifiers using the ClusterInformer.
type Render ¶
type Render struct{}
func (*Render) RenderGeneratorParams ¶
func (r *Render) RenderGeneratorParams(gen *argoappsv1.ApplicationSetGenerator, params map[string]any, useGoTemplate bool, goTemplateOptions []string) (*argoappsv1.ApplicationSetGenerator, error)
func (*Render) RenderTemplateParams ¶
func (r *Render) RenderTemplateParams(tmpl *argoappsv1.Application, syncPolicy *argoappsv1.ApplicationSetSyncPolicy, params map[string]any, useGoTemplate bool, goTemplateOptions []string) (*argoappsv1.Application, error)
type Renderer ¶
type Renderer interface {
RenderTemplateParams(tmpl *argoappsv1.Application, syncPolicy *argoappsv1.ApplicationSetSyncPolicy, params map[string]any, useGoTemplate bool, goTemplateOptions []string) (*argoappsv1.Application, error)
Replace(tmpl string, replaceMap map[string]any, useGoTemplate bool, goTemplateOptions []string) (string, error)
}
type Requirement ¶
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
type Selector ¶
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 ¶
func LabelSelectorAsSelector(ps *metav1.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