integration: support auth keys without user

Add AuthKeyOptions to create auth keys owned by tags only.
This commit is contained in:
Kristoffer Dalby
2026-01-07 12:12:53 +01:00
committed by Kristoffer Dalby
parent 3b4b9a4436
commit 740d2b5a2c
3 changed files with 70 additions and 53 deletions

View File

@@ -478,6 +478,22 @@ func (s *Scenario) CreatePreAuthKey(
return nil, fmt.Errorf("failed to create user: %w", errNoHeadscaleAvailable)
}
// CreatePreAuthKeyWithOptions creates a "pre authorised key" with the specified options
// to be created in the Headscale instance on behalf of the Scenario.
func (s *Scenario) CreatePreAuthKeyWithOptions(opts hsic.AuthKeyOptions) (*v1.PreAuthKey, error) {
headscale, err := s.Headscale()
if err != nil {
return nil, fmt.Errorf("failed to create preauth key with options: %w", errNoHeadscaleAvailable)
}
key, err := headscale.CreateAuthKeyWithOptions(opts)
if err != nil {
return nil, fmt.Errorf("failed to create preauth key with options: %w", err)
}
return key, nil
}
// CreatePreAuthKeyWithTags creates a "pre authorised key" with the specified tags
// to be created in the Headscale instance on behalf of the Scenario.
func (s *Scenario) CreatePreAuthKeyWithTags(