webhook

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package webhook implements the client half of the EphemeralReview contract.

Index

Constants

View Source
const DefaultMaxResponseBytes int64 = 3 * 1024 * 1024

DefaultMaxResponseBytes bounds how large a webhook response body may be. A webhook must not be able to return an object larger than kcp would accept on the way in.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client calls one provider webhook.

func (*Client) Call

Call POSTs the review and returns the webhook's response.

There is deliberately no retry: the webhook is authoritative on every request and retrying an unknown-outcome call is the client's business, not kcp's.

func (*Client) URL

func (c *Client) URL() string

URL returns the endpoint this client calls, for logging and error messages.

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory builds and caches one Client per configured webhook.

func NewFactory

func NewFactory(opts Options) *Factory

NewFactory returns a Factory applying opts to every client it builds.

func (*Factory) New

New builds a Client for a webhook configuration. Certificates are read once, here, so that a misconfigured entry fails at startup rather than on the first request.

type Options

type Options struct {
	// AllowPrivateAddresses permits webhook endpoints that resolve to loopback,
	// link-local, or private addresses.
	//
	// Off by default: a virtual workspace typically runs inside a cluster, and
	// an endpoint pointing at 169.254.169.254 or a pod IP would turn it into a
	// confused deputy that reads cluster-internal data on behalf of whoever
	// configured it.
	AllowPrivateAddresses bool

	// MaxResponseBytes bounds the response body. Defaults to
	// DefaultMaxResponseBytes.
	MaxResponseBytes int64
}

Options tune every client built by a Factory.

Jump to

Keyboard shortcuts

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