certagent

package
v0.0.0-...-edd4e59 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCSRObject

func GenerateCSRObject(config CSRConfig) (*capi.CertificateSigningRequest, error)

GenerateCSRObject generates a certificate signing request object and returns it.

func UnescapeIPV6Address

func UnescapeIPV6Address(addr string) string

UnescapeIPV6Address removes left and right brackets used to escape IPv6 addresses. Example [2605:2700:0:3::4713:93e3] will return 2605:2700:0:3::4713:93e3. If this escaping does not exist return the original address without additional validation.

Types

type CSRConfig

type CSRConfig struct {
	// CommonName is the common name to be provided in the Certificate
	CommonName string `json:"commonName"`
	// Orgname is the name of the organization for the Certificate
	OrgName string `json:"orgName"`

	// Alternate Name values required to create CertificateRequest
	DNSNames    []string `json:"dnsNames"`
	IPAddresses []net.IP `json:"ipAddresses"`

	// AssetsDir is the directory location where certificates and
	// private keys will be saved
	AssetsDir string `json:"assetsDir"`
}

CSRConfig contains the configuration values required to generate a Certificate Signing Request for the agent.

type CertAgent

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

CertAgent is the top level object that represents a certificate agent. All the fields it holds are configuration values required for generating a CSR, doing a POST request to the signer and writing the singed certificate obtained from the signer to disk.

func NewAgent

func NewAgent(csrConfig CSRConfig, kubeconfigFile string) (*CertAgent, error)

NewAgent returns an initialized CertAgent instance or an error is unsuccessful

func (*CertAgent) RequestCertificate

func (c *CertAgent) RequestCertificate() error

RequestCertificate will create a certificate signing request for a node with the config given and send it to a signer via a POST request. If something goes wrong it returns an error but wait forever for server to respond to request. NOTE: This method does not return the approved CSR from the signer.

func (*CertAgent) WaitForCertificate

func (c *CertAgent) WaitForCertificate() (req *capi.CertificateSigningRequest, err error)

WaitForCertificate waits for a certificate to be issued until timeout, or returns an error. It does a GET to the signer with the CSR name.

Jump to

Keyboard shortcuts

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