config

package
v0.21.150 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0, MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigFile string
	Flags      *flag.FlagSet

	// generic:
	Address                         string         `yaml:"address"`
	InsecureAddress                 string         `yaml:"insecure-address"`
	EnableTCPQueue                  bool           `yaml:"enable-tcp-queue"`
	ExpectedBytesPerRequest         int            `yaml:"expected-bytes-per-request"`
	MaxTCPListenerConcurrency       int            `yaml:"max-tcp-listener-concurrency"`
	MaxTCPListenerQueue             int            `yaml:"max-tcp-listener-queue"`
	IgnoreTrailingSlash             bool           `yaml:"ignore-trailing-slash"`
	Insecure                        bool           `yaml:"insecure"`
	ProxyPreserveHost               bool           `yaml:"proxy-preserve-host"`
	DevMode                         bool           `yaml:"dev-mode"`
	SupportListener                 string         `yaml:"support-listener"`
	DebugListener                   string         `yaml:"debug-listener"`
	CertPathTLS                     string         `yaml:"tls-cert"`
	KeyPathTLS                      string         `yaml:"tls-key"`
	StatusChecks                    *listFlag      `yaml:"status-checks"`
	PrintVersion                    bool           `yaml:"version"`
	MaxLoopbacks                    int            `yaml:"max-loopbacks"`
	DefaultHTTPStatus               int            `yaml:"default-http-status"`
	PluginDir                       string         `yaml:"plugindir"`
	LoadBalancerHealthCheckInterval time.Duration  `yaml:"lb-healthcheck-interval"`
	ReverseSourcePredicate          bool           `yaml:"reverse-source-predicate"`
	RemoveHopHeaders                bool           `yaml:"remove-hop-headers"`
	RfcPatchPath                    bool           `yaml:"rfc-patch-path"`
	MaxAuditBody                    int            `yaml:"max-audit-body"`
	MaxMatcherBufferSize            uint64         `yaml:"max-matcher-buffer-size"`
	EnableBreakers                  bool           `yaml:"enable-breakers"`
	Breakers                        breakerFlags   `yaml:"breaker"`
	EnableRatelimiters              bool           `yaml:"enable-ratelimits"`
	Ratelimits                      ratelimitFlags `yaml:"ratelimits"`
	EnableRouteFIFOMetrics          bool           `yaml:"enable-route-fifo-metrics"`
	EnableRouteLIFOMetrics          bool           `yaml:"enable-route-lifo-metrics"`
	MetricsFlavour                  *listFlag      `yaml:"metrics-flavour"`
	FilterPlugins                   *pluginFlag    `yaml:"filter-plugin"`
	PredicatePlugins                *pluginFlag    `yaml:"predicate-plugin"`
	DataclientPlugins               *pluginFlag    `yaml:"dataclient-plugin"`
	MultiPlugins                    *pluginFlag    `yaml:"multi-plugin"`
	CompressEncodings               *listFlag      `yaml:"compress-encodings"`

	// logging, metrics, profiling, tracing:
	EnablePrometheusMetrics             bool      `yaml:"enable-prometheus-metrics"`
	EnablePrometheusStartLabel          bool      `yaml:"enable-prometheus-start-label"`
	OpenTracing                         string    `yaml:"opentracing"`
	OpenTracingInitialSpan              string    `yaml:"opentracing-initial-span"`
	OpenTracingExcludedProxyTags        string    `yaml:"opentracing-excluded-proxy-tags"`
	OpenTracingDisableFilterSpans       bool      `yaml:"opentracing-disable-filter-spans"`
	OpentracingLogFilterLifecycleEvents bool      `yaml:"opentracing-log-filter-lifecycle-events"`
	OpentracingLogStreamEvents          bool      `yaml:"opentracing-log-stream-events"`
	OpentracingBackendNameTag           bool      `yaml:"opentracing-backend-name-tag"`
	MetricsListener                     string    `yaml:"metrics-listener"`
	MetricsPrefix                       string    `yaml:"metrics-prefix"`
	EnableProfile                       bool      `yaml:"enable-profile"`
	BlockProfileRate                    int       `yaml:"block-profile-rate"`
	MutexProfileFraction                int       `yaml:"mutex-profile-fraction"`
	MemProfileRate                      int       `yaml:"memory-profile-rate"`
	DebugGcMetrics                      bool      `yaml:"debug-gc-metrics"`
	RuntimeMetrics                      bool      `yaml:"runtime-metrics"`
	ServeRouteMetrics                   bool      `yaml:"serve-route-metrics"`
	ServeRouteCounter                   bool      `yaml:"serve-route-counter"`
	ServeHostMetrics                    bool      `yaml:"serve-host-metrics"`
	ServeHostCounter                    bool      `yaml:"serve-host-counter"`
	ServeMethodMetric                   bool      `yaml:"serve-method-metric"`
	ServeStatusCodeMetric               bool      `yaml:"serve-status-code-metric"`
	BackendHostMetrics                  bool      `yaml:"backend-host-metrics"`
	AllFiltersMetrics                   bool      `yaml:"all-filters-metrics"`
	CombinedResponseMetrics             bool      `yaml:"combined-response-metrics"`
	RouteResponseMetrics                bool      `yaml:"route-response-metrics"`
	RouteBackendErrorCounters           bool      `yaml:"route-backend-error-counters"`
	RouteStreamErrorCounters            bool      `yaml:"route-stream-error-counters"`
	RouteBackendMetrics                 bool      `yaml:"route-backend-metrics"`
	RouteCreationMetrics                bool      `yaml:"route-creation-metrics"`
	MetricsUseExpDecaySample            bool      `yaml:"metrics-exp-decay-sample"`
	HistogramMetricBucketsString        string    `yaml:"histogram-metric-buckets"`
	HistogramMetricBuckets              []float64 `yaml:"-"`
	DisableMetricsCompat                bool      `yaml:"disable-metrics-compat"`
	ApplicationLog                      string    `yaml:"application-log"`
	ApplicationLogLevel                 log.Level `yaml:"-"`
	ApplicationLogLevelString           string    `yaml:"application-log-level"`
	ApplicationLogPrefix                string    `yaml:"application-log-prefix"`
	ApplicationLogJSONEnabled           bool      `yaml:"application-log-json-enabled"`
	AccessLog                           string    `yaml:"access-log"`
	AccessLogDisabled                   bool      `yaml:"access-log-disabled"`
	AccessLogJSONEnabled                bool      `yaml:"access-log-json-enabled"`
	AccessLogStripQuery                 bool      `yaml:"access-log-strip-query"`
	SuppressRouteUpdateLogs             bool      `yaml:"suppress-route-update-logs"`

	// route sources:
	EtcdUrls           string               `yaml:"etcd-urls"`
	EtcdPrefix         string               `yaml:"etcd-prefix"`
	EtcdTimeout        time.Duration        `yaml:"etcd-timeout"`
	EtcdInsecure       bool                 `yaml:"etcd-insecure"`
	EtcdOAuthToken     string               `yaml:"etcd-oauth-token"`
	EtcdUsername       string               `yaml:"etcd-username"`
	EtcdPassword       string               `yaml:"etcd-password"`
	RoutesFile         string               `yaml:"routes-file"`
	RoutesURLs         *listFlag            `yaml:"routes-urls"`
	InlineRoutes       string               `yaml:"inline-routes"`
	AppendFilters      *defaultFiltersFlags `yaml:"default-filters-append"`
	PrependFilters     *defaultFiltersFlags `yaml:"default-filters-prepend"`
	DisabledFilters    *listFlag            `yaml:"disabled-filters"`
	EditRoute          routeChangerConfig   `yaml:"edit-route"`
	CloneRoute         routeChangerConfig   `yaml:"clone-route"`
	SourcePollTimeout  int64                `yaml:"source-poll-timeout"`
	WaitFirstRouteLoad bool                 `yaml:"wait-first-route-load"`

	// Forwarded headers
	ForwardedHeadersList            *listFlag            `yaml:"forwarded-headers"`
	ForwardedHeaders                net.ForwardedHeaders `yaml:"-"`
	ForwardedHeadersExcludeCIDRList *listFlag            `yaml:"forwarded-headers-exclude-cidrs"`
	ForwardedHeadersExcludeCIDRs    net.IPNets           `yaml:"-"`

	// host patch:
	NormalizeHost bool          `yaml:"normalize-host"`
	HostPatch     net.HostPatch `yaml:"-"`

	ValidateQuery    bool      `yaml:"validate-query"`
	ValidateQueryLog bool      `yaml:"validate-query-log"`
	RefusePayload    multiFlag `yaml:"refuse-payload"`

	// Kubernetes:
	KubernetesIngress                       bool                               `yaml:"kubernetes"`
	KubernetesInCluster                     bool                               `yaml:"kubernetes-in-cluster"`
	KubernetesURL                           string                             `yaml:"kubernetes-url"`
	KubernetesTokenFile                     string                             `yaml:"kubernetes-token-file"`
	KubernetesHealthcheck                   bool                               `yaml:"kubernetes-healthcheck"`
	KubernetesHTTPSRedirect                 bool                               `yaml:"kubernetes-https-redirect"`
	KubernetesHTTPSRedirectCode             int                                `yaml:"kubernetes-https-redirect-code"`
	KubernetesDisableCatchAllRoutes         bool                               `yaml:"kubernetes-disable-catchall-routes"`
	KubernetesIngressClass                  string                             `yaml:"kubernetes-ingress-class"`
	KubernetesRouteGroupClass               string                             `yaml:"kubernetes-routegroup-class"`
	WhitelistedHealthCheckCIDR              string                             `yaml:"whitelisted-healthcheck-cidr"`
	KubernetesPathModeString                string                             `yaml:"kubernetes-path-mode"`
	KubernetesPathMode                      kubernetes.PathMode                `yaml:"-"`
	KubernetesNamespace                     string                             `yaml:"kubernetes-namespace"`
	KubernetesEnableEndpointSlices          bool                               `yaml:"enable-kubernetes-endpointslices"`
	KubernetesEnableEastWest                bool                               `yaml:"enable-kubernetes-east-west"`
	KubernetesEastWestDomain                string                             `yaml:"kubernetes-east-west-domain"`
	KubernetesEastWestRangeDomains          *listFlag                          `yaml:"kubernetes-east-west-range-domains"`
	KubernetesEastWestRangePredicatesString string                             `yaml:"kubernetes-east-west-range-predicates"`
	KubernetesEastWestRangePredicates       []*eskip.Predicate                 `yaml:"-"`
	KubernetesOnlyAllowedExternalNames      bool                               `yaml:"kubernetes-only-allowed-external-names"`
	KubernetesAllowedExternalNames          regexpListFlag                     `yaml:"kubernetes-allowed-external-names"`
	KubernetesRedisServiceNamespace         string                             `yaml:"kubernetes-redis-service-namespace"`
	KubernetesRedisServiceName              string                             `yaml:"kubernetes-redis-service-name"`
	KubernetesRedisServicePort              int                                `yaml:"kubernetes-redis-service-port"`
	KubernetesBackendTrafficAlgorithmString string                             `yaml:"kubernetes-backend-traffic-algorithm"`
	KubernetesBackendTrafficAlgorithm       kubernetes.BackendTrafficAlgorithm `yaml:"-"`
	KubernetesDefaultLoadBalancerAlgorithm  string                             `yaml:"kubernetes-default-lb-algorithm"`

	// Default filters
	DefaultFiltersDir string `yaml:"default-filters-dir"`

	// Auth:
	EnableOAuth2GrantFlow             bool          `yaml:"enable-oauth2-grant-flow"`
	Oauth2AuthURL                     string        `yaml:"oauth2-auth-url"`
	Oauth2TokenURL                    string        `yaml:"oauth2-token-url"`
	Oauth2RevokeTokenURL              string        `yaml:"oauth2-revoke-token-url"`
	Oauth2TokeninfoURL                string        `yaml:"oauth2-tokeninfo-url"`
	Oauth2TokeninfoTimeout            time.Duration `yaml:"oauth2-tokeninfo-timeout"`
	Oauth2TokeninfoCacheSize          int           `yaml:"oauth2-tokeninfo-cache-size"`
	Oauth2TokeninfoCacheTTL           time.Duration `yaml:"oauth2-tokeninfo-cache-ttl"`
	Oauth2SecretFile                  string        `yaml:"oauth2-secret-file"`
	Oauth2ClientID                    string        `yaml:"oauth2-client-id"`
	Oauth2ClientSecret                string        `yaml:"oauth2-client-secret"`
	Oauth2ClientIDFile                string        `yaml:"oauth2-client-id-file"`
	Oauth2ClientSecretFile            string        `yaml:"oauth2-client-secret-file"`
	Oauth2AuthURLParameters           mapFlags      `yaml:"oauth2-auth-url-parameters"`
	Oauth2CallbackPath                string        `yaml:"oauth2-callback-path"`
	Oauth2TokenintrospectionTimeout   time.Duration `yaml:"oauth2-tokenintrospect-timeout"`
	Oauth2AccessTokenHeaderName       string        `yaml:"oauth2-access-token-header-name"`
	Oauth2TokeninfoSubjectKey         string        `yaml:"oauth2-tokeninfo-subject-key"`
	Oauth2GrantTokeninfoKeys          *listFlag     `yaml:"oauth2-grant-tokeninfo-keys"`
	Oauth2TokenCookieName             string        `yaml:"oauth2-token-cookie-name"`
	Oauth2TokenCookieRemoveSubdomains int           `yaml:"oauth2-token-cookie-remove-subdomains"`
	Oauth2GrantInsecure               bool          `yaml:"oauth2-grant-insecure"`
	WebhookTimeout                    time.Duration `yaml:"webhook-timeout"`
	OidcSecretsFile                   string        `yaml:"oidc-secrets-file"`
	OIDCCookieValidity                time.Duration `yaml:"oidc-cookie-validity"`
	OidcDistributedClaimsTimeout      time.Duration `yaml:"oidc-distributed-claims-timeout"`
	CredentialPaths                   *listFlag     `yaml:"credentials-paths"`
	CredentialsUpdateInterval         time.Duration `yaml:"credentials-update-interval"`

	// TLS client certs
	ClientKeyFile  string            `yaml:"client-tls-key"`
	ClientCertFile string            `yaml:"client-tls-cert"`
	Certificates   []tls.Certificate `yaml:"-"`

	// TLS version
	TLSMinVersion string `yaml:"tls-min-version"`

	// Exclude insecure cipher suites
	ExcludeInsecureCipherSuites bool `yaml:"exclude-insecure-cipher-suites"`

	// TLS Config
	KubernetesEnableTLS bool `yaml:"kubernetes-enable-tls"`

	// API Monitoring
	ApiUsageMonitoringEnable                       bool   `yaml:"enable-api-usage-monitoring"`
	ApiUsageMonitoringRealmKeys                    string `yaml:"api-usage-monitoring-realm-keys"`
	ApiUsageMonitoringClientKeys                   string `yaml:"api-usage-monitoring-client-keys"`
	ApiUsageMonitoringDefaultClientTrackingPattern string `yaml:"api-usage-monitoring-default-client-tracking-pattern"`
	ApiUsageMonitoringRealmsTrackingPattern        string `yaml:"api-usage-monitoring-realms-tracking-pattern"`

	// connections, timeouts:
	WaitForHealthcheckInterval   time.Duration `yaml:"wait-for-healthcheck-interval"`
	IdleConnsPerHost             int           `yaml:"idle-conns-num"`
	CloseIdleConnsPeriod         time.Duration `yaml:"close-idle-conns-period"`
	BackendFlushInterval         time.Duration `yaml:"backend-flush-interval"`
	ExperimentalUpgrade          bool          `yaml:"experimental-upgrade"`
	ExperimentalUpgradeAudit     bool          `yaml:"experimental-upgrade-audit"`
	ReadTimeoutServer            time.Duration `yaml:"read-timeout-server"`
	ReadHeaderTimeoutServer      time.Duration `yaml:"read-header-timeout-server"`
	WriteTimeoutServer           time.Duration `yaml:"write-timeout-server"`
	IdleTimeoutServer            time.Duration `yaml:"idle-timeout-server"`
	MaxHeaderBytes               int           `yaml:"max-header-bytes"`
	EnableConnMetricsServer      bool          `yaml:"enable-connection-metrics"`
	TimeoutBackend               time.Duration `yaml:"timeout-backend"`
	KeepaliveBackend             time.Duration `yaml:"keepalive-backend"`
	EnableDualstackBackend       bool          `yaml:"enable-dualstack-backend"`
	TlsHandshakeTimeoutBackend   time.Duration `yaml:"tls-timeout-backend"`
	ResponseHeaderTimeoutBackend time.Duration `yaml:"response-header-timeout-backend"`
	ExpectContinueTimeoutBackend time.Duration `yaml:"expect-continue-timeout-backend"`
	MaxIdleConnsBackend          int           `yaml:"max-idle-connection-backend"`
	DisableHTTPKeepalives        bool          `yaml:"disable-http-keepalives"`

	// swarm:
	EnableSwarm bool `yaml:"enable-swarm"`
	// redis based
	SwarmRedisURLs               *listFlag     `yaml:"swarm-redis-urls"`
	SwarmRedisPassword           string        `yaml:"swarm-redis-password"`
	SwarmRedisHashAlgorithm      string        `yaml:"swarm-redis-hash-algorithm"`
	SwarmRedisDialTimeout        time.Duration `yaml:"swarm-redis-dial-timeout"`
	SwarmRedisReadTimeout        time.Duration `yaml:"swarm-redis-read-timeout"`
	SwarmRedisWriteTimeout       time.Duration `yaml:"swarm-redis-write-timeout"`
	SwarmRedisPoolTimeout        time.Duration `yaml:"swarm-redis-pool-timeout"`
	SwarmRedisMinConns           int           `yaml:"swarm-redis-min-conns"`
	SwarmRedisMaxConns           int           `yaml:"swarm-redis-max-conns"`
	SwarmRedisEndpointsRemoteURL string        `yaml:"swarm-redis-remote"`
	// swim based
	SwarmKubernetesNamespace          string        `yaml:"swarm-namespace"`
	SwarmKubernetesLabelSelectorKey   string        `yaml:"swarm-label-selector-key"`
	SwarmKubernetesLabelSelectorValue string        `yaml:"swarm-label-selector-value"`
	SwarmPort                         int           `yaml:"swarm-port"`
	SwarmMaxMessageBuffer             int           `yaml:"swarm-max-msg-buffer"`
	SwarmLeaveTimeout                 time.Duration `yaml:"swarm-leave-timeout"`
	SwarmStaticSelf                   string        `yaml:"swarm-static-self"`
	SwarmStaticOther                  string        `yaml:"swarm-static-other"`

	ClusterRatelimitMaxGroupShards int `yaml:"cluster-ratelimit-max-group-shards"`

	LuaModules *listFlag `yaml:"lua-modules"`
	LuaSources *listFlag `yaml:"lua-sources"`

	EnableOpenPolicyAgent               bool          `yaml:"enable-open-policy-agent"`
	OpenPolicyAgentConfigTemplate       string        `yaml:"open-policy-agent-config-template"`
	OpenPolicyAgentEnvoyMetadata        string        `yaml:"open-policy-agent-envoy-metadata"`
	OpenPolicyAgentCleanerInterval      time.Duration `yaml:"open-policy-agent-cleaner-interval"`
	OpenPolicyAgentStartupTimeout       time.Duration `yaml:"open-policy-agent-startup-timeout"`
	OpenPolicyAgentMaxRequestBodySize   int64         `yaml:"open-policy-agent-max-request-body-size"`
	OpenPolicyAgentMaxMemoryBodyParsing int64         `yaml:"open-policy-agent-max-memory-body-parsing"`

	PassiveHealthCheck mapFlags `yaml:"passive-health-check"`
}

func NewConfig

func NewConfig() *Config

func (*Config) Parse

func (c *Config) Parse() error

func (*Config) ParseArgs added in v0.15.40

func (c *Config) ParseArgs(progname string, args []string) error

func (*Config) ToOptions

func (c *Config) ToOptions() skipper.Options

Jump to

Keyboard shortcuts

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