diff --git a/README.md b/README.md index 8f682a362..9ff31b20c 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ You can find the generated HAProxy Configuration [here](hack/example/haproxy_gen - [Expose HAProxy stats for Prometheus](docs/user-guide/ingress/stats-and-prometheus.md) - [Supports AWS certificate manager](docs/user-guide/ingress/aws-cert-manager.md) - [Scale load balancer using HorizontalPodAutoscaling](docs/user-guide/ingress/replicas-and-autoscaling.md) + - [Configure Custom Timeouts for HAProxy](docs/user-guide/ingress/configure-timeouts.md) ### Comparison with Kubernetes | Feauture | [Kube Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) | AppsCode Ingress | diff --git a/docs/user-guide/ingress/README.md b/docs/user-guide/ingress/README.md index 9dcb46228..369fface6 100644 --- a/docs/user-guide/ingress/README.md +++ b/docs/user-guide/ingress/README.md @@ -34,7 +34,8 @@ hosting. This plugin also support configurable application ports with all the fe - [Supports redirects/DNS resolution for `ExternalName` type service](external-svc.md) - [Expose HAProxy stats for Prometheus](stats-and-prometheus.md) - [Supports AWS certificate manager](aws-cert-manager.md) - - [Scale load balancer using HorizontalPodAutoscaling](docs/user-guide/ingress/replicas-and-autoscaling.md) + - [Scale load balancer using HorizontalPodAutoscaling](replicas-and-autoscaling.md) + - [Configure Custom Timeouts for HAProxy](configure-timeouts.md) ### Comparison with Kubernetes | Feauture | Kube Ingress | AppsCode Ingress | diff --git a/docs/user-guide/ingress/configure-timeouts.md b/docs/user-guide/ingress/configure-timeouts.md new file mode 100644 index 000000000..04e94fafc --- /dev/null +++ b/docs/user-guide/ingress/configure-timeouts.md @@ -0,0 +1,73 @@ +Custom timeouts can be configured for HAProxy via annotations. Supports all valid timeout option +for defaults section of HAProxy. [Read More](https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#4.2-timeout%20check) + +`ingress.appscode.com/default-timeout` expects a JSON encoded map of timeouts values. + +Ingress Example: +```yaml +apiVersion: voyager.appscode.com/v1beta1 +kind: Ingress +metadata: + name: test-ingress + namespace: default + annotations: + ingress.appscode.com/default-timeout: '{"connect": "5s", "server": "10s"' +spec: + backend: + serviceName: test-server + servicePort: '80' + rules: + - host: appscode.example.com + http: + paths: + - backend: + serviceName: test-service + servicePort: '80' +``` + +This ingress will generate a HAProxy template with provided timeouts. like +``` +defaults + log global + + option http-server-close + option dontlognull + + # Timeout values + # timeout {{ key }} {{ value }} + timeout connect 5s + timeout server 10s + timeout client 50000 + timeout client-fin 50000 + timeout tunnel 50000 + +``` + + +If any required timeouts is not provided timeouts will be populated with the following values. +``` + timeout connect 50000 + timeout client 50000 + timeout client-fin 50000 + timeout server 50000 + timeout tunnel 50000 +``` + +### Time Format +Some parameters involve values representing time, such as timeouts. These +values are generally expressed in milliseconds (unless explicitly stated +otherwise) but may be expressed in any other unit by suffixing the unit to the +numeric value. It is important to consider this because it will not be repeated +for every keyword. Supported units are : + + - us : microseconds. 1 microsecond = 1/1000000 second + - ms : milliseconds. 1 millisecond = 1/1000 second. This is the default. + - s : seconds. 1s = 1000ms + - m : minutes. 1m = 60s = 60000ms + - h : hours. 1h = 60m = 3600s = 3600000ms + - d : days. 1d = 24h = 1440m = 86400s = 86400000ms + +### Examples Annotations +``` +ingress.appscode.com/default-timeout": {"client": "5s"} +``` \ No newline at end of file diff --git a/docs/user-guide/ingress/simple-fanout.md b/docs/user-guide/ingress/simple-fanout.md index b8f384ca6..532fbcf00 100644 --- a/docs/user-guide/ingress/simple-fanout.md +++ b/docs/user-guide/ingress/simple-fanout.md @@ -40,3 +40,4 @@ the Status of Ingress. - [URL and Header Rewriting](header-rewrite.md) - [TCP Loadbalancing](tcp.md) - [TLS Termination](tls.md) +- [Configure Custom Timeouts for HAProxy](configure-timeouts.md)