[PR #2214] [MERGED] Experimental implementation of Policy v2 #2550

Closed
opened 2025-12-29 03:21:46 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2214
Author: @kradalby
Created: 10/25/2024
Status: Merged
Merged: 3/10/2025
Merged by: @kradalby

Base: mainHead: kradalby/typedpolicyv2


📝 Commits (10+)

  • 1dd50c6 utility iterator for ipset
  • e9ffc4f split policy -> policy and v1
  • 0d95945 use polivyv1 definitions in integration tests
  • 17fa0bc formatter: breaks lines
  • d4de4e9 remove compareprefix, use tsaddr version
  • 7d04c97 remove getacl test, add back autoapprover
  • 236ad30 use policy manager tag handling
  • c0f8562 rename display helper for user
  • 72049e9 introduce policy v2 package
  • b55a7d8 wire up policyv2 in integration testing

📊 Changes

41 files changed (+5986 additions, -2221 deletions)

View changed files

📝 .github/workflows/gh-action-integration-generator.go (+6 -4)
.github/workflows/test-integration-policyv2.yaml (+159 -0)
📝 .github/workflows/test-integration.yaml (+3 -2)
📝 CHANGELOG.md (+52 -12)
📝 hscontrol/app.go (+16 -5)
📝 hscontrol/db/db.go (+2 -1)
📝 hscontrol/db/node_test.go (+156 -226)
📝 hscontrol/debug.go (+5 -0)
📝 hscontrol/grpcv1.go (+7 -2)
📝 hscontrol/mapper/mapper_test.go (+28 -25)
📝 hscontrol/mapper/tail.go (+6 -1)
📝 hscontrol/mapper/tail_test.go (+5 -5)
📝 hscontrol/oidc.go (+1 -1)
📝 hscontrol/policy/pm.go (+45 -183)
hscontrol/policy/policy.go (+109 -0)
hscontrol/policy/policy_test.go (+1455 -0)
📝 hscontrol/policy/v1/acls.go (+3 -118)
📝 hscontrol/policy/v1/acls_test.go (+91 -1473)
📝 hscontrol/policy/v1/acls_types.go (+1 -1)
hscontrol/policy/v1/policy.go (+187 -0)

...and 21 more files

📄 Description

This PR is a series of commits which is exploring a new way of structuring the policy, the goals are:

  • Type as much as possible, making it possible to emit errors on load
  • Easier to maintain and work with
  • Pre-compute when there is a change, not when a node gets an update

Updates #2416

Signed-off-by: Kristoffer Dalby kristoffer@tailscale.com


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/2214 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 10/25/2024 **Status:** ✅ Merged **Merged:** 3/10/2025 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `kradalby/typedpolicyv2` --- ### 📝 Commits (10+) - [`1dd50c6`](https://github.com/juanfont/headscale/commit/1dd50c6916e29dd2512f6bcd862be3353de2a646) utility iterator for ipset - [`e9ffc4f`](https://github.com/juanfont/headscale/commit/e9ffc4f2df6bbe5cf1077432bf06ff37efc31145) split policy -> policy and v1 - [`0d95945`](https://github.com/juanfont/headscale/commit/0d959459996ab983be354960a5d26fe83ab2dc5a) use polivyv1 definitions in integration tests - [`17fa0bc`](https://github.com/juanfont/headscale/commit/17fa0bcaa57cb9696abc2c7a04962bba47c474c2) formatter: breaks lines - [`d4de4e9`](https://github.com/juanfont/headscale/commit/d4de4e99be60300dafd048165f8048085cbbbd91) remove compareprefix, use tsaddr version - [`7d04c97`](https://github.com/juanfont/headscale/commit/7d04c971461553533e6c15aa1e2c35a6280a200f) remove getacl test, add back autoapprover - [`236ad30`](https://github.com/juanfont/headscale/commit/236ad30d61216c3034d7f21f2d00f8e6ab7f3ee5) use policy manager tag handling - [`c0f8562`](https://github.com/juanfont/headscale/commit/c0f856256a2885871204393993d61a97ddfade55) rename display helper for user - [`72049e9`](https://github.com/juanfont/headscale/commit/72049e94b1c0d10da322ca7b1064f34c0ce48c55) introduce policy v2 package - [`b55a7d8`](https://github.com/juanfont/headscale/commit/b55a7d8b52e8a27dae57038783856ad39f862b1a) wire up policyv2 in integration testing ### 📊 Changes **41 files changed** (+5986 additions, -2221 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/gh-action-integration-generator.go` (+6 -4) ➕ `.github/workflows/test-integration-policyv2.yaml` (+159 -0) 📝 `.github/workflows/test-integration.yaml` (+3 -2) 📝 `CHANGELOG.md` (+52 -12) 📝 `hscontrol/app.go` (+16 -5) 📝 `hscontrol/db/db.go` (+2 -1) 📝 `hscontrol/db/node_test.go` (+156 -226) 📝 `hscontrol/debug.go` (+5 -0) 📝 `hscontrol/grpcv1.go` (+7 -2) 📝 `hscontrol/mapper/mapper_test.go` (+28 -25) 📝 `hscontrol/mapper/tail.go` (+6 -1) 📝 `hscontrol/mapper/tail_test.go` (+5 -5) 📝 `hscontrol/oidc.go` (+1 -1) 📝 `hscontrol/policy/pm.go` (+45 -183) ➕ `hscontrol/policy/policy.go` (+109 -0) ➕ `hscontrol/policy/policy_test.go` (+1455 -0) 📝 `hscontrol/policy/v1/acls.go` (+3 -118) 📝 `hscontrol/policy/v1/acls_test.go` (+91 -1473) 📝 `hscontrol/policy/v1/acls_types.go` (+1 -1) ➕ `hscontrol/policy/v1/policy.go` (+187 -0) _...and 21 more files_ </details> ### 📄 Description This PR is a series of commits which is exploring a new way of structuring the policy, the goals are: - Type as much as possible, making it possible to emit errors on load - Easier to maintain and work with - Pre-compute when there is a change, not when a node gets an update Updates #2416 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 03:21:46 +01:00
adam closed this issue 2025-12-29 03:21:46 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2550