generate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CA

type CA struct {
	K8sConfigMapName      string
	K8sConfigMapNamespace string

	CACertBytes []byte
	CAKeyBytes  []byte

	CACert *x509.Certificate
	CAKey  crypto.Signer
}

CA contains the data and metadata of the certificate authority

func NewCA

func NewCA(k8sConfigMapName, k8sConfigMapNamespace string) *CA

NewCA creates a new root CA blueprint

func (*CA) Generate

func (c *CA) Generate(commonName string, validityDuration time.Duration) error

Generate the root certificate and keyfile. Populates c.CACertBytes and c.CAKeyBytes

func (*CA) LoadFromFile

func (c *CA) LoadFromFile(caCertFile, caKeyFile string) error

LoadFromFile populates c.CACertBytes and c.CAKeyBytes by reading them from file.

func (*CA) StoreAsConfigMap

func (c *CA) StoreAsConfigMap(ctx context.Context, k8sClient *kubernetes.Clientset) error

StoreAsConfigMap creates or updates the CA certificate in a K8s configmap

type Cert

type Cert struct {
	CommonName         string
	ValidityDuration   time.Duration
	Usage              []string
	K8sSecretName      string
	K8sSecretNamespace string

	CertBytes []byte
	KeyBytes  []byte
}

CA contains the data and metadata of the certificate and keyfile

func NewCert

func NewCert(
	commonName string,
	validityDuration time.Duration,
	usage []string,
	k8sSecretName string,
	k8sSecretNamespace string,
) *Cert

NewCert creates a new certificate blueprint

func (*Cert) Generate

func (c *Cert) Generate(ca *x509.Certificate, caSigner crypto.Signer) error

Generate the certificate and keyfile and populate c.CertBytes and c.CertKey

func (*Cert) StoreAsSecret

func (c *Cert) StoreAsSecret(ctx context.Context, k8sClient *kubernetes.Clientset) error

StoreAsSecret creates or updates the certificate and keyfile in a K8s secret

Jump to

Keyboard shortcuts

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