vault

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	ROLE_NAME_KEY_ARGO    = "Argo"
	ROLE_NAME_KEY_RUNTIME = "Runtime"
	AUTH_PATH_FORMAT      = "auth/%s/config"
	SECRET_PATH_FORMAT    = "kubernetes/%s/default/admin"
)
View Source
const (
	CONTEXT_KEY_CFG nautesctx.ContextKey = "vault.client.config"
)

Variables

This section is empty.

Functions

func ErrorRoleNameNotFound

func ErrorRoleNameNotFound(name string) error

func NewVaultClient

func NewVaultClient(ctx context.Context, configs *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) (*nautescrd.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, configs *configs.Config, opts ...InitOpt) (*VaultClient, error)

func (*VaultClient) CleanCluster

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

func (*VaultClient) Delete

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

func (*VaultClient) GetKubeConfig added in v0.3.0

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

func (*VaultClient) Logout added in v0.3.0

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