Documentation
¶
Index ¶
Constants ¶
View Source
const ( // SecretKeyAPIKey is the key name for the API key in the secret data SecretKeyAPIKey = "api-key" // AnnotationExpiration is the annotation key for the expiration time AnnotationExpiration = "api-key.headscale.infrado.cloud/expiration" // AnnotationCreatedAt is the annotation key for the creation time AnnotationCreatedAt = "api-key.headscale.infrado.cloud/created-at" )
Variables ¶
This section is empty.
Functions ¶
func GetAPIKeyFromSecret ¶
GetAPIKeyFromSecret extracts the API key from a secret
func GetExpirationFromSecret ¶
GetExpirationFromSecret extracts the expiration time from a secret
Types ¶
type Config ¶
type Config struct {
SocketPath string
Namespace string
SecretName string
Expiration string
RotationBuffer string
}
Config holds the configuration for the API key manager
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles API key lifecycle management
func NewManager ¶
NewManager creates a new API key manager
func (*Manager) CalculateNextRotation ¶
CalculateNextRotation calculates when the next rotation should occur
func (*Manager) EnsureAPIKey ¶
EnsureAPIKey ensures an API key exists and is valid, creating or rotating it if necessary
type SecretManager ¶
type SecretManager struct {
// contains filtered or unexported fields
}
SecretManager manages Kubernetes secrets for API keys
func NewSecretManager ¶
func NewSecretManager(namespace string) (*SecretManager, error)
NewSecretManager creates a new SecretManager
func (*SecretManager) CreateOrUpdateSecret ¶
func (sm *SecretManager) CreateOrUpdateSecret(ctx context.Context, secretName, apiKey string, expiration time.Time) error
CreateOrUpdateSecret creates or updates a secret with the API key
Click to show internal directories.
Click to hide internal directories.