Documentation
¶
Overview ¶
Package webhook implements the client half of the EphemeralReview contract.
Index ¶
Constants ¶
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 ¶
func (c *Client) Call(ctx context.Context, review *ephemeralv1alpha1.EphemeralReview) (*ephemeralv1alpha1.EphemeralResponse, error)
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.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory builds and caches one Client per configured webhook.
func NewFactory ¶
NewFactory returns a Factory applying opts to every client it builds.
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.