Skip to content

Commit 585d409

Browse files
committed
Changed excludeLabelFromRouter to includeLabelInRouter
1 parent 6bc017a commit 585d409

16 files changed

+72
-57
lines changed

Diff for: config/crd/bases/logging.banzaicloud.io_clusterflows.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ spec:
3939
type: object
4040
spec:
4141
properties:
42-
excludeLabelFromRouter:
43-
type: boolean
4442
filters:
4543
items:
4644
properties:
@@ -975,6 +973,8 @@ spec:
975973
items:
976974
type: string
977975
type: array
976+
includeLabelInRouter:
977+
type: boolean
978978
loggingRef:
979979
type: string
980980
match:
@@ -1066,8 +1066,6 @@ spec:
10661066
type: object
10671067
spec:
10681068
properties:
1069-
excludeLabelFromRouter:
1070-
type: boolean
10711069
filters:
10721070
items:
10731071
properties:
@@ -2002,6 +2000,8 @@ spec:
20022000
items:
20032001
type: string
20042002
type: array
2003+
includeLabelInRouter:
2004+
type: boolean
20052005
loggingRef:
20062006
type: string
20072007
match:

Diff for: config/crd/bases/logging.banzaicloud.io_flows.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ spec:
3939
type: object
4040
spec:
4141
properties:
42-
excludeLabelFromRouter:
43-
type: boolean
4442
filters:
4543
items:
4644
properties:
@@ -975,6 +973,8 @@ spec:
975973
items:
976974
type: string
977975
type: array
976+
includeLabelInRouter:
977+
type: boolean
978978
localOutputRefs:
979979
items:
980980
type: string
@@ -1062,8 +1062,6 @@ spec:
10621062
type: object
10631063
spec:
10641064
properties:
1065-
excludeLabelFromRouter:
1066-
type: boolean
10671065
filters:
10681066
items:
10691067
properties:
@@ -1998,6 +1996,8 @@ spec:
19981996
items:
19991997
type: string
20001998
type: array
1999+
includeLabelInRouter:
2000+
type: boolean
20012001
localOutputRefs:
20022002
items:
20032003
type: string

Diff for: config/crd/bases/logging.banzaicloud.io_loggings.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ spec:
5757
type: string
5858
defaultFlow:
5959
properties:
60-
excludeLabelFromRouter:
61-
type: boolean
6260
filters:
6361
items:
6462
properties:
@@ -993,6 +991,8 @@ spec:
993991
items:
994992
type: string
995993
type: array
994+
includeLabelInRouter:
995+
type: boolean
996996
outputRefs:
997997
items:
998998
type: string

Diff for: e2e/charts/logging-operator/crds/logging.banzaicloud.io_clusterflows.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ spec:
3939
type: object
4040
spec:
4141
properties:
42-
excludeLabelFromRouter:
43-
type: boolean
4442
filters:
4543
items:
4644
properties:
@@ -975,6 +973,8 @@ spec:
975973
items:
976974
type: string
977975
type: array
976+
includeLabelInRouter:
977+
type: boolean
978978
loggingRef:
979979
type: string
980980
match:
@@ -1066,8 +1066,6 @@ spec:
10661066
type: object
10671067
spec:
10681068
properties:
1069-
excludeLabelFromRouter:
1070-
type: boolean
10711069
filters:
10721070
items:
10731071
properties:
@@ -2002,6 +2000,8 @@ spec:
20022000
items:
20032001
type: string
20042002
type: array
2003+
includeLabelInRouter:
2004+
type: boolean
20052005
loggingRef:
20062006
type: string
20072007
match:

