Documentation
¶
Index ¶
- Constants
- type SecretManager
- func (sm *SecretManager) CreateOrUpdateSecret(ctx context.Context, namespace, name string, token *github.InstallationToken, ...) error
- func (sm *SecretManager) GetSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error)
- func (sm *SecretManager) GetTokenExpiry(secret *corev1.Secret) (time.Time, error)
- func (sm *SecretManager) IsSecretManagedByController(secret *corev1.Secret) bool
- func (sm *SecretManager) NeedsTokenRefresh(secret *corev1.Secret, refreshThreshold time.Duration) (bool, error)
- func (sm *SecretManager) ValidateSecretOwnership(ctx context.Context, namespace, name string, repositoryURL string) error
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 ¶
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
Click to show internal directories.
Click to hide internal directories.