github.com/nginxinc/kubernetes-ingress@v1.12.5/internal/configs/config_params.go (about) 1 package configs 2 3 import conf_v1alpha1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1alpha1" 4 5 // ConfigParams holds NGINX configuration parameters that affect the main NGINX config 6 // as well as configs for Ingress resources. 7 type ConfigParams struct { 8 ClientMaxBodySize string 9 DefaultServerAccessLogOff bool 10 DefaultServerReturn string 11 FailTimeout string 12 HealthCheckEnabled bool 13 HealthCheckMandatory bool 14 HealthCheckMandatoryQueue int64 15 HSTS bool 16 HSTSBehindProxy bool 17 HSTSIncludeSubdomains bool 18 HSTSMaxAge int64 19 HTTP2 bool 20 Keepalive int 21 LBMethod string 22 LocationSnippets []string 23 MainAccessLogOff bool 24 MainErrorLogLevel string 25 MainHTTPSnippets []string 26 MainKeepaliveRequests int64 27 MainKeepaliveTimeout string 28 MainLogFormat []string 29 MainLogFormatEscaping string 30 MainMainSnippets []string 31 MainOpenTracingEnabled bool 32 MainOpenTracingLoadModule bool 33 MainOpenTracingTracer string 34 MainOpenTracingTracerConfig string 35 MainServerNamesHashBucketSize string 36 MainServerNamesHashMaxSize string 37 MainStreamLogFormat []string 38 MainStreamLogFormatEscaping string 39 MainStreamSnippets []string 40 MainWorkerConnections string 41 MainWorkerCPUAffinity string 42 MainWorkerProcesses string 43 MainWorkerRlimitNofile string 44 MainWorkerShutdownTimeout string 45 MaxConns int 46 MaxFails int 47 AppProtectEnable string 48 AppProtectPolicy string 49 AppProtectLogConf string 50 AppProtectLogEnable string 51 MainAppProtectFailureModeAction string 52 MainAppProtectCookieSeed string 53 MainAppProtectCPUThresholds string 54 MainAppProtectPhysicalMemoryThresholds string 55 ProxyBuffering bool 56 ProxyBuffers string 57 ProxyBufferSize string 58 ProxyConnectTimeout string 59 ProxyHideHeaders []string 60 ProxyMaxTempFileSize string 61 ProxyPassHeaders []string 62 ProxyProtocol bool 63 ProxyReadTimeout string 64 ProxySendTimeout string 65 RedirectToHTTPS bool 66 ResolverAddresses []string 67 ResolverIPV6 bool 68 ResolverTimeout string 69 ResolverValid string 70 ServerSnippets []string 71 ServerTokens string 72 SlowStart string 73 SSLRedirect bool 74 UpstreamZoneSize string 75 VariablesHashBucketSize uint64 76 VariablesHashMaxSize uint64 77 78 RealIPHeader string 79 RealIPRecursive bool 80 SetRealIPFrom []string 81 82 MainServerSSLCiphers string 83 MainServerSSLDHParam string 84 MainServerSSLDHParamFileContent *string 85 MainServerSSLPreferServerCiphers bool 86 MainServerSSLProtocols string 87 88 IngressTemplate *string 89 VirtualServerTemplate *string 90 MainTemplate *string 91 92 JWTKey string 93 JWTLoginURL string 94 JWTRealm string 95 JWTToken string 96 97 Ports []int 98 SSLPorts []int 99 100 SpiffeServerCerts bool 101 } 102 103 // StaticConfigParams holds immutable NGINX configuration parameters that affect the main NGINX config. 104 type StaticConfigParams struct { 105 HealthStatus bool 106 HealthStatusURI string 107 NginxStatus bool 108 NginxStatusAllowCIDRs []string 109 NginxStatusPort int 110 StubStatusOverUnixSocketForOSS bool 111 TLSPassthrough bool 112 EnableSnippets bool 113 NginxServiceMesh bool 114 EnableInternalRoutes bool 115 MainAppProtectLoadModule bool 116 PodName string 117 EnableLatencyMetrics bool 118 EnablePreviewPolicies bool 119 SSLRejectHandshake bool 120 } 121 122 // GlobalConfigParams holds global configuration parameters. For now, it only holds listeners. 123 // GlobalConfigParams should replace ConfigParams in the future. 124 type GlobalConfigParams struct { 125 Listeners map[string]Listener 126 } 127 128 // Listener represents a listener that can be used in a TransportServer resource. 129 type Listener struct { 130 Port int 131 Protocol string 132 } 133 134 // NewDefaultConfigParams creates a ConfigParams with default values. 135 func NewDefaultConfigParams() *ConfigParams { 136 return &ConfigParams{ 137 DefaultServerReturn: "404", 138 ServerTokens: "on", 139 ProxyConnectTimeout: "60s", 140 ProxyReadTimeout: "60s", 141 ProxySendTimeout: "60s", 142 ClientMaxBodySize: "1m", 143 SSLRedirect: true, 144 MainServerNamesHashBucketSize: "256", 145 MainServerNamesHashMaxSize: "1024", 146 ProxyBuffering: true, 147 MainWorkerProcesses: "auto", 148 MainWorkerConnections: "1024", 149 HSTSMaxAge: 2592000, 150 Ports: []int{80}, 151 SSLPorts: []int{443}, 152 MaxFails: 1, 153 MaxConns: 0, 154 UpstreamZoneSize: "256k", 155 FailTimeout: "10s", 156 LBMethod: "random two least_conn", 157 MainErrorLogLevel: "notice", 158 ResolverIPV6: true, 159 MainKeepaliveTimeout: "65s", 160 MainKeepaliveRequests: 100, 161 VariablesHashBucketSize: 256, 162 VariablesHashMaxSize: 1024, 163 } 164 } 165 166 // NewDefaultGlobalConfigParams creates a GlobalConfigParams with default values. 167 func NewDefaultGlobalConfigParams() *GlobalConfigParams { 168 return &GlobalConfigParams{Listeners: map[string]Listener{}} 169 } 170 171 // NewGlobalConfigParamsWithTLSPassthrough creates new GlobalConfigParams with enabled TLS Passthrough listener. 172 func NewGlobalConfigParamsWithTLSPassthrough() *GlobalConfigParams { 173 return &GlobalConfigParams{ 174 Listeners: map[string]Listener{ 175 conf_v1alpha1.TLSPassthroughListenerName: { 176 Protocol: conf_v1alpha1.TLSPassthroughListenerProtocol, 177 }, 178 }, 179 } 180 }