secrets

package
v0.7.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

pkg/secrets

Shared secret lifecycle utilities used by both the runtime and the gateway.

These helpers live here rather than in pkg/runtime/runners/ because the gateway Apply API also needs secret existence checks and rotation logic for token secret management. Extracting them here avoids a gateway → runtime import.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteSecretForRotation

func DeleteSecretForRotation(ctx context.Context, kube kubeclient.KubeClient, namespace, name string) error

DeleteSecretForRotation deletes a Secret so it can be recreated with fresh values. Called when SecretNeedsRotation returns true. The next create call then generates new credentials and annotates with the current time.

func GenerationAnnotations

func GenerationAnnotations(rotateAfter string) map[string]string

GenerationAnnotations returns the annotations to add to a freshly generated Secret.

func IsNotFoundErr

func IsNotFoundErr(err error) bool

IsNotFoundErr returns true when err is a Kubernetes 404 Not Found error.

func SecretExists

func SecretExists(ctx context.Context, kube kubeclient.KubeClient, namespace, name string) (bool, error)

SecretExists checks whether a Secret with the given name exists in the namespace. Uses ResourceVersion: "0" to read from the API server watch cache (not etcd). Returns true if the secret exists, false on NotFound, error on API failure.

func SecretNeedsRotation

func SecretNeedsRotation(ctx context.Context, kube kubeclient.KubeClient, namespace, name, rotateAfter string) (bool, error)

SecretNeedsRotation returns true when the Secret exists but has exceeded its rotation threshold. Reads the generated-at annotation and compares to the declared rotateAfter duration.

Returns false (no rotation) when:

  • rotateAfter is not set
  • Secret does not exist
  • Generated-at annotation is missing or unparseable → regenerate to be safe

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL