[PR #2789] [MERGED] feat: add autogroup:self #2862

Closed
opened 2025-12-29 04:19:24 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2789
Author: @vdovhanych
Created: 9/30/2025
Status: Merged
Merged: 10/16/2025
Merged by: @kradalby

Base: mainHead: group-self


📝 Commits (3)

  • de179be feat: add autogroup:self
  • df90368 chore: update docs for acl autogroups
  • a49a882 chore: add test for invalidateAutogroupSelfCache function

📊 Changes

15 files changed (+1448 additions, -26 deletions)

View changed files

📝 .github/workflows/test-integration.yaml (+2 -0)
📝 CHANGELOG.md (+3 -0)
📝 docs/about/features.md (+1 -1)
📝 docs/ref/acls.md (+87 -7)
📝 hscontrol/mapper/builder.go (+13 -2)
📝 hscontrol/policy/pm.go (+2 -0)
📝 hscontrol/policy/v2/filter.go (+209 -4)
📝 hscontrol/policy/v2/filter_test.go (+549 -0)
📝 hscontrol/policy/v2/policy.go (+173 -5)
📝 hscontrol/policy/v2/policy_test.go (+138 -0)
📝 hscontrol/policy/v2/types.go (+54 -6)
📝 hscontrol/policy/v2/types_test.go (+33 -1)
📝 hscontrol/state/state.go (+5 -0)
📝 integration/acl_test.go (+97 -0)
📝 integration/ssh_test.go (+82 -0)

📄 Description

  • have read the CONTRIBUTING.md file
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

This adds the autogroup:self feature and should close #2618

While the feature should now work, I still feel it needs a bit more work to be "production" ready. I am concerned about the headscale's performance when this autogroup is used in the ACL.

Update1:
I added and updated the documentation for the ACL rules, listing supported autogroups and providing some examples of usage.

Update2:
I was trying out the build on some test environments when I realized that SSH would not work with the autogroup:self and that it also needed special handling for filtering the nodes. I tried to address it with ddf4cc6a8d

Update3:
changed some stuff again for the SSH rules to work with autogroup:self (this was done after I tried to evaluate adding the feature with the AI agent, this was a suggestion, but it would not work without it) 80fba7a758


🔄 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/2789 **Author:** [@vdovhanych](https://github.com/vdovhanych) **Created:** 9/30/2025 **Status:** ✅ Merged **Merged:** 10/16/2025 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `group-self` --- ### 📝 Commits (3) - [`de179be`](https://github.com/juanfont/headscale/commit/de179beea61e40d682705d249fcfd410ac833ae6) feat: add autogroup:self - [`df90368`](https://github.com/juanfont/headscale/commit/df903688bd1d2eeadc41638c668b2ee2c7cb5089) chore: update docs for acl autogroups - [`a49a882`](https://github.com/juanfont/headscale/commit/a49a88210e81f2f2ab00c5140ae529ebcf000c15) chore: add test for invalidateAutogroupSelfCache function ### 📊 Changes **15 files changed** (+1448 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/test-integration.yaml` (+2 -0) 📝 `CHANGELOG.md` (+3 -0) 📝 `docs/about/features.md` (+1 -1) 📝 `docs/ref/acls.md` (+87 -7) 📝 `hscontrol/mapper/builder.go` (+13 -2) 📝 `hscontrol/policy/pm.go` (+2 -0) 📝 `hscontrol/policy/v2/filter.go` (+209 -4) 📝 `hscontrol/policy/v2/filter_test.go` (+549 -0) 📝 `hscontrol/policy/v2/policy.go` (+173 -5) 📝 `hscontrol/policy/v2/policy_test.go` (+138 -0) 📝 `hscontrol/policy/v2/types.go` (+54 -6) 📝 `hscontrol/policy/v2/types_test.go` (+33 -1) 📝 `hscontrol/state/state.go` (+5 -0) 📝 `integration/acl_test.go` (+97 -0) 📝 `integration/ssh_test.go` (+82 -0) </details> ### 📄 Description <!-- Headscale is "Open Source, acknowledged contribution", this means that any contribution will have to be discussed with the Maintainers before being submitted. This model has been chosen to reduce the risk of burnout by limiting the maintenance overhead of reviewing and validating third-party code. Headscale is open to code contributions for bug fixes without discussion. If you find mistakes in the documentation, please submit a fix to the documentation. --> <!-- Please tick if the following things apply. You… --> - [x] have read the [CONTRIBUTING.md](./CONTRIBUTING.md) file - [x] raised a GitHub issue or discussed it on the projects chat beforehand - [x] added unit tests - [x] added integration tests - [x] updated documentation if needed - [x] updated CHANGELOG.md <!-- If applicable, please reference the issue using `Fixes #XXX` and add tests to cover your new code. --> This adds the autogroup:self feature and should close #2618 While the feature should now work, I still feel it needs a bit more work to be "production" ready. I am concerned about the headscale's performance when this autogroup is used in the ACL. Update1: I added and updated the documentation for the ACL rules, listing supported autogroups and providing some examples of usage. Update2: I was trying out the build on some test environments when I realized that SSH would not work with the `autogroup:self` and that it also needed special handling for filtering the nodes. I tried to address it with https://github.com/juanfont/headscale/pull/2789/commits/ddf4cc6a8d1a76ac3bb2d804578e1eff74a93e7e Update3: changed some stuff again for the SSH rules to work with autogroup:self (this was done after I tried to evaluate adding the feature with the AI agent, this was a suggestion, but it would not work without it) https://github.com/juanfont/headscale/pull/2789/commits/80fba7a758c1b5dc27773e5565164c0b24be46ca --- <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 04:19:24 +01:00
adam closed this issue 2025-12-29 04:19:24 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2862