Skip to content

[RS-2546] Update operator to deploy waf-http-filter in Enterprise #4008

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

gantony
Copy link
Contributor

@gantony gantony commented Jun 20, 2025

Description

This PR updates the operator to deploy waf-http-filter in Enterprise when enabling the Gateway API.

This will setup the required waf-http-filter sidecar container in the envoy-proxy deployment, but envoy won't be configured to use it by default. To do so, the user will need to create a separate EnvoyExtensionPolicy to enable the filter and protect the traffic with WAF.

Release Note

Deploy the WAF HTTP Filter alongside the Envoy Proxy when running in Calico Enterprise.

For PR author

  • Tests for change.
  • If changing pkg/apis/, run make gen-files
  • If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

@gantony gantony force-pushed the antony-waf-http-filter branch from 6d4bc41 to 7414979 Compare June 23, 2025 09:32
@@ -402,7 +409,7 @@ func (pr *gatewayAPIImplementationComponent) Objects() ([]client.Object, []clien
CreateNamespace(
resources.namespace.Name,
pr.cfg.Installation.KubernetesProvider,
PSSBaseline,
PSSPrivileged,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should comment why we need Privileged here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}

if envoyProxy.Spec.Provider.Kubernetes.EnvoyDeployment.Container.VolumeMounts == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the mounts are non-nil? How/when can that happen, and do we need to append this volume mount?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be non-nil if we use a custom envoy proxy (functionality recently added by Nell). It's best to handle it so I've updated it with changes to do so (and tests).

}

// Add the init container to the deployment
if envoyProxy.Spec.Provider.Kubernetes.EnvoyDeployment.InitContainers == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What scenarios can the InitContainers be non-nil? And if they are non-nil, do we not want to insert this init container into them?

// Update the envoy proxy deployment to include the WAF HTTP filter

// Update Pod volumes
if envoyProxy.Spec.Provider.Kubernetes.EnvoyDeployment.Pod.Volumes == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here regarding nill-ness

@gantony gantony force-pushed the antony-waf-http-filter branch from ab92591 to 2e87cc5 Compare July 2, 2025 23:43
hasSocketVolumeMount := false
for _, volumeMount := range envoyProxy.Spec.Provider.Kubernetes.EnvoyDeployment.Container.VolumeMounts {
if volumeMount.Name == socketVolumeMount.Name {
hasSocketVolumeMount = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the initContainer we ensured the init container wafHTTPFilter was set as we expect. Why don't we do the same here?

hasSocketVolume := false
for _, volume := range envoyProxy.Spec.Provider.Kubernetes.EnvoyDeployment.Pod.Volumes {
if volume.Name == logsVolume.Name {
hasLogsVolume = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question

hasLogsVolume = true
}
if volume.Name == socketVolume.Name {
hasSocketVolume = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question

@LorcanMcVeigh
Copy link
Contributor

@tmjd I had to create a new PR with these changes because Antony created this on his fork and Although I had permissions to pull i couldn't push. So I created a branch off his on my own fork and re-created the PR with the changes your suggested. Sorry for any confusion : new PR #4032

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants