[PR #206] [MERGED] Prepare and show gRPC usage in CLI #1321

Closed
opened 2025-12-29 02:29:41 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/206
Author: @kradalby
Created: 10/29/2021
Status: Merged
Merged: 11/4/2021
Merged by: @kradalby

Base: mainHead: initial-api-cli-work


📝 Commits (10+)

  • 06700c1 Setup proto linting
  • 07bbeaf Fix lint errors, add initial namespace rpc
  • c7fa9b6 Setup create, delete and list namespace over grpc
  • a23d82e Setup API and prepare for API keys
  • 6d10be8 Change order of print/nil check in integration test
  • 68dab0f Move localhost check to utils
  • 002b5c1 Add grpc token auth struct
  • eefd82a Move config loading out of the headscale app setup
  • 81b8610 Add helper function to setup grpc client for cli
  • 9ef031f Port create, delete and list of namespace to grpc

📊 Changes

21 files changed (+2278 additions, -1339 deletions)

View changed files

📝 .dockerignore (+2 -0)
📝 .github/workflows/build.yml (+1 -1)
📝 Makefile (+3 -0)
📝 app.go (+195 -16)
📝 cmd/headscale/cli/namespaces.go (+26 -12)
📝 cmd/headscale/cli/utils.go (+100 -14)
📝 config-example.yaml (+6 -3)
gen/go/headscale/v1/headscale.pb.go (+807 -0)
gen/go/headscale/v1/headscale.pb.gw.go (+414 -0)
gen/go/headscale/v1/headscale_grpc.pb.go (+209 -0)
gen/go/v1/headscale.pb.go (+0 -702)
gen/go/v1/headscale.pb.gw.go (+0 -185)
gen/go/v1/headscale_grpc.pb.go (+0 -101)
gen/openapiv2/headscale/v1/headscale.swagger.json (+250 -0)
gen/openapiv2/v1/headscale.swagger.json (+0 -210)
📝 grpcv1.go (+46 -5)
📝 integration_test.go (+41 -19)
proto/headscale/v1/headscale.proto (+106 -0)
proto/v1/headscale.proto (+0 -71)
swagger.go (+65 -0)

...and 1 more files

📄 Description

This PR prepares and demonstrates the upcoming work to get the CLI communicating with the server via gRPC instead of modifying the database.

It sets up:

  • Authentication (currently deny everything but localhost)
  • Prepare for API keys to be used as initial authentication for gRPC/HTTP api for clients
  • Lint and restructure proto files after buf's suggestions
  • Add a demonstration of create, delete and list namespaces with gRPC
    • Those were the easiest commands that would also use the integration tests.

I need help testing this in the wild, please help me set this up on servers and actually test that it behaves like you would expect.

  • Use the CLI to create namespaces with a running server
  • test with and without Certs (lets encrypt and others)
  • anything I could have forgotten.

🔄 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/206 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 10/29/2021 **Status:** ✅ Merged **Merged:** 11/4/2021 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `initial-api-cli-work` --- ### 📝 Commits (10+) - [`06700c1`](https://github.com/juanfont/headscale/commit/06700c1dc4f69c44f5b49a164a874b1e25355cf9) Setup proto linting - [`07bbeaf`](https://github.com/juanfont/headscale/commit/07bbeafa3b2a703f3dd2a6258463b90eef45e886) Fix lint errors, add initial namespace rpc - [`c7fa9b6`](https://github.com/juanfont/headscale/commit/c7fa9b6e4a7593eb37d729f158225cf4139fe6fd) Setup create, delete and list namespace over grpc - [`a23d82e`](https://github.com/juanfont/headscale/commit/a23d82e33af1117160a43d48249359eb54b55540) Setup API and prepare for API keys - [`6d10be8`](https://github.com/juanfont/headscale/commit/6d10be8fff95989dc52ec53bb478a0fbb51a1ad1) Change order of print/nil check in integration test - [`68dab0f`](https://github.com/juanfont/headscale/commit/68dab0fe7b68e0abf8a3f78d42194c4f8b88de67) Move localhost check to utils - [`002b5c1`](https://github.com/juanfont/headscale/commit/002b5c1dad9ba24baa4b54edab586c5f49136152) Add grpc token auth struct - [`eefd82a`](https://github.com/juanfont/headscale/commit/eefd82a574b475c654e2a0a467fc2e828938f8cc) Move config loading out of the headscale app setup - [`81b8610`](https://github.com/juanfont/headscale/commit/81b8610dff579b1516f6fe579eff7e3811a9f332) Add helper function to setup grpc client for cli - [`9ef031f`](https://github.com/juanfont/headscale/commit/9ef031f0f841cb9fb93d7350857f9b7882f2b7f1) Port create, delete and list of namespace to grpc ### 📊 Changes **21 files changed** (+2278 additions, -1339 deletions) <details> <summary>View changed files</summary> 📝 `.dockerignore` (+2 -0) 📝 `.github/workflows/build.yml` (+1 -1) 📝 `Makefile` (+3 -0) 📝 `app.go` (+195 -16) 📝 `cmd/headscale/cli/namespaces.go` (+26 -12) 📝 `cmd/headscale/cli/utils.go` (+100 -14) 📝 `config-example.yaml` (+6 -3) ➕ `gen/go/headscale/v1/headscale.pb.go` (+807 -0) ➕ `gen/go/headscale/v1/headscale.pb.gw.go` (+414 -0) ➕ `gen/go/headscale/v1/headscale_grpc.pb.go` (+209 -0) ➖ `gen/go/v1/headscale.pb.go` (+0 -702) ➖ `gen/go/v1/headscale.pb.gw.go` (+0 -185) ➖ `gen/go/v1/headscale_grpc.pb.go` (+0 -101) ➕ `gen/openapiv2/headscale/v1/headscale.swagger.json` (+250 -0) ➖ `gen/openapiv2/v1/headscale.swagger.json` (+0 -210) 📝 `grpcv1.go` (+46 -5) 📝 `integration_test.go` (+41 -19) ➕ `proto/headscale/v1/headscale.proto` (+106 -0) ➖ `proto/v1/headscale.proto` (+0 -71) ➕ `swagger.go` (+65 -0) _...and 1 more files_ </details> ### 📄 Description This PR prepares and demonstrates the upcoming work to get the CLI communicating with the server via gRPC instead of modifying the database. It sets up: - Authentication (currently deny everything but localhost) - Prepare for API keys to be used as initial authentication for gRPC/HTTP api for clients - Lint and restructure proto files after `buf`'s suggestions - Add a demonstration of create, delete and list namespaces with gRPC - Those were the easiest commands that would also use the integration tests. I need help testing this in the wild, please help me set this up on servers and actually test that it behaves like you would expect. - Use the CLI to create namespaces with a running server - test with and without Certs (lets encrypt and others) - anything I could have forgotten. --- <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 02:29:41 +01:00
adam closed this issue 2025-12-29 02:29:41 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1321