Skip to content

Commit b6aa5be

Browse files
authored
Feature/multi fluentbit support (#665)
NodeAgent Support
1 parent 620eb41 commit b6aa5be

31 files changed

+8884
-30
lines changed

charts/logging-demo/requirements.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ dependencies:
66
repository: https://kubernetes-charts.banzaicloud.com/
77
version: 0.1.5
88
digest: sha256:8c6a3777c9e971fc03bad54b76fa62ef58b07f73436121522c7a6e97fce6ece5
9-
generated: "2021-01-20T11:35:41.461008+01:00"
9+
generated: "2021-01-08T16:16:09.458546+01:00"

charts/logging-operator-logging/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The following tables lists the configurable parameters of the logging-operator-l
4242
| `fluentd.tolerations` | Tolerations for fluentd statefulset | none |
4343
| `fluentd.nodeSelector` | Node selector for fluentd pods | none |
4444
| `fluentd.podPriorityClassName` | Priority class name for fluentd pods | none |
45+
| `nodeAgents` | Node agents definitions | {}} |
4546
| `defaultFlow` | Default Flow | {} |
4647
| `clusterFlows` | Array of ClusterFlows to be created | [] |
4748
| `clusterOutputs` | Array of ClusterOutputs to be created | [] |

charts/logging-operator-logging/templates/logging.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,9 @@ spec:
5454
{{- else }}
5555
fluentbit: {}
5656
{{- end }}
57-
57+
{{- if .Values.nodeAgents }}
58+
nodeAgents:
59+
{{ toYaml .Values.nodeAgents | indent 4 }}
60+
{{- else }}
61+
nodeAgents: []
62+
{{- end }}

charts/logging-operator-logging/values.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@ enableRecreateWorkloadOnImmutableFieldChange: false
1818

1919
# Fluent-bit configurations https://banzaicloud.com/docs/one-eye/logging-operator/configuration/crds/#fluent-bit-spec
2020
fluentbit: {}
21+
22+
#Node agent Definition
23+
nodeAgents: {}
24+
# - name: win-agent
25+
# profile: windows
26+
# nodeAgentFluentbit:
27+
# daemonSet:
28+
# spec:
29+
# template:
30+
# spec:
31+
# containers:
32+
# - image: banzaicloud/fluentbit:1.6.10
33+
# name: fluent-bit
34+
# tls:
35+
# enabled: false
36+
# - name: linux-agent
37+
# profile: linux
38+
# nodeAgentFluentbit:
39+
# metrics:
40+
# prometheusAnnotations: true
41+
# serviceMonitor: false
42+
# tls:
43+
# enabled: false
44+
45+
2146
# Fluentd configurations https://banzaicloud.com/docs/one-eye/logging-operator/configuration/crds/#fluentd-spec
2247
fluentd: {}
2348
# 20Gi persistent storage is configured for fluentd by default.

charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml

+3,559
Large diffs are not rendered by default.

