vault

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package vault is a secret client to save cluster info to vault

Index

Constants

View Source
const (
	RoleNameKeyArgo    = "Argo"
	RoleNameKeyRuntime = "Runtime"
	AuthPathFormat     = "auth/%s/config"
	SecretPathFormat   = "kubernetes/%s/default/admin" //nolint:gosec
)
View Source
const (
	ContextKeyConfig nautesctx.ContextKey = "vault.client.config"
)
View Source
const (
	EnvVaultProxyClientKeypairPath = "VAULT_PROXY_CLIENT_KEYPAIR_PATH"
)

Variables

This section is empty.

Functions

func ErrorRoleNameNotFound

func ErrorRoleNameNotFound(name string) error

func NewVaultClient

func NewVaultClient(ctx context.Context, cfg *configs.Config, k8sClient client.Client) (secretclient.SecretClient, error)

Types

type InitOpt

type InitOpt func(vs *VaultClient) error

type KubernetesClient

type KubernetesClient interface {
	GetCluster(ctx context.Context, name, namespace string) (*v1alpha1.Cluster, error)
	GetServiceAccount(ctx context.Context, name, namespace string) (*v1.ServiceAccount, error)
	GetSecret(ctx context.Context, name, namespace string) (*v1.Secret, error)
	ListStatefulSets(ctx context.Context, namespace string, opts metav1.ListOptions) (*appsv1.StatefulSetList, error)
}

func NewK8SClient

func NewK8SClient(kubeconfig string) (KubernetesClient, error)

type SyncAuthResult

type SyncAuthResult struct {
}

type SyncResult

type SyncResult struct {
	Secret *SyncSecretResult
	Auth   *SyncAuthResult
	Error  error
}

type SyncSecretResult

type SyncSecretResult struct {
	SecretVersion int
}

type VaultClient

type VaultClient struct {
	Vault          *vault.Client
	VaultProxy     vaultproxyv1.SecretHTTPClient
	VaultAuth      vaultproxyv1.AuthHTTPClient
	VaultAuthGrant vaultproxyv1.AuthGrantHTTPClient

	TenantAuthName string
	Configs        *configs.Config
	Client         client.Client
	GetKubeClient  kubeClientFactory
	// contains filtered or unexported fields
}

func NewVaultClientWithOpts

func NewVaultClientWithOpts(ctx context.Context, cfg *configs.Config, opts ...InitOpt) (*VaultClient, error)

func (*VaultClient) CleanCluster

func (vc *VaultClient) CleanCluster(ctx context.Context, cluster, lastCluster *nautescrd.Cluster, _ *SyncResult) error

func (*VaultClient) Delete

func (vc *VaultClient) Delete(ctx context.Context, cluster *nautescrd.Cluster) error

func (*VaultClient) GetKubeConfig

func (vc *VaultClient) GetKubeConfig(_ context.Context, cluster *v1alpha1.Cluster) (string, error)

func (*VaultClient) Logout

func (vc *VaultClient) Logout()

func (*VaultClient) Sync

func (vc *VaultClient) Sync(ctx context.Context, cluster, lastCluster *nautescrd.Cluster) (*secretclient.SyncResult, error)

func (*VaultClient) SyncCluster

func (vc *VaultClient) SyncCluster(ctx context.Context, cluster, lastCluster *nautescrd.Cluster) (*SyncResult, error)

func (*VaultClient) SyncSecret

func (vc *VaultClient) SyncSecret(cluster, lastCluster *nautescrd.Cluster) (*SyncSecretResult, error)

type VaultStatus

type VaultStatus struct {
	SecretName    string `json:"secret_name" yaml:"secretName"`
	SecretPath    string `json:"secret_path" yaml:"secretPath"`
	SecretVersion int    `json:"secret_version" yaml:"secretVersion"`
}

Jump to

Keyboard shortcuts

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