Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(pick v1.37) remove -waf-log-file flag (#3722) [do not merge yet] #3723

Open
wants to merge 3 commits into
base: release-v1.37
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/apis/crd.projectcalico.org/v1/felixconfig.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2024 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2025 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -408,6 +408,10 @@ type FelixConfigurationSpec struct {
// `[fd00:83a6::12]:5353`.Note that Felix (calico-node) will need RBAC permission to read the details of
// each service specified by a `k8s-service:...` form. [Default: "k8s-service:kube-dns"].
DNSTrustedServers *[]string `json:"dnsTrustedServers,omitempty"`

// WAFEventLogsFileEnabled controls logging WAFEvent logs to a file. If false no WAFEvent logging to file will occur.
// [Default: false]
WAFEventLogsFileEnabled *bool `json:"wafEventLogsFileEnabled,omitempty"`
}

type RouteTableRange struct {
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/crd.projectcalico.org/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021-2024 Tigera, Inc. All rights reserved.
// Copyright (c) 2021-2025 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -569,19 +569,24 @@ func (r *ReconcileApplicationLayer) patchFelixConfiguration(ctx context.Context,
policySyncPrefix := r.getPolicySyncPathPrefix(&fc.Spec, al)
policySyncPrefixSetDesired := fc.Spec.PolicySyncPathPrefix == policySyncPrefix
tproxyModeSetDesired := fc.Spec.TPROXYMode != nil && *fc.Spec.TPROXYMode == tproxyMode
wafEventLogsFileEnabled := al != nil && ((al.Spec.SidecarInjection != nil && *al.Spec.SidecarInjection == operatorv1.SidecarEnabled) ||
(al.Spec.WebApplicationFirewall != nil && *al.Spec.WebApplicationFirewall == operatorv1.WAFEnabled))
wafEventLogsFileEnabledDesired := fc.Spec.WAFEventLogsFileEnabled != nil && *fc.Spec.WAFEventLogsFileEnabled == wafEventLogsFileEnabled

// If tproxy mode is already set to desired state return false to indicate patch not needed.
if policySyncPrefixSetDesired && tproxyModeSetDesired {
if policySyncPrefixSetDesired && tproxyModeSetDesired && wafEventLogsFileEnabledDesired {
return false, nil
}

fc.Spec.TPROXYMode = &tproxyMode
fc.Spec.PolicySyncPathPrefix = policySyncPrefix
fc.Spec.WAFEventLogsFileEnabled = &wafEventLogsFileEnabled

log.Info(
"Patching FelixConfiguration: ",
"policySyncPathPrefix", fc.Spec.PolicySyncPathPrefix,
"tproxyMode", string(tproxyMode),
"wafEventLogsFileEnabled", wafEventLogsFileEnabled,
)
return true, nil
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,14 @@ spec:
information about the BPF policy programs, which can be examined
with the calico-bpf command-line tool.
type: boolean
bpfProfiling:
description: |-
BPFProfiling controls profiling of BPF programs. At the monent, it can be
Disabled or Enabled. [Default: Disabled]
enum:
- Enabled
- Disabled
type: string
bpfRedirectToPeer:
description: 'BPFRedirectToPeer controls which whether it is allowed
to forward straight to the peer side of the workload devices. It
Expand Down
3 changes: 1 addition & 2 deletions pkg/render/applicationlayer/applicationlayer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021-2024 Tigera, Inc. All rights reserved.
// Copyright (c) 2021-2025 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -312,7 +312,6 @@ func (c *component) containers() []corev1.Container {
if c.config.PerHostWAFEnabled || c.config.SidecarInjectionEnabled {
commandArgs = append(
commandArgs,
"--waf-log-file", filepath.Join(CalicologsVolumePath, "waf", "waf.log"),
"--waf-ruleset-file", filepath.Join(ModSecurityRulesetVolumePath, "tigera.conf"),
)
if c.config.PerHostWAFEnabled {
Expand Down
3 changes: 1 addition & 2 deletions pkg/render/applicationlayer/applicationlayer_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021-2024 Tigera, Inc. All rights reserved.
// Copyright (c) 2021-2025 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -657,7 +657,6 @@ var _ = Describe("Tigera Secure Application Layer rendering tests", func() {
dikastesArgs := dikastesContainer.Command
expectedDikastesArgs := []string{
"--per-host-waf-enabled",
"--waf-log-file", filepath.Join(applicationlayer.CalicologsVolumePath, "waf", "waf.log"),
"--waf-ruleset-file", filepath.Join(applicationlayer.ModSecurityRulesetVolumePath, "tigera.conf"),
}
for _, element := range expectedDikastesArgs {
Expand Down