webhook

package
v1.13.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Workers is the number of workers for this controller
	Workers                   = 2
	ControllerName            = "webhook-controller"
	DefaultWebhookTimeout     = 10
	AnnotationLastRequestTime = "kyverno.io/last-request-time"
	IdleDeadline              = tickerInterval * 10
)

Variables

This section is empty.

Functions

func AddFinalizers added in v1.13.0

func AddFinalizers[T metav1.Object](ctx context.Context, client controllerutils.ObjectClient[T], name, finalizer string) error

func DeleteFinalizers added in v1.13.0

func DeleteFinalizers[T metav1.Object](ctx context.Context, client controllerutils.ObjectClient[T], name, finalizer string) error

func WebhookCleanupHandler added in v1.13.0

func WebhookCleanupHandler(
	kubeClient kubernetes.Interface,
	finalizer string,
) func(context.Context, logr.Logger) error

WebhookCleanupHandler is run after webhook configuration cleanup is performed to delete roles and service account. Admission controller cluster and namespaced roles and role bindings have finalizers to block their deletion until admission controller terminates. This handler removes the finalizers on roles and service account after they are used to cleanup webhook cfg. It does the following:

Deletes the cluster scoped rbac in order: a. Removes finalizers from controller cluster role binding b. Removes finalizers from controller core cluster role c. Removes finalizers from controller aggregated cluster role d. Temporary cluster role and cluster role binding created by WebhookCleanupSetup gets garbage collected after (c) automatically

Deletes the namespace scoped rbac in order: a. Removes finalizers from controller role binding. b. Removes finalizers from controller role. c. Removes finalizers from controller service account d. Temporary role and role binding created by WebhookCleanupSetup gets garbage collected after (c) automatically

func WebhookCleanupSetup added in v1.13.0

func WebhookCleanupSetup(
	kubeClient kubernetes.Interface,
	finalizer string,
) func(context.Context, logr.Logger) error

WebhookCleanupSetup creates temporary rbac owned by kyverno resources, these roles and cluster roles get automatically deleted when kyverno is uninstalled It creates the following resources:

  1. Creates a temporary cluster role binding to give permission to delete kyverno's cluster role and set its owner ref to aggregated cluster role itself.
  2. Creates a temporary role and role binding with permissions to delete a service account, roles and role bindings with owner ref set to the service account.

Types

This section is empty.

Jump to

Keyboard shortcuts

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