From 3fd0fe0d46973fb88e6ec3ad399b9911e8300ebd Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Wed, 18 Feb 2026 16:35:57 -0500 Subject: [PATCH] Update plugin paths from `/etc/haproxy` to `/etc/easyhaproxy` across tests, configs, and documentation --- docs/plugin-development.md | 10 +++++----- src/plugins/manager.py | 2 +- src/processor/kubernetes.py | 15 ++++++++------- tests/fixtures/services-with-jwt-validator | 2 +- tests/test_plugins.py | 6 +++--- tests_e2e/kubernetes/jwt-validator.yml | 2 +- tests_e2e/swarm/cloudflare.yml | 6 +++--- tests_e2e/swarm/jwt-validator.yml | 4 ++-- tests_e2e/swarm/plugins-combined.yml | 6 +++--- 9 files changed, 27 insertions(+), 26 deletions(-) diff --git a/docs/plugin-development.md b/docs/plugin-development.md index 6eeec62..629979d 100644 --- a/docs/plugin-development.md +++ b/docs/plugin-development.md @@ -437,12 +437,12 @@ class ResourceRequest: ```python ResourceRequest( resource_type="directory", - path="/etc/haproxy/plugin_data" + path="/etc/easyhaproxy/plugin_data" ) ResourceRequest( resource_type="file", - path="/etc/haproxy/plugin_config.txt", + path="/etc/easyhaproxy/plugin_config.txt", content="config data", overwrite=True ) @@ -471,7 +471,7 @@ class InitializationResult: def initialize(self) -> InitializationResult: return InitializationResult( resources=[ - ResourceRequest(resource_type="directory", path="/etc/haproxy/jwt_keys") + ResourceRequest(resource_type="directory", path="/etc/easyhaproxy/jwt_keys") ] ) ``` @@ -932,7 +932,7 @@ class JwtValidatorPlugin(PluginInterface): self.paths = [] # List of paths that require JWT validation self.only_paths = False # If true, only specified paths are accessible # Make JWT_KEYS_DIR configurable via environment variable - self.jwt_keys_dir = os.getenv("EASYHAPROXY_JWT_KEYS_DIR", "/etc/haproxy/jwt_keys") + self.jwt_keys_dir = os.getenv("EASYHAPROXY_JWT_KEYS_DIR", "/etc/easyhaproxy/jwt_keys") @property def name(self) -> str: @@ -1292,7 +1292,7 @@ EASYHAPROXY_JWT_KEYS_DIR=/custom/path/jwt_keys # Plugin-defined env var class MyPlugin(PluginInterface): def __init__(self): # Make resource directory configurable - self.data_dir = os.getenv("EASYHAPROXY_MY_PLUGIN_DATA_DIR", "/etc/haproxy/my_plugin_data") + self.data_dir = os.getenv("EASYHAPROXY_MY_PLUGIN_DATA_DIR", "/etc/easyhaproxy/my_plugin_data") def initialize(self) -> InitializationResult: return InitializationResult( diff --git a/src/plugins/manager.py b/src/plugins/manager.py index 09315f9..7ac6962 100644 --- a/src/plugins/manager.py +++ b/src/plugins/manager.py @@ -38,7 +38,7 @@ class PluginManager: builtin_dir = os.path.join(os.path.dirname(__file__), "builtin") self._load_plugins_from_directory(builtin_dir, "builtin") - # Load external plugins from /etc/haproxy/plugins + # Load external plugins from /etc/easyhaproxy/plugins if os.path.exists(self.plugins_dir): self._load_plugins_from_directory(self.plugins_dir, "external") else: diff --git a/src/processor/kubernetes.py b/src/processor/kubernetes.py index 86d7ad6..9416633 100644 --- a/src/processor/kubernetes.py +++ b/src/processor/kubernetes.py @@ -264,16 +264,17 @@ class Kubernetes(ProcessorInterface): ssl_hosts = [] - certbot = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.certbot") - redirect_ssl = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.redirect_ssl") - redirect = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.redirect") - mode = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.mode") - listen_port = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.listen_port", 80) - plugins = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.plugins") + annotations = ingress.metadata.annotations or {} + certbot = self._check_annotation(annotations, "easyhaproxy.certbot") + redirect_ssl = self._check_annotation(annotations, "easyhaproxy.redirect_ssl") + redirect = self._check_annotation(annotations, "easyhaproxy.redirect") + mode = self._check_annotation(annotations, "easyhaproxy.mode") + listen_port = self._check_annotation(annotations, "easyhaproxy.listen_port", 80) + plugins = self._check_annotation(annotations, "easyhaproxy.plugins") # Extract plugin-specific configurations plugin_annotations = {} - for annotation_key, annotation_value in ingress.metadata.annotations.items(): + for annotation_key, annotation_value in annotations.items(): if annotation_key.startswith("easyhaproxy.plugin."): plugin_annotations[annotation_key] = annotation_value diff --git a/tests/fixtures/services-with-jwt-validator b/tests/fixtures/services-with-jwt-validator index 4b1957e..7cf712d 100644 --- a/tests/fixtures/services-with-jwt-validator +++ b/tests/fixtures/services-with-jwt-validator @@ -7,6 +7,6 @@ "easyhaproxy.http.plugin.jwt_validator.algorithm": "RS256", "easyhaproxy.http.plugin.jwt_validator.issuer": "https://auth.example.com/", "easyhaproxy.http.plugin.jwt_validator.audience": "https://api.example.com", - "easyhaproxy.http.plugin.jwt_validator.pubkey_path": "/etc/haproxy/jwt_keys/api_pubkey.pem" + "easyhaproxy.http.plugin.jwt_validator.pubkey_path": "/etc/easyhaproxy/jwt_keys/api_pubkey.pem" } } diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 2cb7f40..1318b88 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -652,12 +652,12 @@ class TestJwtValidatorPlugin: "algorithm": "RS512", "issuer": "https://auth.example.com/", "audience": "https://api.example.com", - "pubkey_path": "/etc/haproxy/keys/api.pem" + "pubkey_path": "/etc/easyhaproxy/keys/api.pem" }) assert plugin.algorithm == "RS512" assert plugin.issuer == "https://auth.example.com/" assert plugin.audience == "https://api.example.com" - assert plugin.pubkey_path == "/etc/haproxy/keys/api.pem" + assert plugin.pubkey_path == "/etc/easyhaproxy/keys/api.pem" # Test empty values skip validation (use fresh plugin) plugin2 = JwtValidatorPlugin() @@ -672,7 +672,7 @@ class TestJwtValidatorPlugin: plugin2b = JwtValidatorPlugin() plugin2b.configure({ "algorithm": "RS256", - "pubkey_path": "/etc/haproxy/keys/api.pem" + "pubkey_path": "/etc/easyhaproxy/keys/api.pem" }) assert plugin2b.issuer is None assert plugin2b.audience is None diff --git a/tests_e2e/kubernetes/jwt-validator.yml b/tests_e2e/kubernetes/jwt-validator.yml index adafc22..676d74c 100644 --- a/tests_e2e/kubernetes/jwt-validator.yml +++ b/tests_e2e/kubernetes/jwt-validator.yml @@ -43,7 +43,7 @@ # # Edit your EasyHAProxy deployment and add: # # volumeMounts: # # - name: jwt-keys -# # mountPath: /etc/haproxy/jwt_keys +# # mountPath: /etc/easyhaproxy/jwt_keys # # volumes: # # - name: jwt-keys # # configMap: diff --git a/tests_e2e/swarm/cloudflare.yml b/tests_e2e/swarm/cloudflare.yml index 0864663..aa2dc45 100644 --- a/tests_e2e/swarm/cloudflare.yml +++ b/tests_e2e/swarm/cloudflare.yml @@ -50,7 +50,7 @@ # # Expected: 200 OK with "App Behind Cloudflare" # # # Check HAProxy config includes Cloudflare IPs -# docker exec $(docker ps -q -f name=easyhaproxy_haproxy) cat /etc/haproxy/haproxy.cfg | grep -A 5 "cloudflare" +# docker exec $(docker ps -q -f name=easyhaproxy_haproxy) cat /etc/easyhaproxy/haproxy/haproxy.cfg | grep -A 5 "cloudflare" # # Expected: ACL rules for Cloudflare IP ranges # ``` # @@ -75,7 +75,7 @@ services: - /var/run/docker.sock:/var/run/docker.sock configs: - source: cloudflare_ips - target: /etc/haproxy/cloudflare_ips.lst + target: /etc/easyhaproxy/cloudflare_ips.lst deploy: replicas: 1 placement: @@ -109,7 +109,7 @@ services: easyhaproxy.http.plugins: "cloudflare" # Optional: Specify custom IP list path - # easyhaproxy.http.plugin.cloudflare.ip_list_path: "/etc/haproxy/cloudflare_ips.lst" + # easyhaproxy.http.plugin.cloudflare.ip_list_path: "/etc/easyhaproxy/cloudflare_ips.lst" networks: - easyhaproxy diff --git a/tests_e2e/swarm/jwt-validator.yml b/tests_e2e/swarm/jwt-validator.yml index d58db64..141b2fb 100644 --- a/tests_e2e/swarm/jwt-validator.yml +++ b/tests_e2e/swarm/jwt-validator.yml @@ -83,7 +83,7 @@ services: - /var/run/docker.sock:/var/run/docker.sock configs: - source: jwt_api_pubkey - target: /etc/haproxy/jwt_keys/api_pubkey.pem + target: /etc/easyhaproxy/jwt_keys/api_pubkey.pem deploy: replicas: 1 placement: @@ -119,7 +119,7 @@ services: easyhaproxy.http.plugin.jwt_validator.algorithm: "RS256" easyhaproxy.http.plugin.jwt_validator.issuer: "https://auth.example.com/" easyhaproxy.http.plugin.jwt_validator.audience: "https://api.example.com" - easyhaproxy.http.plugin.jwt_validator.pubkey_path: "/etc/haproxy/jwt_keys/api_pubkey.pem" + easyhaproxy.http.plugin.jwt_validator.pubkey_path: "/etc/easyhaproxy/jwt_keys/api_pubkey.pem" networks: - easyhaproxy diff --git a/tests_e2e/swarm/plugins-combined.yml b/tests_e2e/swarm/plugins-combined.yml index f7d2dd0..f7cc27b 100644 --- a/tests_e2e/swarm/plugins-combined.yml +++ b/tests_e2e/swarm/plugins-combined.yml @@ -99,9 +99,9 @@ services: - /var/run/docker.sock:/var/run/docker.sock configs: - source: cloudflare_ips - target: /etc/haproxy/cloudflare_ips.lst + target: /etc/easyhaproxy/cloudflare_ips.lst - source: jwt_api_pubkey - target: /etc/haproxy/jwt_keys/api_pubkey.pem + target: /etc/easyhaproxy/jwt_keys/api_pubkey.pem deploy: replicas: 1 placement: @@ -160,7 +160,7 @@ services: easyhaproxy.http.plugin.jwt_validator.algorithm: "RS256" easyhaproxy.http.plugin.jwt_validator.issuer: "https://auth.example.com/" easyhaproxy.http.plugin.jwt_validator.audience: "https://api.example.com" - easyhaproxy.http.plugin.jwt_validator.pubkey_path: "/etc/haproxy/jwt_keys/api_pubkey.pem" + easyhaproxy.http.plugin.jwt_validator.pubkey_path: "/etc/easyhaproxy/jwt_keys/api_pubkey.pem" # Block internal/debug paths easyhaproxy.http.plugin.deny_pages.paths: "/internal,/debug,/metrics"