reduce

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 17 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 FilterPodDisruptionBudgets added in v1.4.0

func FilterPodDisruptionBudgets(pdbs []policyv1.PodDisruptionBudget) []policyv1.PodDisruptionBudget

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

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 ReduceKongPluginBindings added in v1.4.0

func ReduceKongPluginBindings(ctx context.Context, k8sClient client.Client, kpbs []configurationv1alpha1.KongPluginBinding) error

ReduceKongPluginBindings detects the best KongPluginBinding 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 ReducePodDisruptionBudgets added in v1.4.0

func ReducePodDisruptionBudgets(ctx context.Context, k8sClient client.Client, pdbs []policyv1.PodDisruptionBudget, filter PDBFilterFunc) error

ReducePodDisruptionBudgets detects the best PodDisruptionBudget 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 and returns the ones that should be deleted.

type PDBFilterFunc added in v1.4.0

PDBFilterFunc filters a list of PodDisruptionBudgets and returns the ones that should be deleted.

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