app

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ClientProxyEnv        = "CLIENT_PROXY"
	ClientProxyAddressEnv = "CLIENT_PROXY_ADDRESS"
	ClientProxyPortEnv    = "CLIENT_PROXY_PORT"
	WebhookListenAddrEnv  = "WEBHOOK_LISTEN_ADDRESS"
	WebhookListenPortEnv  = "WEBHOOK_LISTEN_PORT"
)
View Source
const (
	LogLevelEnv  = "LOG_LEVEL"
	LogFormatEnv = "LOG_FORMAT"
	LogOutputEnv = "LOG_OUTPUT"
)
View Source
const (
	MonitoringBindAddressEnv     = "MONITORING_BIND_ADDRESS"
	MonitoringAuthEnv            = "MONITORING_AUTH"
	DefaultMonitoringBindAddress = ":9090"
	PprofBindAddressEnv          = "PPROF_BIND_ADDRESS"
)

Variables

This section is empty.

Functions

func CreateClientProxy

func CreateClientProxy(settings *AppSettings, rewriteRules *rewriter.RewriteRules, config *target.Kubernetes) *server.HTTPServer

CreateClientProxy returns a rewriter proxy that listens for requests from the controller and sends them to the Kubernetes API server.

func CreateMonitoringServer

func CreateMonitoringServer(settings *AppSettings, config *target.Kubernetes) *server.HTTPServer

CreateMonitoringServer returns a monitoring server with metrics and healthz probes.

func CreatePprofServer

func CreatePprofServer(settings *AppSettings) *server.HTTPServer

CreatePprofServer returns a pprof server if bind address is specified.

func CreateWebhookProxy

func CreateWebhookProxy(settings *AppSettings, rewriteRules *rewriter.RewriteRules) *server.HTTPServer

CreateWebhookProxy returns a rewriter proxy that listens for requests from the Kubernetes API server and sends them to the local webhook server.

func RegisterAllMetrics

func RegisterAllMetrics()

RegisterAllMetrics init prometheus client and register common and application specific metrics.

func RunServers

func RunServers(httpServers HTTPServers) int

func SetupLogging

func SetupLogging(settings *AppSettings)

func Start

func Start(settings *AppSettings, rewriteRules *rewriter.RewriteRules)

func StartFromEnv

func StartFromEnv(rewriteRules *rewriter.RewriteRules)

StartFromEnv starts application using settings from environment variables.

Types

type AppSettings

type AppSettings struct {
	// ClientProxy is a flag that may disable client proxy. Client proxy can be disabled at runtime with CLIENT_PROXY=no environment variable.
	ClientProxy string
	// ClientProxyAddress is an address to listen for incoming client requests. Default is 127.0.0.1. Can be set at runtime with CLIENT_PROXY_ADDRESS environment variable.
	ClientProxyAddress string
	// ClientProxyPort is a port to listen for incoming client requests. Default is 23915. Can be set at runtime with CLIENT_PROXY_ADDRESS environment variable.
	ClientProxyPort string

	// WebhookProxyAddress is an address to listen for incoming webhook requests from Kubernetes API server. Default is 0.0.0.0. Can be set at runtime with WEBHOOK_PROXY_ADDRESS environment variable.
	WebhookProxyAddress string
	// WebhookProxyPort is a port to listen for incoming client requests from Kubernetes API server. Default is 24192. Can be set at runtime with WEBHOOK_PROXY_ADDRESS environment variable.
	WebhookProxyPort string

	// WebhookTargetSettings holds settings for the target end of the webhook proxy.
	WebhookTargetSettings target.WebhookTargetSettings

	// LogLevel is a level of logging (debug, info, error, warn). Default is info. Can be set at runtime with LOG_LEVEL environment variable.
	LogLevel string
	// LogFormat is a format of logging: json, text, or pretty. Default is json. Can be set at runtime with LOG_FORMAT environment variable.
	LogFormat string
	// LogOutput is a level of logging: stderr, stdout, discard. Default is stdout. Can be set at runtime with LOG_OUTPUT environment variable.
	LogOutput string

	// MonitoringBindAddress is a listen address for the metrics server. Default is :9090. Can be set at runtime with MONITORING_BIND_ADDRESS environment variable.
	MonitoringBindAddress string

	// MonitoringAuth holds settings for the authentication via kubernetes rbac
	MonitoringAuth *auth.ResourceAttributes

	// PprofBindAddress is a listen address for the pprof server. Should be set to enable pprof. Can be set at runtime with PPROF_BIND_ADDRESS environment variable.
	PprofBindAddress string
}

AppSettings configures kube-api-rewriter application.

func SettingsFromEnv

func SettingsFromEnv() (*AppSettings, error)

type HTTPServers

type HTTPServers struct {
	Monitoring   *server.HTTPServer
	Pprof        *server.HTTPServer
	ClientProxy  *server.HTTPServer
	WebhookProxy *server.HTTPServer
}

Jump to

Keyboard shortcuts

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