pki

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MastersGroup = "system:masters"
)

Variables

View Source
var (
	ErrInvalidCA = errors.New("certificate is not a certificate authority")
	ErrEmptyPair = errors.New("pair or cert/key is empty")
)

Functions

This section is empty.

Types

type CARequest

type CARequest struct {
	DNSDomain string   `json:"dnsDomain" valid:"required"`
	IPs       []string `json:"ips" valid:"required"`
	CA        []byte   `json:"ca" valid:"optional"`
}

CARequest defines a request to generate or use CA if provided to setup PKI for k8s cluster

type PKI

type PKI struct {
	ID string   `json:"id"`
	CA *PairPEM `json:"ca"`
	//KubeName is a sg specific name of a k8s cluster
	KubeName string `json:"kubeName"`
}

PKI defines a set of certificates/keys for a kubernetes cluster.

type Pair

type Pair struct {
	Cert *x509.Certificate
	Key  *rsa.PrivateKey
}

Pair defines a certificate and a private key.

func Decode

func Decode(p *PairPEM) (*Pair, error)

Decode parses a pem encoded cert/key and returns them as a Pair.

type PairPEM

type PairPEM struct {
	Cert []byte `json:"cert"`
	Key  []byte `json:"key"`
}

PairPEM defines PEM encoded certificate and private key. TODO: user cert pair in the kube model or get rid of it.

func Encode

func Encode(p *Pair) (*PairPEM, error)

Encode encodes cert/key with PEM and returns them as a PairPEM.

func NewAdminPair

func NewAdminPair(ca *PairPEM) (*PairPEM, error)

NewAdminPair creates certificates for the kubernetes admin user.

func NewCAPair

func NewCAPair(parentBytes []byte) (*PairPEM, error)

NewCAPair creates certificates and key for a kubernetes cluster. If no CA cert/key is provided, it creates self-signed ones.

func NewUserPair

func NewUserPair(userName string, userGroups []string, caEncoded *PairPEM) (*PairPEM, error)

NewUserPair creates certificates for a kubernetes user.

Jump to

Keyboard shortcuts

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