util

package
v1.6.4-pre.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareObjectMeta

func CompareObjectMeta(left metav1.ObjectMeta, right metav1.ObjectMeta) bool

func FilepathSafeJoin added in v1.5.12

func FilepathSafeJoin(dir, relative string) (string, error)

FilepathSafeJoin joins dir and relative, returning an error if relative is not a clean, canonical relative path within dir. It rejects path traversal (.. sequences), absolute paths, the bare "." and ".." entries, and any path that would be altered by filepath.Clean (e.g. leading "./", redundant separators, or internal "a/../b" segments).

func GenerateUid

func GenerateUid(prefix string, kubeNs string, kubeName string) types.UID

func GetInClusterNamespace

func GetInClusterNamespace() (string, error)

func GetPorchApiServiceKey

func GetPorchApiServiceKey(ctx context.Context) (client.ObjectKey, error)

func GetRepoPackageRefFromUpstream added in v1.5.12

func GetRepoPackageRefFromUpstream(upstream *kptfilev1.Upstream) (upstreamRepoSpec *configapi.RepositorySpec, upstreamPackage, upstreamRef string, isManagedReference bool, err error)

func RetryOnErrorConditional

func RetryOnErrorConditional(retries int, shouldRetryFunc func(error) bool, f func(retryNumber int) error) error

RetryOnErrorConditional retries f up to retries times if it returns an error that matches shouldRetryFunc

func SafeReverse

func SafeReverse[S ~[]E, E any](s S)

func ValidateResourcePaths added in v1.5.12

func ValidateResourcePaths(resources map[string]string) error

ValidateResourcePaths checks that all keys in a resource map are valid relative file paths within a package. It rejects path traversal sequences, absolute paths, and non-canonical paths (e.g. leading "./", bare "." or ".."). Returns an error on the first invalid key.

Types

This section is empty.

Directories

Path Synopsis
Package context adds porch context to the incoming request context.
Package context adds porch context to the incoming request context.
Package datasize provides named units, parsing and formatting for sizes of data in bytes, and a flag value that accepts sizes such as "6MB".
Package datasize provides named units, parsing and formatting for sizes of data in bytes, and a flag value that accepts sizes such as "6MB".

Jump to

Keyboard shortcuts

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