policyrestrictions

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package policyrestrictions provides shared aggregation helpers for Fleet Policy enforcement. It is used by the GitRepo, HelmOp, and Bundle reconcilers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAllowed

func IsAllowed(currentValue, defaultValue string, allowedValues []string) (string, error)

IsAllowed validates currentValue against an optional allowedValues list, applying defaultValue when currentValue is empty. Returns (resolved value, nil) on success, or (currentValue, error) when the value is disallowed.

func IsAllowedByRegex

func IsAllowedByRegex(currentValue, defaultValue string, patterns []string) (string, error)

IsAllowedByRegex validates currentValue against a list of regex patterns, applying defaultValue when currentValue is empty. Patterns may also match verbatim (for compatibility with plain-string allow-lists). Returns (resolved value, nil) on success, or (currentValue, error) when no pattern matches.

Types

type Merged

type Merged struct {
	RequireServiceAccount  bool
	AllowedServiceAccounts []string

	// GitRepo-specific
	GitDefaultServiceAccount    string
	GitDefaultClientSecretName  string
	GitAllowedClientSecretNames []string
	GitAllowedRepoPatterns      []string

	// HelmOp-specific
	HelmDefaultServiceAccount  string
	HelmDefaultHelmSecretName  string
	HelmAllowedHelmSecretNames []string
	HelmAllowedRepoPatterns    []string
	HelmAllowedChartPatterns   []string
}

Merged is the aggregated result of one or more Policy objects in a namespace.

func Aggregate

func Aggregate(policies []fleet.Policy) Merged

Aggregate merges a slice of Policy objects into a single Merged value. Policies are processed in name order for determinism. Boolean fields use OR semantics; list fields are unioned; string defaults use first-non-empty.

Jump to

Keyboard shortcuts

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