kubernetes

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SecretTypeGitRepository is the type for git repository secrets
	SecretTypeGitRepository = "kubernetes.io/git-repository"

	// AnnotationManagedBy indicates the secret is managed by this controller
	AnnotationManagedBy = "flux-extension-controller.nrfcloud.com/managed-by"

	// AnnotationTokenExpiry stores the token expiration time
	AnnotationTokenExpiry = "flux-extension-controller.nrfcloud.com/token-expiry"

	// AnnotationRepositoryURL stores the repository URL
	AnnotationRepositoryURL = "flux-extension-controller.nrfcloud.com/repository-url"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SecretManager

type SecretManager struct {
	// contains filtered or unexported fields
}

SecretManager handles Kubernetes secret operations for Git repositories

func NewSecretManager

func NewSecretManager(client client.Client) *SecretManager

NewSecretManager creates a new secret manager

func (*SecretManager) CreateOrUpdateSecret

func (sm *SecretManager) CreateOrUpdateSecret(
	ctx context.Context,
	namespace, name string,
	token *github.InstallationToken,
	repositoryURL string,
	owner metav1.Object,
) error

CreateOrUpdateSecret creates or updates a Git repository secret with the GitHub token

func (*SecretManager) GetSecret

func (sm *SecretManager) GetSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error)

GetSecret retrieves a secret by name and namespace

func (*SecretManager) GetTokenExpiry

func (sm *SecretManager) GetTokenExpiry(secret *corev1.Secret) (time.Time, error)

GetTokenExpiry returns the token expiration time from secret annotations

func (*SecretManager) IsSecretManagedByController

func (sm *SecretManager) IsSecretManagedByController(secret *corev1.Secret) bool

IsSecretManagedByController checks if a secret is managed by this controller

func (*SecretManager) NeedsTokenRefresh

func (sm *SecretManager) NeedsTokenRefresh(secret *corev1.Secret, refreshThreshold time.Duration) (bool, error)

NeedsTokenRefresh checks if the secret's token needs to be refreshed

func (*SecretManager) ValidateSecretOwnership

func (sm *SecretManager) ValidateSecretOwnership(ctx context.Context, namespace, name string, repositoryURL string) error

ValidateSecretOwnership checks if a secret can be managed by this controller

Jump to

Keyboard shortcuts

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