httpserver

package
v2.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartHealthCheckServer

func StartHealthCheckServer(ctx context.Context, opts HealthCheckOptions) error

StartHealthCheckServer starts a plaintext HTTP server that exposes the liveness (/healthz) and readiness (/readyz) probe endpoints. The server uses plaintext HTTP (no mTLS) because the kubelet performing the probes cannot present a client certificate. It blocks until the provided context is cancelled or the server fails to serve.

func StartServer

func StartServer(opts *ServerOptions, executorConfigPath string) error

StartServer initializes and starts the Ratify server with provided options and configuration file path.

Types

type HealthCheckOptions

type HealthCheckOptions struct {
	// Address is the address where the health check server listens for
	// liveness and readiness probes. It should be in the format "host:port"
	// (e.g., ":9099").
	// Required.
	Address string

	// CertRotatorReady is closed when TLS certificate rotation has completed.
	// While it is open, the readiness probe reports not ready so that
	// Gatekeeper does not route verification traffic to a pod that cannot yet
	// serve TLS. If nil, cert rotation is disabled and the pod is considered
	// ready as soon as the health check server starts.
	// Optional.
	CertRotatorReady chan struct{}

	// ExecutorReady reports whether the executor has been loaded into memory.
	// While it returns false, the readiness probe reports not ready so that
	// Gatekeeper does not route verification traffic to a pod that would fail
	// with "no valid executor configured". If nil, readiness does not wait for
	// the executor (e.g. when it is loaded synchronously at startup).
	// Optional.
	ExecutorReady func() bool
}

HealthCheckOptions holds the configuration for the health check server.

type ServerOptions

type ServerOptions struct {
	// HTTPServerAddress is the address where the server will listen for
	// incoming requests.
	// It should be in the format "host:port" (e.g., ":8080").
	// Required.
	HTTPServerAddress string

	// CertFile is the path to the TLS certificate file. If not provided, the
	// server will run without TLS.
	// Optional.
	CertFile string

	// KeyFile is the path to the TLS key file. If not provided, the server
	// will run without TLS.
	// Optional.
	KeyFile string

	// GatekeeperCACertFile is the path to the Gatekeeper CA certificate file.
	// Optional.
	GatekeeperCACertFile string

	// VerifyTimeout is the duration to wait for a verification request to
	// complete before timing out. Default is 5 seconds if not specified.
	// Optional.
	VerifyTimeout time.Duration

	// MutateTimeout is the duration to wait for a mutation request to
	// complete before timing out. Default is 2 seconds if not specified.
	// Optional.
	MutateTimeout time.Duration

	// DisableMutation indicates whether to disable the mutation handler.
	// If set to true, the mutation handler will not be registered.
	// Optional.
	DisableMutation bool

	// DisableCRDManager indicates whether to disable the CRD manager.
	// If set to true, the server will not use the CRD manager for managing
	// executors and will instead rely on a static configuration file.
	// Optional.
	DisableCRDManager bool

	// CertRotatorReady is a channel that signals when the certificate rotator
	// is ready. If not provided, the server will run without rotating the TLS
	// certificates.
	// Optional.
	CertRotatorReady chan struct{}
}

ServerOptions holds the configuration options for the Ratify server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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