Documentation ¶
Index ¶
- Variables
- func AutopilotResourceMutation(annotation string) (map[string]corev1.ResourceRequirements, map[string]corev1.ResourceRequirements, ...)
- func EnvBool(key string, def bool) bool
- func EnvFloat(key string, def float64) float64
- func EnvInt(key string, def int) int
- func EnvString(key, def string) string
- func IsAutopilotManagedNamespace(o client.Object) bool
- func IsGKEAutopilotCluster(c client.Client) (bool, error)
- func IsRequestTooLargeError(err error) bool
- func UpdateSymlink(helmRoot, linkAbsPath, packageDir, oldPackageDir string) error
- func WaitTime(seconds float64) time.Duration
- type ContainerResources
- type PodResources
- type ResourceMutation
Constants ¶
This section is empty.
Variables ¶
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.
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
IsAutopilotManagedNamespace returns if the input object is a namespace managed by the Autopilot cluster.
func IsGKEAutopilotCluster ¶
IsGKEAutopilotCluster returns if the cluster is an autopilot cluster. Currently, only Autopilot clusters have node with the prefix `gk3-`, so we can use the node prefix to check the cluster type. GKE Autopilot scales to zero nodes since 1.21 when there is no user workloads. In the case of zero node, check the existence of the policycontrollerv2.config.common-webhooks.networking.gke.io validatingWebhookConfiguration. It exists on Autopilot clusters after GKE 1.20.
func IsRequestTooLargeError ¶
IsRequestTooLargeError determines whether `err` was caused by a large request.
References:
func UpdateSymlink ¶
UpdateSymlink updates the symbolic link to the package directory.
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. |