reduce

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterHPAs

FilterHPAs filters out the HorizontalPodAutoscalers to be kept and returns all the HorizontalPodAutoscalers to be deleted. The filtered-out HorizontalPodAutoscalers is decided as follows: 1. creationTimestamp (older is better)

func FilterNone

func FilterNone[T any](objs []T) []T

FiltenNone filter nothing, that is it returns the same slice as provided.

func ReduceClusterRoleBindings

func ReduceClusterRoleBindings(ctx context.Context, k8sClient client.Client, clusterRoleBindings []rbacv1.ClusterRoleBinding) error

ReduceClusterRoleBindings detects the best ClusterRoleBinding in the set and deletes all the others.

func ReduceClusterRoles

func ReduceClusterRoles(ctx context.Context, k8sClient client.Client, clusterRoles []rbacv1.ClusterRole) error

ReduceClusterRoles detects the best ClusterRole in the set and deletes all the others.

func ReduceDataPlanes added in v1.2.2

func ReduceDataPlanes(ctx context.Context, k8sClient client.Client, dataplanes []operatorv1beta1.DataPlane) error

ReduceDataPlanes detects the best DataPlane in the set and deletes all the others.

func ReduceDeployments

func ReduceDeployments(ctx context.Context, k8sClient client.Client, deployments []appsv1.Deployment, preDeleteHooks ...PreDeleteHook) error

ReduceDeployments detects the best Deployment in the set and deletes all the others. It accepts optional preDeleteHooks which are executed before every Deployment delete operation.

func ReduceHPAs

func ReduceHPAs(ctx context.Context, k8sClient client.Client, hpas []autoscalingv2.HorizontalPodAutoscaler, filter HPAFilterFunc) error

ReduceHPAs detects the best HorizontalPodAutoscaler in the set and deletes all the others.

func ReduceNetworkPolicies

func ReduceNetworkPolicies(ctx context.Context, k8sClient client.Client, networkPolicies []networkingv1.NetworkPolicy) error

ReduceNetworkPolicies detects the best NetworkPolicy in the set and deletes all the others.

func ReduceSecrets

func ReduceSecrets(ctx context.Context, k8sClient client.Client, secrets []corev1.Secret, preDeleteHooks ...PreDeleteHook) error

ReduceSecrets detects the best secret in the set and deletes all the others. It accepts optional preDeleteHooks which are executed before every Secret delete operation.

func ReduceServiceAccounts

func ReduceServiceAccounts(ctx context.Context, k8sClient client.Client, serviceAccounts []corev1.ServiceAccount) error

ReduceServiceAccounts detects the best serviceAccount in the set and deletes all the others.

func ReduceServices

func ReduceServices(ctx context.Context, k8sClient client.Client, services []corev1.Service, preDeleteHooks ...PreDeleteHook) error

ReduceServices detects the best Service in the set and deletes all the others. It accepts optional preDeleteHooks which are executed before every Service delete operation.

func ReduceValidatingWebhookConfigurations

func ReduceValidatingWebhookConfigurations(ctx context.Context, k8sClient client.Client, webhookConfigurations []admregv1.ValidatingWebhookConfiguration) error

ReduceValidatingWebhookConfigurations detects the best ValidatingWebhookConfiguration in the set and deletes all the others.

Types

type HPAFilterFunc

HPAFilterFunc filters a list of HorizontalPodAutoscalers.

type PreDeleteHook

type PreDeleteHook func(ctx context.Context, cl client.Client, obj client.Object) error

PreDeleteHook is a function that can be executed before deleting an object.

Jump to

Keyboard shortcuts

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