Skip to content

Commit e53af0e

Browse files
committed
NODE-5873 add configurable parameters to Sidecar Helm chart
1 parent adcf9fd commit e53af0e

File tree

8 files changed

+67
-9
lines changed

8 files changed

+67
-9
lines changed

TAG

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.11
1+
1.4.0

cmd/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ func (c *Config) InitTemplate(templatefile string) error {
229229
"b64dec": B64dec,
230230
"withAnnotationPrefix": WithAnnotationPrefix,
231231
"withAP": WithAnnotationPrefix,
232+
"int64": ToInt64,
232233
}
233234

234235
tmpl, errNewTemplate := template.New("basic").Funcs(tmplfuncs).Parse(string(content))

cmd/template.go

+22
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,25 @@ func WithAnnotationPrefix(suffix string) string {
152152
prefix := fmt.Sprintf("%v", config.Settings["annotationPrefix"])
153153
return prefix + "/" + suffix
154154
}
155+
156+
func ToInt64(input interface{}) (int64, error) {
157+
switch v := input.(type) {
158+
case string:
159+
num, err := strconv.ParseInt(v, 10, 64)
160+
if err != nil {
161+
fmt.Println("Error converting string to int64:", err)
162+
return 0, err
163+
}
164+
return num, nil
165+
case int:
166+
return int64(v), nil
167+
case int64:
168+
return v, nil
169+
case float64:
170+
return int64(v), nil
171+
case float32:
172+
return int64(v), nil
173+
default:
174+
return 0, fmt.Errorf("unsupported type: %T", v)
175+
}
176+
}

files/template.yaml.tpl

+13-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,19 @@ volumes:
6767
- name: WALLARM_UPSTREAM_RECONNECT_INTERVAL
6868
value: "{{ getAnnotation .ObjectMeta (withAP `wallarm-upstream-reconnect-interval`) .Config.wallarm.upstream.reconnectInterval }}"
6969
- name: WALLARM_APIFW_ENABLE
70-
value: "{{ getAnnotation .ObjectMeta (withAP `api-firewall-enabled`) .Config.wallarm.apiFirewallMode }}"
70+
value: "{{ getAnnotation .ObjectMeta (withAP `api-firewall-enabled`) .Config.wallarm.apiFirewall.mode }}"
71+
- name: APIFW_READ_BUFFER_SIZE
72+
value: "{{ .Config.wallarm.apiFirewall.readBufferSize | int64 }}"
73+
- name: APIFW_WRITE_BUFFER_SIZE
74+
value: "{{ .Config.wallarm.apiFirewall.writeBufferSize | int64 }}"
75+
- name: APIFW_MAX_REQUEST_BODY_SIZE
76+
value: "{{ .Config.wallarm.apiFirewall.maxRequestBodySize | int64 }}"
77+
- name: APIFW_DISABLE_KEEPALIVE
78+
value: "{{ .Config.wallarm.apiFirewall.disableKeepalive }}"
79+
- name: APIFW_MAX_CONNS_PER_IP
80+
value: "{{ .Config.wallarm.apiFirewall.maxConnectionsPerIp }}"
81+
- name: APIFW_MAX_REQUESTS_PER_CONN
82+
value: "{{ .Config.wallarm.apiFirewall.maxRequestsPerConnection }}"
7183
- name: NGINX_LISTEN_PORT
7284
value: "{{ getAnnotation .ObjectMeta (withAP `nginx-listen-port`) .Config.nginx.listenPort }}"
7385
- name: NGINX_PROXY_PASS_PORT

helm/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ annotations:
2323
- name: sidecar
2424
image: wallarm/sidecar:5.2.11
2525
- name: sidecar-controller
26-
image: wallarm/sidecar-controller:1.3.11
26+
image: wallarm/sidecar-controller:1.4.0
2727
- name: node-helpers
2828
image: wallarm/node-helpers:5.2.11

helm/values.yaml

+27-5
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ config:
7676
### https://docs.wallarm.com/admin-en/configure-parameters-en/#wallarm_unpack_response
7777
###
7878
unpackResponse: "on"
79-
### Global setting to turn Wallarm API Firewall component on or off
80-
### https://wallarm.github.io/api-firewall/
81-
###
82-
apiFirewallMode: "on"
8379
### Post-analytics node endpoint configuration
8480
###
8581
upstream:
@@ -91,6 +87,32 @@ config:
9187
### https://docs.wallarm.com/admin-en/configure-parameters-en/#wallarm_upstream_reconnect_interval
9288
###
9389
reconnectInterval: 15s
90+
apiFirewall:
91+
### Global setting to turn Wallarm API Firewall component on or off
92+
### https://wallarm.github.io/api-firewall/
93+
###
94+
mode: "on"
95+
### Per-connection buffer size (in bytes) for requests' reading. This also limits the maximum header size.
96+
### Increase this buffer if your clients send multi-KB RequestURIs and/or multi-KB headers (for example, BIG cookies)
97+
###
98+
readBufferSize: 8192
99+
### Per-connection buffer size (in bytes) for responses' writing.
100+
###
101+
writeBufferSize: 8192
102+
### Maximum request body size (in bytes). The server rejects requests with bodies exceeding this limit.
103+
###
104+
maxRequestBodySize: 4194304
105+
### Whether to disable keep-alive connections. The server will close all the incoming connections after sending
106+
## the first response to client if this option is set to 'true'
107+
###
108+
disableKeepalive: false
109+
### Maximum number of concurrent client connections allowed per IP. '0' means unlimited
110+
###
111+
maxConnectionsPerIp: 0
112+
### Maximum number of requests served per connection. The server closes connection after the last request.
113+
### 'Connection: close' header is added to the last response. '0' means unlimited
114+
###
115+
maxRequestsPerConnection: 0
94116
### Default Annotation prefix which is used in sidecar template to overwrite default values
95117
annotationPrefix: sidecar.wallarm.io
96118
### Default sidecar injection strategy. Parameters in this section can be overwritten individually
@@ -765,7 +787,7 @@ controller:
765787
image:
766788
registry: docker.io
767789
image: wallarm/sidecar-controller
768-
tag: 1.3.11
790+
tag: 1.4.0
769791
pullPolicy: IfNotPresent
770792
# -- Admission webhook configuration
771793
# @default -- *See below for details*

test/smoke/functions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function get_logs() {
113113
echo "#################################"
114114
echo "######## Post-analytics Pod #####"
115115
echo "#################################"
116-
for CONTAINER in antibot appstructure supervisord tarantool ; do
116+
for CONTAINER in appstructure supervisord tarantool ; do
117117
echo "#######################################"
118118
echo "###### ${CONTAINER} container logs ######"
119119
echo -e "#######################################\n"

test/smoke/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,4 @@ kubectl wait --for=condition=Ready pods --all --timeout=140s || (kubectl describ
161161

162162
echo "[test-env] running smoke tests suite ..."
163163
make -C "${DIR}"/../../ smoke-test
164+

0 commit comments

Comments
 (0)