Conversation
|
| Filename | Overview |
|---|---|
| .golangci.yml | Adds gci/gofmt/gofumpt/goimports formatters and gocyclo linter, but increases gocyclo min-complexity from 15 to 40 — an overly aggressive threshold relaxation that masks code quality concerns. |
| pkg/sdk/logging/api/v1beta1/logging_types.go | Replaces hardcoded label key strings with types.*Label constants for fluentd and syslog-ng, and updates GenerateLoggingRefLabels to use types.ManagedByLabel; functionally equivalent refactor. |
| pkg/resources/fluentbit/daemonset.go | Adds types.ComponentLabel: "collector" to FluentBit DaemonSet pod template labels (while keeping the selector unchanged), completing the standard Kubernetes label set on collector pods. |
| pkg/resources/fluentd/statefulset.go | Adds types.InstanceLabel: r.Logging.GetName() to Fluentd StatefulSet pod template labels (selector unchanged), providing a consistent app.kubernetes.io/instance label across all pod types. |
| pkg/resources/syslogng/statefulset.go | Same pattern as fluentd: adds types.InstanceLabel: r.Logging.GetName() to SyslogNG StatefulSet pod template labels without touching the immutable selector. |
| pkg/resources/hosttailer/helpers.go | Adds allLabels() helper that extends selectorLabels() with types.ComponentLabel: "host-tailer"; replaces manual loop with maps.Copy. |
| pkg/resources/eventtailer/helpers.go | Adds allLabels() helper that extends selectorLabels() with types.ComponentLabel: "event-tailer"; replaces manual loop with maps.Copy. |
| main.go | Replaces hardcoded app.kubernetes.io/managed-by and app.kubernetes.io/name strings in cache setup with operatortypes.*Label constants; a //nolint: gci directive is placed on the wrong line and will not suppress the intended lint warning. |
| pkg/resources/configcheck/configcheck.go | Replaces hardcoded app.kubernetes.io/component and app.kubernetes.io/managed-by strings in ConfigCheckCleaner label selector with types.*Label constants. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph "Labels on pod templates AFTER this PR"
FB["FluentBit DaemonSet pods\napp.kubernetes.io/name: fluentbit\napp.kubernetes.io/instance: <agent-name>\napp.kubernetes.io/managed-by: <logging-ref>\n✅ NEW: app.kubernetes.io/component: collector"]
FD["Fluentd StatefulSet pods\napp.kubernetes.io/name: fluentd\napp.kubernetes.io/component: fluentd\napp.kubernetes.io/managed-by: <logging-ref>\n✅ NEW: app.kubernetes.io/instance: <logging-name>"]
SNG["SyslogNG StatefulSet pods\napp.kubernetes.io/name: syslog-ng\napp.kubernetes.io/component: syslog-ng\napp.kubernetes.io/managed-by: <logging-ref>\n✅ NEW: app.kubernetes.io/instance: <logging-name>"]
HT["HostTailer DaemonSet pods\napp.kubernetes.io/name: host-tailer\napp.kubernetes.io/instance: <tailer-name>\n✅ NEW: app.kubernetes.io/component: host-tailer"]
ET["EventTailer StatefulSet pods\napp.kubernetes.io/name: event-tailer\napp.kubernetes.io/instance: <tailer-name>\n✅ NEW: app.kubernetes.io/component: event-tailer"]
end
subgraph "Selector labels (unchanged / immutable)"
FBS["FluentBit selector\nname + instance + managed-by"]
FDS["Fluentd selector\nname + component + managed-by"]
SNGS["SyslogNG selector\nname + component + managed-by"]
HTS["HostTailer selector\nname + instance"]
ETS["EventTailer selector\nname + instance"]
end
FBS -->|"subset of"| FB
FDS -->|"subset of"| FD
SNGS -->|"subset of"| SNG
HTS -->|"subset of"| HT
ETS -->|"subset of"| ET
Comments Outside Diff (3)
-
.golangci.yml, line 32 (link)Aggressive
gocyclothreshold increaseThe
min-complexityforgocyclowas raised from15to40— nearly a 3× increase. This is a wide suppression of cyclomatic complexity warnings rather than a targeted fix for the two functions that exceed the old threshold (FluentBitDefaultsandNewValidationReconciler, which received//nolint: gocyclosuppressions at their definition sites).The previous threshold of
15is already quite permissive;40means functions can have extremely convoluted branching before the linter raises a concern, effectively making the rule close to useless. Consider keeping the threshold lower (e.g.,25) and adding a narrow file/function level//nolint:gocyclofor the specific functions that legitimately exceed it.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
main.go, line 64-65 (link)Misplaced
//nolint: gcidirectiveThe
//nolint: gcicomment is placed on its own line before// +kubebuilder:scaffold:imports. In golangci-lint, a nolint directive suppresses warnings for the line it is on, not for the line that follows. As written, the directive applies to the blank comment line itself rather than to the scaffold marker, so the suppression likely has no effect.If the
gcilinter is genuinely flagging// +kubebuilder:scaffold:imports, the nolint should be placed inline on the same line as the scaffold marker:The same pattern appears in
controllers/logging/suite_test.goat the analogous location. -
controllers/logging/suite_test.go, line 40-41 (link)Misplaced
//nolint: gcidirective (same issue asmain.go)Same as the
main.gocase: the//nolint: gciis on a separate line and will not suppress the lint warning on the// +kubebuilder:scaffold:importsmarker that follows it. Move the directive inline:
Last reviewed commit: fcd2c98
Additional Comments (2)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
aec0c8c to
40753cc
Compare
Additional Comments (1)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
40753cc to
d96cbd8
Compare
|
@greptile |
Additional Comments (2)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
d96cbd8 to
513d67f
Compare
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
513d67f to
fcd2c98
Compare
fixes: #2110