Diff for: e2e/charts/logging-operator/crds/logging.banzaicloud.io_flows.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ spec:
3939
type: object
4040
spec:
4141
properties:
42-
excludeLabelFromRouter:
43-
type: boolean
4442
filters:
4543
items:
4644
properties:
@@ -975,6 +973,8 @@ spec:
975973
items:
976974
type: string
977975
type: array
976+
includeLabelInRouter:
977+
type: boolean
978978
localOutputRefs:
979979
items:
980980
type: string
@@ -1062,8 +1062,6 @@ spec:
10621062
type: object
10631063
spec:
10641064
properties:
1065-
excludeLabelFromRouter:
1066-
type: boolean
10671065
filters:
10681066
items:
10691067
properties:
@@ -1998,6 +1996,8 @@ spec:
19981996
items:
19991997
type: string
20001998
type: array
1999+
includeLabelInRouter:
2000+
type: boolean
20012001
localOutputRefs:
20022002
items:
20032003
type: string

Diff for: e2e/charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ spec:
5757
type: string
5858
defaultFlow:
5959
properties:
60-
excludeLabelFromRouter:
61-
type: boolean
6260
filters:
6361
items:
6462
properties:
@@ -993,6 +991,8 @@ spec:
993991
items:
994992
type: string
995993
type: array
994+
includeLabelInRouter:
995+
type: boolean
996996
outputRefs:
997997
items:
998998
type: string

