Documentation
¶
Overview ¶
Package certprovisioner provides an interface and implementation to provision certificates.
Create a implementation instance of certprovisioner.
cp := SelfSignedCertProvisioner{
// your configuration
}
Provision the certificates.
key, cert, caCert, err := cp.ProvisionServingCert()
if err != nil {
// handle error
}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertProvisioner ¶
type CertProvisioner interface {
// ProvisionServingCert returns the key, serving certificate and the CA certificate.
ProvisionServingCert() (key []byte, cert []byte, caCert []byte, err error)
}
CertProvisioner is an interface to provision the serving certificate.
type SelfSignedCertProvisioner ¶
type SelfSignedCertProvisioner struct {
// Required DNS names for your certificate
DNSNames []string
// Organization name
Organization string
// Number of days the certificate will be valid for.
ValidDays int
}
SelfSignedCertProvisioner implements the CertProvisioner interface. It provisions self-signed certificates.
Example ¶
cp := SelfSignedCertProvisioner{
Organization: "k8s.io",
DNSNames: []string{"myDNSName"},
ValidDays: 365,
}
key, cert, caCert, err := cp.ProvisionServingCert()
if err != nil {
// handle error
}
func (*SelfSignedCertProvisioner) ProvisionServingCert ¶
func (cp *SelfSignedCertProvisioner) ProvisionServingCert() (key []byte, cert []byte, caCert []byte, err error)
ProvisionServingCert generates a CA and a serving cert. It returns the key, serving cert, CA cert and a potential error.
Click to show internal directories.
Click to hide internal directories.