Skip to content

Set DSCP for workload's egress traffic leaving cluster#10718

Merged
mazdakn merged 18 commits intoprojectcalico:masterfrom
mazdakn:dscp-dp
Aug 20, 2025
Merged

Set DSCP for workload's egress traffic leaving cluster#10718
mazdakn merged 18 commits intoprojectcalico:masterfrom
mazdakn:dscp-dp

Conversation

@mazdakn
Copy link
Member

@mazdakn mazdakn commented Jul 23, 2025

Description

Set DSCP for egress traffic leaving cluster when qos.projectcalico.org/dscp annotation is set on a workload endpoint, i.e. pod.

This PR includes:

  • Adding a new type named DSCP that holds numeric values between 0-63 and common string values.
  • Libcalico-go changes: Adding the new annotation to workload endpoint.
  • Calc graph:
    • Defining a new protobuf message called QosPolicy.
    • conversion from annotation value to QosPolicy for workload endpoints.
  • Dataplane:
    • new dataplane manager to watch for workload endpoints and potential assigned QosPolicy.
    • new iptables/nftables action for setting DSCP.
    • new static chain to jump to QoS policy rules in post routing chain of mangle table.
  • Felix FVs

The follow up PRs will cover:

Related issues/PRs

Todos

  • Tests
  • Documentation
  • Release note

Release Note

Set the Differentiated Services Code Point (DSCP) on an endpoint's outgoing network traffic leaving cluster.
This is done by adding "qos.projectcalico.org/dscp" annotation to workloads and host endpoints.

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

Copilot AI review requested due to automatic review settings July 23, 2025 00:25
@mazdakn mazdakn requested a review from a team as a code owner July 23, 2025 00:25
@mazdakn mazdakn added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Jul 23, 2025
@marvin-tigera marvin-tigera added this to the Calico v3.31.0 milestone Jul 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for setting DSCP (Differentiated Services Code Point) values on egress traffic in Calico workload endpoints through QoS controls. The implementation allows users to specify DSCP values either through named constants (like "EF", "AF11") or numeric values via Kubernetes annotations.

Key changes:

  • Introduces a new DSCP type that supports both string and numeric values
  • Adds annotation support for configuring DSCP on workload endpoints
  • Updates protobuf definitions and conversion logic to handle DSCP in QoS controls

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
api/pkg/lib/numorstring/dscp.go New DSCP type implementation with predefined constants and string/numeric support
libcalico-go/lib/backend/k8s/conversion/constants.go Adds new annotation constant for DSCP configuration
libcalico-go/lib/backend/k8s/conversion/workload_endpoint_default.go Implements annotation parsing for DSCP values
libcalico-go/lib/apis/v3/workloadendpoint.go Adds DSCP field to QoSControls struct
felix/proto/felixbackend.proto Updates protobuf definition to include DSCP field
felix/proto/felixbackend.pb.go Generated protobuf code with DSCP support
felix/calc/event_sequencer.go Adds DSCP conversion in model-to-proto transformation

@mazdakn mazdakn mentioned this pull request Aug 15, 2025
3 tasks
@mazdakn mazdakn changed the title Set DSCP for egress traffic Set DSCP for workload's egress traffic leaving cluster Aug 15, 2025
@mazdakn mazdakn requested a review from caseydavenport August 18, 2025 20:02
@mazdakn mazdakn merged commit c141d2d into projectcalico:master Aug 20, 2025
1 of 3 checks passed
@mazdakn mazdakn deleted the dscp-dp branch August 20, 2025 21:34
@mazdakn mazdakn mentioned this pull request Sep 19, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-pr-required Change is not yet documented release-note-required Change has user-facing impact (no matter how small)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants