Documentation
¶
Index ¶
- Constants
- func CreateClientProxy(settings *AppSettings, rewriteRules *rewriter.RewriteRules) *server.HTTPServer
- func CreateMonitoringServer(settings *AppSettings) *server.HTTPServer
- func CreatePprofServer(settings *AppSettings) *server.HTTPServer
- func CreateWebhookProxy(settings *AppSettings, rewriteRules *rewriter.RewriteRules) *server.HTTPServer
- func RegisterAllMetrics()
- func RunServers(httpServers HTTPServers) int
- func SetupLogging(settings *AppSettings)
- func Start(settings *AppSettings, rewriteRules *rewriter.RewriteRules)
- func StartFromEnv(rewriteRules *rewriter.RewriteRules)
- type AppSettings
- type HTTPServers
Constants ¶
const ( ClientProxyEnv = "CLIENT_PROXY" ClientProxyAddressEnv = "CLIENT_PROXY_ADDRESS" ClientProxyPortEnv = "CLIENT_PROXY_PORT" WebhookListenAddrEnv = "WEBHOOK_LISTEN_ADDRESS" WebhookListenPortEnv = "WEBHOOK_LISTEN_PORT" )
const ( LogLevelEnv = "LOG_LEVEL" LogFormatEnv = "LOG_FORMAT" LogOutputEnv = "LOG_OUTPUT" )
const ( MonitoringBindAddressEnv = "MONITORING_BIND_ADDRESS" DefaultMonitoringBindAddress = ":9090" PprofBindAddressEnv = "PPROF_BIND_ADDRESS" )
Variables ¶
This section is empty.
Functions ¶
func CreateClientProxy ¶
func CreateClientProxy(settings *AppSettings, rewriteRules *rewriter.RewriteRules) *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) *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
// 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
type HTTPServers ¶
type HTTPServers struct {
Monitoring *server.HTTPServer
Pprof *server.HTTPServer
ClientProxy *server.HTTPServer
WebhookProxy *server.HTTPServer
}