Implement Cluster Network Policy - #10810
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for Kubernetes Cluster Network Policy (ClusterNetworkPolicy) from the network-policy-api v1alpha2. The implementation adds new tiers (admin and baseline) for cluster-scoped network policies and integrates ClusterNetworkPolicy handling into the Calico data path.
Key changes:
- Adds new admin and baseline tier constants and initialization logic
- Implements ClusterNetworkPolicy client and conversion functions
- Updates dependency versions for Kubernetes and network-policy-api
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| libcalico-go/lib/names/policy.go | Adds tier names and policy name prefixes for admin/baseline cluster policies |
| libcalico-go/lib/clientv3/client.go | Initializes admin and baseline tiers during client setup |
| libcalico-go/lib/backend/syncersv1/felixsyncer/felixsyncerv1.go | Registers ClusterNetworkPolicy resource type for Felix syncing |
| libcalico-go/lib/backend/model/resource.go | Registers ClusterNetworkPolicy resource info |
| libcalico-go/lib/backend/model/kubeclusternetworkpolicy.go | Defines ClusterNetworkPolicy kind constant |
| libcalico-go/lib/backend/k8s/resources/kubeclusternetworkpolicy.go | Implements K8s client for ClusterNetworkPolicy resources |
| libcalico-go/lib/backend/k8s/k8s.go | Adds ClusterNetworkPolicy client initialization |
| libcalico-go/lib/backend/k8s/conversion/conversion.go | Adds conversion interface for ClusterNetworkPolicy |
| go.mod | Updates Kubernetes dependencies and adds network-policy-api dependency |
| felix/fv/infrastructure/infra_k8s.go | Updates tier cleanup to include new static tiers |
| api/pkg/apis/projectcalico/v3/tier.go | Adds tier order constants for admin and baseline tiers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
🔗 Link your GitHub account to AtlassianTo enable Code Reviewer, please link your GitHub account to your Atlassian account. Click here to connect your accounts This is a one-time setup that takes less than a minute. |
edcec43 to
ec976a0
Compare
|
|
||
| # The operator branch corresponding to this branch. | ||
| OPERATOR_BRANCH ?= master | ||
| OPERATOR_BRANCH ?= clusternetworkpolicy |
There was a problem hiding this comment.
Will revert this change when the operator PR is merged: tigera/operator#4155
fasaxc
left a comment
There was a problem hiding this comment.
LGTM, remember to fix OPERATOR_BRANCH.
Description
This PR implements ClusterNetwokrPolicy. It includes:
kube-admin, andkube-baseline.ClusterNetworkPolicyresources toGlobalNetworkPolicy.Adminis placed into Calicokube-admintier.Baselineis placed into Calicokube-baselinetier.This PR tracks the main branch of upstream repo: https://github.com/kubernetes-sigs/network-policy-api/tree/main
A follow up PR will pin to a specific tag when it's created upstream.
Related issues/PRs
Operator: tigera/operator#4155
Removing ANP/BANP: #11144
Goldmane support: #11417
Docs: tigera/docs#2416
Pick to private: https://github.com/tigera/calico-private/pull/10621
Todos
Release Note
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.