tls

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCertManagerNotFound = errors.New("cert-manager not found")
	ErrCertManagerNotReady = errors.New("cert-manager not ready")
)

Functions

func Config added in v1.10.0

func Config(ctx context.Context, k8sclient client.Client, cr *api.PerconaServerMongoDB) (tls.Config, error)

Config returns tls.Config to be used in mongo.Config

func GetCertificateSans added in v1.15.0

func GetCertificateSans(cr *api.PerconaServerMongoDB) []string

func GetDNSNamesFromCert added in v1.23.0

func GetDNSNamesFromCert(tlsCertPEM []byte) ([]string, error)

GetDNSNamesFromCert extracts DNS names from the SANs of a PEM-encoded TLS certificate.

func IsExternalIssuer added in v1.23.0

func IsExternalIssuer(cr *api.PerconaServerMongoDB) bool

func IsSecretCreatedByUser added in v1.16.1

func IsSecretCreatedByUser(ctx context.Context, c client.Client, cr *api.PerconaServerMongoDB, secret *corev1.Secret) (bool, error)

func Issue

func Issue(hosts []string) (caCert []byte, tlsCert []byte, tlsKey []byte, err error)

Issue returns CA certificate, TLS certificate and TLS private key

func IssueCA added in v1.23.0

func IssueCA() (caCertPEM []byte, caKeyPEM []byte, err error)

IssueCA generates a new self-signed CA certificate and returns the CA cert and CA private key in PEM format.

func IssueWithCA added in v1.23.0

func IssueWithCA(hosts []string, caCertPEM, caKeyPEM []byte) (tlsCert []byte, tlsKey []byte, err error)

IssueWithCA generates a TLS certificate signed by the given CA and returns the TLS cert and TLS private key in PEM format.

func ManualCASecretName added in v1.23.0

func ManualCASecretName(cr *api.PerconaServerMongoDB) string

ManualCASecretName returns the name of the CA secret for manual TLS management.

func MergePEM added in v1.16.0

func MergePEM(target []byte, toMerge ...[]byte) ([]byte, error)

Types

type CertManagerController added in v1.15.0

type CertManagerController interface {
	ApplyIssuer(ctx context.Context, cr *api.PerconaServerMongoDB) (util.ApplyStatus, error)
	ApplyCAIssuer(ctx context.Context, cr *api.PerconaServerMongoDB) (util.ApplyStatus, error)
	ApplyCertificate(ctx context.Context, cr *api.PerconaServerMongoDB, cert Certificate) (util.ApplyStatus, error)
	WaitForCerts(ctx context.Context, cr *api.PerconaServerMongoDB, certificates ...Certificate) error
	GetMergedCA(ctx context.Context, cr *api.PerconaServerMongoDB, secretNames []string) ([]byte, error)
	Check(ctx context.Context, config *rest.Config, ns string) error
	IsDryRun() bool
	GetClient() client.Client
}

func NewCertManagerController added in v1.15.0

func NewCertManagerController(cl client.Client, scheme *runtime.Scheme, dryRun bool) CertManagerController

type Certificate added in v1.22.0

type Certificate interface {
	Name() string
	Namespace() string
	SecretName() string
	Object() *cm.Certificate
}

func CertificateCA added in v1.22.0

func CertificateCA(cr *api.PerconaServerMongoDB) Certificate

func CertificateTLS added in v1.22.0

func CertificateTLS(cr *api.PerconaServerMongoDB, internal bool) Certificate

type NewCertManagerControllerFunc added in v1.16.0

type NewCertManagerControllerFunc func(cl client.Client, scheme *runtime.Scheme, dryRun bool) CertManagerController

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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