Documentation ¶
Index ¶
- Variables
- func AutopilotResourceMutation(annotation string) (map[string]corev1.ResourceRequirements, map[string]corev1.ResourceRequirements, ...)
- func BackoffWithDurationAndStepLimit(duration time.Duration, steps int) wait.Backoff
- func EnvBool(key string, def bool) bool
- func EnvFloat(key string, def float64) float64
- func EnvInt(key string, def int) int
- func EnvList(key string, def []string) []string
- func EnvString(key, def string) string
- func FakeAutopilotWebhookObject() client.Object
- func IsAutopilotManagedNamespace(o client.Object) bool
- func IsErrorRetriable(err error) bool
- func IsGKEAutopilotCluster(c client.Client) (bool, error)
- func IsRequestTooLargeError(err error) bool
- func NewRetriableError(err error) error
- func RetryWithBackoff(backoff wait.Backoff, f func() error) error
- func UpdateSymlink(helmRoot, linkAbsPath, packageDir, oldPackageDir string) error
- func WaitTime(seconds float64) time.Duration
- type ContainerResources
- type PodResources
- type ResourceMutation
- type RetriableError
Constants ¶
This section is empty.
Variables ¶
var ( // SourceRetryBackoff sets retry timeout for `SourceCommitAndDirWithRetry`. SourceRetryBackoff = BackoffWithDurationAndStepLimit(5*time.Minute, 10) // HydratedRetryBackoff sets retry timeout for `readHydratedDirWithRetry`. HydratedRetryBackoff = BackoffWithDurationAndStepLimit(time.Minute, 10) // MinimumSyncContainerBackoffCap is the minimum backoff cap for oci-sync/helm-sync. MinimumSyncContainerBackoffCap = time.Hour )
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 BackoffWithDurationAndStepLimit ¶ added in v1.18.3
BackoffWithDurationAndStepLimit returns backoff with a duration limit. Here is an example of the duration between steps:
1.055843837s, 2.085359785s, 4.229560375s, 8.324724174s, 16.295984061s, 34.325711987s, 1m5.465642392s, 2m18.625713221s, 4m24.712222056s, 9m18.97652295s.
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 EnvList ¶ added in v1.16.0
EnvList retrieves the comma delimited list 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 FakeAutopilotWebhookObject ¶ added in v1.17.0
FakeAutopilotWebhookObject returns a fake empty MutatingWebhookConfiguration that satisfies IsGKEAutopilotCluster, for testing.
func IsAutopilotManagedNamespace ¶
IsAutopilotManagedNamespace returns if the input object is a namespace managed by the Autopilot cluster.
func IsErrorRetriable ¶ added in v1.16.2
IsErrorRetriable returns if the error is retriable.
func IsGKEAutopilotCluster ¶
IsGKEAutopilotCluster returns if the cluster is an autopilot cluster. It determines an Autopilot cluster by the presence of autopilot webhooks.
func IsRequestTooLargeError ¶
IsRequestTooLargeError determines whether `err` was caused by a large request.
References:
func NewRetriableError ¶ added in v1.16.2
NewRetriableError returns a RetriableError
func RetryWithBackoff ¶ added in v1.16.2
RetryWithBackoff retries the function with the default backoff with a given retry limit.
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.
type RetriableError ¶ added in v1.16.2
type RetriableError struct {
// contains filtered or unexported fields
}
RetriableError represents a transient error that is retriable.
func (*RetriableError) Error ¶ added in v1.16.2
func (r *RetriableError) Error() string
Error implements the Error function of the interface.
Directories ¶
Path | Synopsis |
---|---|
Package watch includes a RestartableManager for dynamically watching resources.
|
Package watch includes a RestartableManager for dynamically watching resources. |