util

package
v1.14.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AutopilotManagedKinds = []schema.GroupVersionKind{

	admissionregistrationv1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration"),
	admissionregistrationv1.SchemeGroupVersion.WithKind("MutatingWebhookConfigurationList"),
}

AutopilotManagedKinds tracks the GVKs that are managed by GKE autopilot. ACM should not mutate resources with the same GVKs.

View Source
var AutopilotManagedNamespaces = map[string]bool{

	metav1.NamespaceSystem: true,
}

AutopilotManagedNamespaces tracks the namespaces that are managed by GKE autopilot. ACM should not mutate or create any resources in these namespaces.

Functions

func AutopilotResourceMutation

func AutopilotResourceMutation(annotation string) (map[string]corev1.ResourceRequirements, map[string]corev1.ResourceRequirements, error)

AutopilotResourceMutation extracts the input and output resource requirements for all containers. - input describes the containers' resources before Autopilot adjustment. - output describes the resources after Autopilot adjustment.

func EnvBool

func EnvBool(key string, def bool) bool

EnvBool retrieves the boolean value of the environment variable named by the key. If the variable is not present, it returns default value.

func EnvFloat

func EnvFloat(key string, def float64) float64

EnvFloat retrieves the float value of the environment variable named by the key. If the variable is not present, it returns default value.

func EnvInt

func EnvInt(key string, def int) int

EnvInt retrieves the int value of the environment variable named by the key. If the variable is not present, it returns default value.

func EnvString

func EnvString(key, def string) string

EnvString retrieves the string value of the environment variable named by the key. If the variable is not present, it returns default value.

func IsAutopilotManagedNamespace

func IsAutopilotManagedNamespace(o client.Object) bool

IsAutopilotManagedNamespace returns if the input object is a namespace managed by the Autopilot cluster.

func IsGKEAutopilotCluster

func IsGKEAutopilotCluster(c client.Client) (bool, error)

IsGKEAutopilotCluster returns if the cluster is an autopilot cluster. It leverages the existence of the workload-defaulter mutating webhook configuration, which exists and only exists on the Autopilot clusters.

func UpdateSymlink(helmRoot, linkAbsPath, packageDir, oldPackageDir string) error

UpdateSymlink updates the symbolic link to the package directory.

func WaitTime

func WaitTime(seconds float64) time.Duration

WaitTime returns the wait time between syncs in time.Duration type.

Types

type ContainerResources

type ContainerResources struct {
	// Compute Resources required by this container.
	corev1.ResourceRequirements
	// Name of the container specified as a DNS_LABEL.
	Name string `json:"name"`
}

ContainerResources describes the container's resource requirements.

type PodResources

type PodResources struct {
	// List of initialization containers belonging to the pod.
	InitContainers []ContainerResources `json:"initContainers,omitempty"`
	// List of containers belonging to the pod.
	Containers []ContainerResources `json:"containers,omitempty"`
}

PodResources describes the resources of all containers in a Pod.

type ResourceMutation

type ResourceMutation struct {
	// Input describes the container resources before the mutation.
	Input *PodResources `json:"input,omitempty"`
	// Output describes the container resources after the mutation.
	Output *PodResources `json:"output,omitempty"`
	// Modified indicates whether the resources are modified.
	Modified bool `json:"modified"`
}

ResourceMutation describes the mutation made by Autopilot.

Directories

Path Synopsis
Package watch includes a RestartableManager for dynamically watching resources.
Package watch includes a RestartableManager for dynamically watching resources.

Jump to

Keyboard shortcuts

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