haproxytech / dataplaneapi

HAProxy Data Plane API
https://www.haproxy.com/documentation/dataplaneapi/
Apache License 2.0
321 stars 75 forks source link

Error while using runtime: option is not avaiable #324

Closed matthisholleville closed 6 months ago

matthisholleville commented 6 months ago

Hello,

I'm currently using the HAProxy Helm chart, and I'm encountering an error when trying to use the /runtime APIs.

Whenever I attempt to query any of the runtime endpoints from my pod, I encounter an error of this type:

{
    "code": 500,
    "message": "runtime: option is not available"
}

I notice that there's already an open issue #289 with a seemingly similar problem.

Here are the details of the versions and configuration:

haproxy -vv

HAProxy version 2.9.5-260dbb8 2024/02/15 - https://haproxy.org/ Status: stable branch - will stop receiving fixes around Q1 2025. Known bugs: http://www.haproxy.org/bugs/bugs-2.9.5.html Running on: Linux 5.15.133+ #1 SMP Sat Dec 30 13:01:38 UTC 2023 x86_64 Build options : TARGET = linux-musl CPU = generic CC = cc CFLAGS = -O2 -g -Wall -Wextra -Wundef -Wdeclaration-after-statement -Wfatal-errors -Wtype-limits -Wshift-negative-value -Wshift-overflow=2 -Wduplicated-cond -Wnull-dereference -fwrapv -Wno-address-of-packed-member -Wno-unused-label -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wno-missing-field-initializers -Wno-cast-function-type -Wno-string-plus-int -Wno-atomic-alignment OPTIONS = USE_PTHREAD_EMULATION=1 USE_LINUX_TPROXY=1 USE_GETADDRINFO=1 USE_OPENSSL=1 USE_LUA=1 USE_SLZ=1 USE_TFO=1 USE_QUIC=1 USE_PROMEX=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_QUIC_OPENSSL_COMPAT=1 DEBUG = -DDEBUG_STRICT -DDEBUG_MEMORY_POOLS Feature list : -51DEGREES +ACCEPT4 -BACKTRACE -CLOSEFROM +CPU_AFFINITY +CRYPT_H -DEVICEATLAS +DL -ENGINE +EPOLL -EVPORTS +GETADDRINFO -KQUEUE -LIBATOMIC +LIBCRYPT +LINUX_CAP +LINUX_SPLICE +LINUX_TPROXY +LUA +MATH -MEMORY_PROFILING +NETFILTER +NS -OBSOLETE_LINKER +OPENSSL -OPENSSL_AWSLC -OPENSSL_WOLFSSL -OT -PCRE +PCRE2 +PCRE2_JIT -PCRE_JIT +POLL +PRCTL -PROCCTL +PROMEX +PTHREAD_EMULATION +QUIC +QUIC_OPENSSL_COMPAT +RT +SHM_OPEN +SLZ +SSL -STATIC_PCRE -STATIC_PCRE2 -SYSTEMD +TFO +THREAD +THREAD_DUMP +TPROXY -WURFL -ZLIB Default settings : bufsize = 16384, maxrewrite = 1024, maxpollevents = 200 Built with multi-threading support (MAX_TGROUPS=16, MAX_THREADS=256, default=2). Built with OpenSSL version : OpenSSL 3.1.4 24 Oct 2023 Running on OpenSSL version : OpenSSL 3.1.4 24 Oct 2023 OpenSSL library supports TLS extensions : yes OpenSSL library supports SNI : yes OpenSSL library supports : TLSv1.0 TLSv1.1 TLSv1.2 TLSv1.3 OpenSSL providers loaded : default Built with Lua version : Lua 5.4.6 Built with the Prometheus exporter as a service Built with network namespace support. Built with libslz for stateless compression. Compression algorithms supported : identity("identity"), deflate("deflate"), raw-deflate("deflate"), gzip("gzip") Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND Built with PCRE2 version : 10.42 2022-12-11 PCRE2 library supports JIT : yes Encrypted password support via crypt(3): yes Built with gcc compiler version 12.2.1 20220924 Available polling systems : epoll : pref=300, test result OK poll : pref=200, test result OK select : pref=150, test result OK Total: 3 (3 usable), will use epoll. Available multiplexer protocols : (protocols marked as cannot be specified using 'proto' keyword) quic : mode=HTTP side=FE mux=QUIC flags=HTX|NO_UPG|FRAMED h2 : mode=HTTP side=FE|BE mux=H2 flags=HTX|HOL_RISK|NO_UPG fcgi : mode=HTTP side=BE mux=FCGI flags=HTX|HOL_RISK|NO_UPG : mode=HTTP side=FE|BE mux=H1 flags=HTX h1 : mode=HTTP side=FE|BE mux=H1 flags=HTX|NO_UPG : mode=TCP side=FE|BE mux=PASS flags= none : mode=TCP side=FE|BE mux=PASS flags=NO_UPG Available services : prometheus-exporter Available filters : [BWLIM] bwlim-in [BWLIM] bwlim-out [CACHE] cache [COMP] compression [FCGI] fcgi-app [SPOE] spoe [TRACE] trace

dataplaneapi -v

dataplaneapi -v HAProxy Data Plane API v2.9.1 4d10854c Build from: https://github.com/haproxytech/dataplaneapi.git Build date: 2024-02-15T18:04:21Z

dataplaneapi configuration

```yaml config_version: 2 name: haproxy mode: single status: "" dataplaneapi: host: x.x.x.x port: 1234 advertised: api_address: "" api_port: 0 scheme: - http haproxy: config_file: /usr/local/etc/haproxy/haproxy.cfg haproxy_bin: /usr/local/sbin/haproxy reload: reload_cmd: kill -SIGUSR2 1 restart_cmd: kill -SIGUSR2 1 reload_strategy: custom log_targets: - log_to: stdout log_level: debug log_format: json log_types: - access - app ```
matthisholleville commented 6 months ago

The issue was between the chair and the keyboard (as often happens, haha). For those interested, I was missing the socket declaration in the HAProxy configuration.

global
      stats socket /var/run/api.sock user haproxy group haproxy mode 660 level admin expose-fd listeners

....

It would be great if the error message could be more explicit! 😄