Diff for: pkg/resources/model/system.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func FlowForFlow(flow v1beta1.Flow, clusterOutputs ClusterOutputs, outputs Outpu
258258

259259
flowID := fmt.Sprintf("flow:%s:%s", flow.Namespace, flow.Name)
260260

261-
result, err := types.NewFlow(matches, flowID, flow.Name, flow.Namespace, flow.Spec.FlowLabel, flow.Spec.ExcludeLabelFromRouter)
261+
result, err := types.NewFlow(matches, flowID, flow.Name, flow.Namespace, flow.Spec.FlowLabel, flow.Spec.IncludeLabelInRouter)
262262
if err != nil {
263263
return nil, err
264264
}
@@ -346,7 +346,7 @@ func FlowForClusterFlow(flow v1beta1.ClusterFlow, clusterOutputs ClusterOutputs,
346346

347347
flowID := fmt.Sprintf("clusterflow:%s:%s", flow.Namespace, flow.Name)
348348

349-
result, err := types.NewFlow(matches, flowID, flow.Name, flow.Namespace, flow.Spec.FlowLabel, flow.Spec.ExcludeLabelFromRouter)
349+
result, err := types.NewFlow(matches, flowID, flow.Name, flow.Namespace, flow.Spec.FlowLabel, flow.Spec.IncludeLabelInRouter)
350350
if err != nil {
351351
return nil, err
352352
}
@@ -383,7 +383,7 @@ func FlowForDefaultFlow(logging v1beta1.Logging, clusterOutputs ClusterOutputs,
383383

384384
flowID := fmt.Sprintf("logging:%s:%s", logging.Namespace, logging.Name)
385385

386-
result, err := types.NewFlow([]types.FlowMatch{}, flowID, logging.Name, logging.Namespace, logging.Spec.DefaultFlowSpec.FlowLabel, logging.Spec.DefaultFlowSpec.ExcludeLabelFromRouter)
386+
result, err := types.NewFlow([]types.FlowMatch{}, flowID, logging.Name, logging.Namespace, logging.Spec.DefaultFlowSpec.FlowLabel, logging.Spec.DefaultFlowSpec.IncludeLabelInRouter)
387387
if err != nil {
388388
return nil, err
389389
}

Diff for: pkg/sdk/logging/api/v1beta1/clusterflow_types.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ type ClusterFlowSpec struct {
7171
Filters []Filter `json:"filters,omitempty"`
7272
LoggingRef string `json:"loggingRef,omitempty"`
7373
// Deprecated
74-
OutputRefs []string `json:"outputRefs,omitempty"`
75-
GlobalOutputRefs []string `json:"globalOutputRefs,omitempty"`
76-
FlowLabel string `json:"flowLabel,omitempty"`
77-
ExcludeLabelFromRouter bool `json:"excludeLabelFromRouter,omitempty"`
74+
OutputRefs []string `json:"outputRefs,omitempty"`
75+
GlobalOutputRefs []string `json:"globalOutputRefs,omitempty"`
76+
FlowLabel string `json:"flowLabel,omitempty"`
77+
IncludeLabelInRouter *bool `json:"includeLabelInRouter,omitempty"`
7878
}
7979

8080
// +kubebuilder:object:root=true

Diff for: pkg/sdk/logging/api/v1beta1/flow_types.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ type FlowSpec struct {
3636
Filters []Filter `json:"filters,omitempty"`
3737
LoggingRef string `json:"loggingRef,omitempty"`
3838
// Deprecated
39-
OutputRefs []string `json:"outputRefs,omitempty"`
40-
GlobalOutputRefs []string `json:"globalOutputRefs,omitempty"`
41-
LocalOutputRefs []string `json:"localOutputRefs,omitempty"`
42-
FlowLabel string `json:"flowLabel,omitempty"`
43-
ExcludeLabelFromRouter bool `json:"excludeLabelFromRouter,omitempty"`
39+
OutputRefs []string `json:"outputRefs,omitempty"`
40+
GlobalOutputRefs []string `json:"globalOutputRefs,omitempty"`
41+
LocalOutputRefs []string `json:"localOutputRefs,omitempty"`
42+
FlowLabel string `json:"flowLabel,omitempty"`
43+
IncludeLabelInRouter *bool `json:"includeLabelInRouter,omitempty"`
4444
}
4545

4646
type Match struct {

Diff for: pkg/sdk/logging/api/v1beta1/logging_types.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ type LoggingList struct {
118118
type DefaultFlowSpec struct {
119119
Filters []Filter `json:"filters,omitempty"`
120120
// Deprecated
121-
OutputRefs []string `json:"outputRefs,omitempty"`
122-
GlobalOutputRefs []string `json:"globalOutputRefs,omitempty"`
123-
FlowLabel string `json:"flowLabel,omitempty"`
124-
ExcludeLabelFromRouter bool `json:"excludeLabelFromRouter,omitempty"`
121+
OutputRefs []string `json:"outputRefs,omitempty"`
122+
GlobalOutputRefs []string `json:"globalOutputRefs,omitempty"`
123+
FlowLabel string `json:"flowLabel,omitempty"`
124+
IncludeLabelInRouter *bool `json:"includeLabelInRouter,omitempty"`
125125
}
126126

127127
const (

Diff for: pkg/sdk/logging/api/v1beta1/zz_generated.deepcopy.go

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/sdk/logging/model/render/fluent_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ func TestMultipleOutput(t *testing.T) {
313313
"key1": "val1",
314314
"key2": "val2"},
315315
Namespaces: []string{"ns-test"}},
316-
}, "", "", "", "", false)
316+
}, "", "", "", "", &[]bool{true}[0])
317317
if err != nil {
318318
t.Fatal(err)
319319
}
@@ -392,7 +392,7 @@ func TestRenderFullFluentConfig(t *testing.T) {
392392
"key1": "val1",
393393
"key2": "val2"},
394394
Namespaces: []string{"ns-test"}},
395-
}, "", "", "", "", false)
395+
}, "", "", "", "", &[]bool{true}[0])
396396
if err != nil {
397397
t.Fatal(err)
398398
}
@@ -519,7 +519,7 @@ func TestRenderFullFluentConfigWithGlobalFilter(t *testing.T) {
519519
"key1": "val1",
520520
"key2": "val2"},
521521
Namespaces: []string{"ns-test"}},
522-
}, "", "", "", "", false)
522+
}, "", "", "", "", &[]bool{true}[0])
523523
if err != nil {
524524
t.Fatal(err)
525525
}
@@ -731,7 +731,7 @@ func ValidateRenderS3(t *testing.T, s3Config plugins.DirectiveConverter, expecte
731731
"key1": "val1",
732732
"key2": "val2"},
733733
Namespaces: []string{"ns-test"}},
734-
}, "", "", "", "", false)
734+
}, "", "", "", "", &[]bool{true}[0])
735735
if err != nil {
736736
return err
737737
}
@@ -787,7 +787,7 @@ func ValidateRenderS3(t *testing.T, s3Config plugins.DirectiveConverter, expecte
787787
}
788788

