Help us shape the future of Go! Take the 2026 Go Developer Survey

vault

package
v1.21.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggableErrorMessage added in v1.21.2

func LoggableErrorMessage(err error) string

LoggableErrorMessage renders err for the cert-manager logs, where the full response details are useful for debugging.

func SafeErrorMessage added in v1.21.2

func SafeErrorMessage(err error) string

SafeErrorMessage renders err for inclusion in an Issuer status condition and in the Kubernetes Events raised alongside it. Both are persisted to the API server and are readable by anyone who can read the Issuer, so they must not carry content chosen by whatever spec.vault.server points at.

Types

type Client

type Client interface {
	NewRequest(method, requestPath string) *vault.Request
	RawRequest(r *vault.Request) (*vault.Response, error)
	SetToken(v string)
	CloneConfig() *vault.Config
	Write(path string, data map[string]any) (*vault.Secret, error)
}

Client implements functionality to talk to a Vault server.

type ClientBuilder

type ClientBuilder func(ctx context.Context, namespace string, _ func(ns string) CreateToken, _ internalinformers.SecretLister, _ v1.GenericIssuer, canUseAmbientCredentials bool) (Interface, error)

ClientBuilder is a function type that returns a new Interface. Can be used in tests to create a mock signer of Vault certificate requests.

type CreateToken added in v1.12.0

type CreateToken func(ctx context.Context, saName string, req *authv1.TokenRequest, opts metav1.CreateOptions) (*authv1.TokenRequest, error)

For mocking purposes.

type Interface

type Interface interface {
	Sign(csrPEM []byte, duration time.Duration) (certPEM []byte, caPEM []byte, err error)
	IsVaultInitializedAndUnsealed() error
}

Interface implements various high level functionality related to connecting with a Vault server, verifying its status and signing certificate request for Vault's certificate.

func New

func New(ctx context.Context, namespace string, createTokenFn func(ns string) CreateToken, secretsLister internalinformers.SecretLister, issuer v1.GenericIssuer, canUseAmbientCredentials bool) (Interface, error)

New returns a new Vault instance with the given namespace, issuer and secrets lister. Returned errors may be network failures and should be considered for retrying.

type Vault

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

Vault implements Interface and holds a Vault issuer, secrets lister and a Vault client.

func (*Vault) IsVaultInitializedAndUnsealed

func (v *Vault) IsVaultInitializedAndUnsealed() error

func (*Vault) Sign

func (v *Vault) Sign(csrPEM []byte, duration time.Duration) (cert []byte, ca []byte, err error)

Sign will connect to a Vault instance to sign a certificate signing request.

Directories

Path Synopsis
Package fake contains a fake Vault signer for use in tests
Package fake contains a fake Vault signer for use in tests

Jump to

Keyboard shortcuts

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