cmd/docs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func plugins() {
6666
For more information please click on the plugin name
6767
<center>
6868
69-
| Name | Type | Description | Status |Version |
69+
| Name | Profile | Description | Status |Version |
7070
|:---|---|:---|:---:|---:|`,
7171
)
7272

config/crd/bases/logging.banzaicloud.io_loggings.yaml

+3,559
Large diffs are not rendered by default.

controllers/logging_controller.go

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/banzaicloud/logging-operator/pkg/resources/fluentbit"
2525
"github.com/banzaicloud/logging-operator/pkg/resources/fluentd"
2626
"github.com/banzaicloud/logging-operator/pkg/resources/model"
27+
"github.com/banzaicloud/logging-operator/pkg/resources/nodeagent"
2728
"github.com/banzaicloud/logging-operator/pkg/sdk/model/render"
2829
"github.com/banzaicloud/operator-tools/pkg/reconciler"
2930
"github.com/banzaicloud/operator-tools/pkg/secret"
@@ -120,6 +121,10 @@ func (r *LoggingReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
120121
reconcilers = append(reconcilers, fluentbit.New(r.Client, r.Log, &logging, reconcilerOpts).Reconcile)
121122
}
122123

124+
if len(logging.Spec.NodeAgents) > 0 {
125+
reconcilers = append(reconcilers, nodeagent.New(r.Client, r.Log, &logging, reconcilerOpts).Reconcile)
126+
}
127+
123128
for _, rec := range reconcilers {
124129
result, err := rec()
125130
if err != nil {
@@ -224,6 +229,7 @@ func SetupLoggingWithManager(mgr ctrl.Manager, logger logr.Logger) *ctrl.Builder
224229

225230
fluentd.RegisterWatches(builder)
226231
fluentbit.RegisterWatches(builder)
232+
nodeagent.RegisterWatches(builder)
227233

228234
return builder
229235
}
+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# escape=`
2+
3+
ARG WINDOWS_VERSION=ltsc2019
4+
5+
#
6+
# Builder Image - Windows Server Core
7+
#
8+
FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as builder
9+
10+
# The FLUENTBIT_VERSION ARG must be after the FROM instruction
11+
ARG FLUENTBIT_VERSION=1.6.10
12+
ARG IMAGE_CREATE_DATE
13+
ARG IMAGE_SOURCE_REVISION
14+
15+
# Metadata as defined in OCI image spec annotations
16+
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
17+
LABEL org.opencontainers.image.title="Fluent Bit" `
18+
org.opencontainers.image.description="Fluent Bit is an open source and multi-platform Log Processor and Forwarder which allows you to collect data/logs from different sources, unify and send them to multiple destinations. It's fully compatible with Docker and Kubernetes environments." `
19+
org.opencontainers.image.created=$IMAGE_CREATE_DATE `
20+
org.opencontainers.image.version=$FLUENTBIT_VERSION `
21+
org.opencontainers.image.authors="Eduardo Silva <[email protected]>" `
22+
org.opencontainers.image.url="https://hub.docker.com/r/fluent/fluent-bit" `
23+
org.opencontainers.image.documentation="https://docs.fluentbit.io/manual/" `
24+
org.opencontainers.image.vendor="Fluent Organization" `
25+
org.opencontainers.image.licenses="Apache-2.0" `
26+
org.opencontainers.image.source="https://github.com/fluent/fluent-bit" `
27+
org.opencontainers.image.revision=$IMAGE_SOURCE_REVISION
28+
29+
#
30+
# Basic setup
31+
#
32+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
33+
34+
RUN Write-Host ('Creating folders'); `
35+
New-Item -Type Directory -Path /local; `
36+
New-Item -Type Directory -Path /fluent-bit;
37+
38+
WORKDIR /local
39+
40+
#
41+
# Install Fluent Bit
42+
#
43+
RUN Write-Host ('Installing Fluent Bit'); `
44+
$majorminor = ([Version]::Parse("$env:FLUENTBIT_VERSION")).toString(2); `
45+
Invoke-WebRequest -Uri "https://fluentbit.io/releases/$($majorminor)/td-agent-bit-$($env:FLUENTBIT_VERSION)-win64.zip" -OutFile td-agent-bit.zip; `
46+
Expand-Archive -Path td-agent-bit.zip -Destination /local/fluent-bit; `
47+
Move-Item -Path /local/fluent-bit/*/* -Destination /fluent-bit/;
48+
49+
#
50+
# Technique from https://github.com/StefanScherer/dockerfiles-windows/blob/master/mongo/3.6/Dockerfile
51+
#
52+
ADD https://aka.ms/vs/15/release/vc_redist.x64.exe /local/vc_redist.x64.exe
53+
54+
RUN Write-Host ('Installing Visual C++ Redistributable Package'); `
55+
Start-Process /local/vc_redist.x64.exe -ArgumentList '/install', '/quiet', '/norestart' -NoNewWindow -Wait; `
56+
Copy-Item -Path /Windows/System32/msvcp140.dll -Destination /fluent-bit/bin/; `
57+
Copy-Item -Path /Windows/System32/vccorlib140.dll -Destination /fluent-bit/bin/; `
58+
Copy-Item -Path /Windows/System32/vcruntime140.dll -Destination /fluent-bit/bin/;
59+
60+
#
61+
# Runtime Image - Windows Server Nano
62+
#
63+
FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as runtime
64+
65+
COPY --from=builder /fluent-bit /fluent-bit
66+
67+
RUN setx /M PATH "%PATH%;C:\fluent-bit\bin"
68+
69+
ENTRYPOINT ["fluent-bit.exe", "-i", "dummy", "-o", "stdout"]

go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/MakeNowJust/heredoc v1.0.0
88
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
99
github.com/banzaicloud/logging-operator/pkg/sdk v0.0.0
10-
github.com/banzaicloud/operator-tools v0.15.0
10+
github.com/banzaicloud/operator-tools v0.20.1
1111
github.com/go-logr/logr v0.2.1
1212
github.com/onsi/gomega v1.10.1
1313
github.com/pborman/uuid v1.2.0
@@ -24,5 +24,3 @@ require (
2424
replace k8s.io/client-go => k8s.io/client-go v0.19.2
2525

2626
replace github.com/banzaicloud/logging-operator/pkg/sdk => ./pkg/sdk
27-
28-
//replace github.com/banzaicloud/operator-tools => ../operator-tools

go.sum

+7-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/
6262
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
6363
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
6464
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
65+
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
6566
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
6667
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
68+
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E=
6769
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
6870
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
6971
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
@@ -83,8 +85,8 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN
8385
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
8486
github.com/banzaicloud/k8s-objectmatcher v1.5.0 h1:mYrLzvRgxCHBlJZEcyIglDuoKpMhwHocgsAXl1nmm10=
8587
github.com/banzaicloud/k8s-objectmatcher v1.5.0/go.mod h1:9MWY5HsM/OaTmoTirczhlO8UALbH722WgdpaaR7Y8OE=
86-
github.com/banzaicloud/operator-tools v0.15.0 h1:BxtRBJlHntpAq4dtgCkhTImAUiT9sdKxwlcYKoKR+uM=
87-
github.com/banzaicloud/operator-tools v0.15.0/go.mod h1:544x65QDUmKMTrnMs0lbJ/0jvBSGKkaP2Z4fcmUZeLg=
88+
github.com/banzaicloud/operator-tools v0.20.1 h1:gn9xRNZGvGywi5AmtplEw469qmUyUUPoLlnKi6z3M3A=
89+
github.com/banzaicloud/operator-tools v0.20.1/go.mod h1:A/Y7Sxu9oSswN+gQABqx0imR6AbaMnxq2Mxag/gN/eM=
8890
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
8991
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
9092
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@@ -277,6 +279,8 @@ github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85n
277279
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
278280
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
279281
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
282+
github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M=
283+
github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
280284
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
281285
github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w=
282286
github.com/gobuffalo/logger v1.0.1/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
@@ -636,6 +640,7 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
636640
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
637641
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
638642
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
643+
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
639644
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
640645
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
641646
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=

pkg/resources/fluentbit/configsecret.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func (r *Reconciler) configSecret() (runtime.Object, reconciler.DesiredState, er
147147
Enabled bool
148148
SharedKey string
149149
}{
150-
Enabled: r.Logging.Spec.FluentbitSpec.TLS.Enabled,
150+
Enabled: *r.Logging.Spec.FluentbitSpec.TLS.Enabled,
151151
SharedKey: r.Logging.Spec.FluentbitSpec.TLS.SharedKey,
152152
},
153153
Monitor: monitor,

pkg/resources/fluentbit/daemonset.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (r *Reconciler) daemonSet() (runtime.Object, reconciler.DesiredState, error
5656
for key, config := range r.configs {
5757
h := sha256.New()
5858
_, _ = h.Write(config)
59-
templates.Annotate(podMeta, fmt.Sprintf("checksum/%s", key), fmt.Sprintf("%x", h.Sum(nil)))
59+
podMeta = templates.Annotate(podMeta, fmt.Sprintf("checksum/%s", key), fmt.Sprintf("%x", h.Sum(nil)))
6060
}
6161
}
6262

@@ -137,7 +137,7 @@ func (r *Reconciler) generateVolumeMounts() (v []corev1.VolumeMount) {
137137
for vCount, vMnt := range r.Logging.Spec.FluentbitSpec.ExtraVolumeMounts {
138138
v = append(v, corev1.VolumeMount{
139139
Name: "extravolumemount" + strconv.Itoa(vCount),
140-
ReadOnly: vMnt.ReadOnly,
140+
ReadOnly: *vMnt.ReadOnly,
141141
MountPath: vMnt.Destination,
142142
})
143143
}
@@ -162,7 +162,7 @@ func (r *Reconciler) generateVolumeMounts() (v []corev1.VolumeMount) {
162162
})
163163
}
164164

165-
if r.Logging.Spec.FluentbitSpec.TLS.Enabled {
165+
if *r.Logging.Spec.FluentbitSpec.TLS.Enabled {
166166
tlsRelatedVolume := []corev1.VolumeMount{
167167
{
168168
Name: "fluent-bit-tls",
@@ -236,7 +236,7 @@ func (r *Reconciler) generateVolume() (v []corev1.Volume) {
236236
},
237237
})
238238
}
239-
if r.Logging.Spec.FluentbitSpec.TLS.Enabled {
239+
if *r.Logging.Spec.FluentbitSpec.TLS.Enabled {
240240
tlsRelatedVolume := corev1.Volume{
241241
Name: "fluent-bit-tls",
242242
VolumeSource: corev1.VolumeSource{

pkg/resources/fluentbit/psp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (r *Reconciler) clusterPodSecurityPolicy() (runtime.Object, reconciler.Desi
3939
for _, vMnt := range r.Logging.Spec.FluentbitSpec.ExtraVolumeMounts {
4040
allowedHostPaths = append(allowedHostPaths, policyv1beta1.AllowedHostPath{
4141
PathPrefix: vMnt.Source,
42-
ReadOnly: vMnt.ReadOnly,
42+
ReadOnly: *vMnt.ReadOnly,
4343
})
4444
}
4545

pkg/resources/nodeagent/config.go

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// Copyright © 2021 Banzai Cloud
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package nodeagent
16+
17+
const BaseConfigName = "fluent-bit.conf"
18+
const UpstreamConfigName = "upstream.conf"
19+
20+
var fluentBitConfigTemplate = `
21+
[SERVICE]
22+
Flush {{ .Flush }}
23+
Grace {{ .Grace }}
24+
Daemon Off
25+
Log_Level {{ .LogLevel }}
26+
Parsers_File /fluent-bit/conf/parsers.conf
27+
Coro_Stack_Size {{ .CoroStackSize }}
28+
{{- if .Monitor.Enabled }}
29+
HTTP_Server On
30+
HTTP_Listen 0.0.0.0
31+
HTTP_Port {{ .Monitor.Port }}
32+
{{- end }}
33+
34+
[INPUT]
35+
Name tail
36+
{{- range $key, $value := .Input.Values }}
37+
{{- if $value }}
38+
{{ $key }} {{$value}}
39+
{{- end }}
40+
{{- end }}
41+
{{- range $id, $v := .Input.ParserN }}
42+
{{- if $v }}
43+
Parse_{{ $id}} {{$v}}
44+
{{- end }}
45+
{{- end }}
46+
47+
{{- if not .DisableKubernetesFilter }}
48+
[FILTER]
49+
Name kubernetes
50+
{{- range $key, $value := .KubernetesFilter }}
51+
{{- if $value }}
52+
{{ $key }} {{$value}}
53+
{{- end }}
54+
{{- end }}
55+
{{- end}}
56+
57+
{{- if .AwsFilter }}
58+
59+
[FILTER]
60+
Name aws
61+
{{- range $key, $value := .AwsFilter }}
62+
{{- if $value }}
63+
{{ $key }} {{$value}}
64+
{{- end }}
65+
{{- end }}
66+
{{- end}}
67+
68+
[OUTPUT]
69+
Name forward
70+
Match *
71+
{{- if .Upstream.Enabled }}
72+
Upstream /fluent-bit/conf_upstream/upstream.conf
73+
{{- else }}
74+
Host {{ .TargetHost }}
75+
Port {{ .TargetPort }}
76+
{{- end }}
77+
{{ if .TLS.Enabled }}
78+
tls On
79+
tls.verify Off
80+
tls.ca_file /fluent-bit/tls/ca.crt
81+
tls.crt_file /fluent-bit/tls/tls.crt
82+
tls.key_file /fluent-bit/tls/tls.key
83+
{{- if .TLS.SharedKey }}
84+
Shared_Key {{ .TLS.SharedKey }}
85+
{{- else }}
86+
Empty_Shared_Key true
87+
{{- end }}
88+
{{- end }}
89+
{{- if .Network.ConnectTimeoutSet }}
90+
net.connect_timeout {{.Network.ConnectTimeout}}
91+
{{- end }}
92+
{{- if .Network.KeepaliveSet}}
93+
net.keepalive {{if .Network.Keepalive }}on{{else}}off{{end}}
94+
{{- end }}
95+
{{- if .Network.KeepaliveIdleTimeoutSet }}
96+
net.keepalive_idle_timeout {{.Network.KeepaliveIdleTimeout}}
97+
{{- end }}
98+
{{- if .Network.KeepaliveMaxRecycleSet }}
99+
net.keepalive_max_recycle {{.Network.KeepaliveMaxRecycle}}
100+
{{- end }}
101+
{{- if .ForwardOptions }}
102+
{{- range $key, $value := .ForwardOptions }}
103+
{{- if $value }}
104+
{{ $key }} {{$value}}
105+
{{- end }}
106+
{{- end }}
107+
{{- end }}
108+
`
109+
110+
var upstreamConfigTemplate = `
111+
[UPSTREAM]
112+
Name {{ .Config.Name }}
113+
{{- range $idx, $element:= .Config.Nodes}}
114+
[NODE]
115+
Name {{.Name}}
116+
Host {{.Host}}
117+
Port {{.Port}}
118+
{{- end}}
119+
`

0 commit comments

Comments
 (0)