789789
func newFlowOrPanic(namespace string, labels map[string]string) *types.Flow {
790-
flowObj, err := types.NewFlow([]types.FlowMatch{{Labels: labels, Namespaces: []string{namespace}}}, "", "", "", "", false)
790+
flowObj, err := types.NewFlow([]types.FlowMatch{{Labels: labels, Namespaces: []string{namespace}}}, "", "", "", "", &[]bool{true}[0])
791791
if err != nil {
792792
panic(err)
793793
}
@@ -805,7 +805,7 @@ func newComplexFlow(namespace string, labels map[string]string, hosts []string,
805805
Negate: negate,
806806
},
807807
},
808-
"", "", "", "", false)
808+
"", "", "", "", &[]bool{true}[0])
809809
if err != nil {
810810
panic(err)
811811
}

Diff for: pkg/sdk/logging/model/render/test_helper.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func NewOutputPluginTest(t *testing.T, plugin plugins.DirectiveConverter) *Plugi
8888
flowObj, err := types.NewFlow(
8989
[]types.FlowMatch{
9090
{Namespaces: []string{"ns-test"}},
91-
}, "test", "flow-test", "ns-test", "", false)
91+
}, "test", "flow-test", "ns-test", "", &[]bool{true}[0])
9292
if err != nil {
9393
t.Fatal(err)
9494
}

Diff for: pkg/sdk/logging/model/types/builder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (s *SystemBuilder) RegisterFlow(f *Flow) error {
4242
}
4343
}
4444
s.flows = append(s.flows, f)
45-
if !f.ExcludeLabelFromRouter {
45+
if f.IncludeLabelInRouter == nil || *f.IncludeLabelInRouter {
4646
s.router.AddRoute(f)
4747
}
4848
return nil

Diff for: pkg/sdk/logging/model/types/flow.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ type Flow struct {
6868
// Fluentd label
6969
FlowLabel string `json:"-"`
7070

71-
// Flag whether to exclude flow from label_router
72-
ExcludeLabelFromRouter bool
71+
// Flag whether to include flow in label_router
72+
IncludeLabelInRouter *bool
7373
}
7474

7575
func (f *Flow) GetPluginMeta() *PluginMeta {
@@ -107,7 +107,7 @@ func (f *Flow) WithOutputs(output ...Output) *Flow {
107107
return f
108108
}
109109

110-
func NewFlow(matches []FlowMatch, id, name, namespace, flowLabel string, excludeLabelFromRouter bool) (*Flow, error) {
110+
func NewFlow(matches []FlowMatch, id, name, namespace, flowLabel string, includeLabelInRouter *bool) (*Flow, error) {
111111
if flowLabel == "" {
112112
var err error
113113
flowLabel, err = calculateFlowLabel(matches, name, namespace)
@@ -120,10 +120,10 @@ func NewFlow(matches []FlowMatch, id, name, namespace, flowLabel string, exclude
120120
Directive: "label",
121121
Tag: flowLabel,
122122
},
123-
FlowID: id,
124-
FlowLabel: flowLabel,
125-
Matches: matches,
126-
ExcludeLabelFromRouter: excludeLabelFromRouter,
123+
FlowID: id,
124+
FlowLabel: flowLabel,
125+
Matches: matches,
126+
IncludeLabelInRouter: includeLabelInRouter,
127127
}, nil
128128
}
129129

0 commit comments

Comments
 (0)