tls

package
v1.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const CACrtKey = "ca.crt"

Variables

This section is empty.

Functions

This section is empty.

Types

type TLSBytes

type TLSBytes struct {
	// CertBytes is the bytes of the certificate file.
	CertBytes []byte
	// KeyBytes is the bytes of the key file.
	KeyBytes []byte
	// CABytes is the bytes of the CA file.
	CABytes []byte
}

TLSBytes contains the bytes of the TLS files.

func KubeTLSClientConfigFromSecret

func KubeTLSClientConfigFromSecret(secret corev1.Secret, url string) (*tls.Config, *TLSBytes, error)

KubeTLSClientConfigFromSecret returns a TLS client config as a `tls.Config` object and in its bytes representation. The secret is expected to have the following keys: - tls.key, for the private key - tls.crt, for the certificate - ca.crt, for the CA certificate

Secrets with no certificate, private key, AND CA cert are ignored. If only a certificate OR private key is found, an error is returned. The Secret type can be blank, Opaque or kubernetes.io/tls.

func LegacyTLSClientConfigFromSecret added in v1.1.1

func LegacyTLSClientConfigFromSecret(secret corev1.Secret, url string) (*tls.Config, *TLSBytes, error)

LegacyTLSClientConfigFromSecret returns a TLS client config as a `tls.Config` object and in its bytes representation. The secret is expected to have the following keys: - keyFile, for the private key - certFile, for the certificate - caFile, for the CA certificate

Secrets with no certificate, private key, AND CA cert are ignored. If only a certificate OR private key is found, an error is returned.

func TLSClientConfigFromSecret

func TLSClientConfigFromSecret(secret corev1.Secret, url string) (*tls.Config, *TLSBytes, error)

TLSClientConfigFromSecret returns a TLS client config as a `tls.Config` object and in its bytes representation. The secret is expected to have the following keys: - keyFile, for the private key - certFile, for the certificate - caFile, for the CA certificate

Secrets with no certificate, private key, AND CA cert are ignored. If only a certificate OR private key is found, an error is returned. The Secret type can be blank, Opaque or kubernetes.io/tls.

Jump to

Keyboard shortcuts

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