utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RatifyNamespaceEnvVar = "RATIFY_NAMESPACE"
)

Variables

This section is empty.

Functions

func CreatePlugin

func CreatePlugin(pluginName string) (string, error)

func CreateScheme

func CreateScheme() (*runtime.Scheme, error)

func GetCertificatesFromPath

func GetCertificatesFromPath(path string) ([]*x509.Certificate, error)

Return list of certificates loaded from path when path is a directory, this method loads all certs in directory and resolve symlink if needed

func GetNamespace

func GetNamespace() string

GetNamespace returns the namespace.

func GetServiceName

func GetServiceName() string

GetServiceName returns the service name.

func KeyFor

func KeyFor(obj client.Object) types.NamespacedName

func ParseDigest

func ParseDigest(digestStr string) (digest.Digest, error)

ParseDigest parses the given string and returns a validated Digest object.

func ParseSubjectReference

func ParseSubjectReference(subRef string) (common.Reference, error)

ParseSubjectReference parses the given subject and returns a valid reference

func ReplaceHomeShortcut

func ReplaceHomeShortcut(path string) string

Replace the shortcut prefix in a path with the home directory For example in a unix os, ~/.config/ becomes /home/azureuser/.config after replacement

func TrimSpaceAndToLower

func TrimSpaceAndToLower(input string) string

returns the string in lower case without leading and trailing space

Types

type MockResourceWriter

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

func (MockResourceWriter) Create

func (MockResourceWriter) Patch

func (MockResourceWriter) Update

type MockStatusClient

type MockStatusClient struct {
	UpdateFailed bool
}

func (MockStatusClient) Status

type RequestKey

type RequestKey struct {
	// Subject is image name in the request key.
	Subject string
	// Namespace is the scope of the image.
	Namespace string
}

RequestKey is a structured external data request key.

func ParseRequestKey

func ParseRequestKey(key string) (RequestKey, error)

ParseRequestKey parses key string to a structured RequestKey object. Example 1: key: [gatekeeper-system]docker.io/test/hello:v1 match slice: ["[gatekeeper-system]docker.io/test/hello:v1" "[gatekeeper-system]" "gatekeeper-system" "docker.io/test/hello:v1"] Example 2: key: docker.io/test/hello:v1 match slice: ["docker.io/test/hello:v1" "" "" "docker.io/test/hello:v1"]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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