Update memcached listeners on tcp/udp ports
Allows to manage tcp/udp listeners
Change-Id: Ic9e75daf07f7763f35e07455b8a8071b463eacdc
Related-Prod: PROD-23621
diff --git a/README.rst b/README.rst
index f1c72c0..93f01ef 100644
--- a/README.rst
+++ b/README.rst
@@ -22,6 +22,33 @@
port: 11211
protocol: tcp
+Enable/Disable tcp/udp listener
+===============================
+
+.. code-block:: yaml
+
+ memcached:
+ server:
+ enabled: true
+ cache_size: 64
+ slabsize: 2m
+ threads: 1
+ bind:
+ address: 0.0.0.0
+ port: 11211
+ proto:
+ tcp:
+ enabled: True
+ udp:
+ enabled: True
+======
+ Note:
+======
+ The following pillar option is deprecated and does not affect any functionality:
+================================================================================
+.. code-block:: yaml
+ bind:
+ protocol: tcp
References
==========
diff --git a/memcached/files/memcached.conf b/memcached/files/memcached.conf
index 01ac54a..5023723 100644
--- a/memcached/files/memcached.conf
+++ b/memcached/files/memcached.conf
@@ -21,9 +21,13 @@
-m {{ server.cache_size }}
# Default connection port is 11211
+{%- if server.bind.get('proto', {}).get('tcp', {}).get('enabled', True) %}
-p {{ server.bind.port }}
+{%- endif %}
+{%- if server.bind.get('proto', {}).get('udp', {}).get('enabled', True) %}
-U {{ server.bind.port }}
+{%- endif %}
# Run the daemon as root. The start-memcached will default to running as root if no
# -u command is present in this config file
-u memcache
diff --git a/memcached/schemas/server.yaml b/memcached/schemas/server.yaml
index bfccc42..74e70fd 100644
--- a/memcached/schemas/server.yaml
+++ b/memcached/schemas/server.yaml
@@ -30,7 +30,7 @@
Binding options for Memcached service.
type: object
additionalProperties: false
- required: [address, port]
+ required: [address, port, proto]
properties:
address:
description: |
@@ -40,3 +40,8 @@
description: |
Connection port to use.
type: integer
+ proto:
+ description: |
+ Listen on TCP/UDP port.
+ type: object
+ additionalProperties: true
diff --git a/tests/pillar/server.sls b/tests/pillar/server.sls
index 41f9846..2bb65aa 100644
--- a/tests/pillar/server.sls
+++ b/tests/pillar/server.sls
@@ -7,3 +7,8 @@
bind:
address: 0.0.0.0
port: 11211
+ proto:
+ tcp:
+ enabled: True
+ udp:
+ enabled: True