containerinstance

package
v0.0.229 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RegexFormatted    = regexp.MustCompile(strings.Join([]string{helpers.PrefixApiVersion + anyGroup, helpers.PrefixNamespace + anyNoSlash, helpers.PrefixKind + anyNoSlash, helpers.PrefixName + anyNoSlash, anyNoSlash + "Name-" + anyNoSlash}, helpers.StringFormatSeparator))
	StringFormatted   = strings.Join([]string{helpers.PrefixApiVersion + "%s", helpers.PrefixNamespace + "%s", helpers.PrefixKind + "%s", helpers.PrefixName + "%s", "%sName-%s"}, helpers.StringFormatSeparator)
	RegexNoContainer  = regexp.MustCompile(strings.Join([]string{helpers.PrefixApiVersion + anyGroup, helpers.PrefixNamespace + anyNoSlash, helpers.PrefixKind + anyNoSlash, helpers.PrefixName + anyNoSlash}, helpers.StringFormatSeparator))
	StringNoContainer = strings.Join([]string{helpers.PrefixApiVersion + "%s", helpers.PrefixNamespace + "%s", helpers.PrefixKind + "%s", helpers.PrefixName + "%s"}, helpers.StringFormatSeparator)
)

Functions

This section is empty.

Types

type InstanceID

type InstanceID struct {
	ApiVersion    string
	Namespace     string
	Kind          string
	Name          string
	AlternateName string
	ContainerName string
	InstanceType  string
	TemplateHash  string
}

func GenerateInstanceIDFromString

func GenerateInstanceIDFromString(input string) (*InstanceID, error)

GenerateInstanceIDFromString generates instance ID from string. The string format is: apiVersion-<apiVersion>/namespace-<namespace>/kind-<kind>/name-<name>/containerName-<containerName>

For Job workloads (Kind == "Job"), this function uses a best-effort heuristic to recover AlternateName and TemplateHash when the Job name ends in a suffix produced by the CronJob pod template hasher (rand.SafeEncodeString). Because the serialized string format does not preserve provenance metadata, standalone literal Jobs whose names happen to end in matching suffixes (such as "backup-db" or "backup-4") will also have those suffixes parsed as template hashes.

func ListInstanceIDs added in v0.0.170

func ListInstanceIDs(ownerReference *metav1.OwnerReference, containers []corev1.Container, instanceType, apiVersion, namespace, kind, name, alternateName, templateHash string) ([]InstanceID, error)

func (*InstanceID) GetContainerName

func (id *InstanceID) GetContainerName() string

func (*InstanceID) GetHashed

func (id *InstanceID) GetHashed() string

func (*InstanceID) GetInstanceType added in v0.0.159

func (id *InstanceID) GetInstanceType() helpers.InstanceType

func (*InstanceID) GetLabels

func (id *InstanceID) GetLabels() map[string]string

func (*InstanceID) GetName

func (id *InstanceID) GetName() string

func (*InstanceID) GetOneTimeSlug added in v0.0.197

func (id *InstanceID) GetOneTimeSlug(noContainer bool) (string, error)

func (*InstanceID) GetSlug

func (id *InstanceID) GetSlug(noContainer bool) (string, error)

func (*InstanceID) GetStringFormatted

func (id *InstanceID) GetStringFormatted() string

func (*InstanceID) GetStringNoContainer added in v0.0.176

func (id *InstanceID) GetStringNoContainer() string

func (*InstanceID) GetTemplateHash added in v0.0.195

func (id *InstanceID) GetTemplateHash() string

Jump to

Keyboard shortcuts

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