Help us shape the future of Go! Take the 2026 Go Developer Survey

versionchecker

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCertManagerCRDsNotFound  = errors.New("the cert-manager CRDs are not yet installed on the Kubernetes API server")
	ErrVersionNotDetected       = errors.New("could not detect the cert-manager version")
	ErrMultipleVersionsDetected = errors.New("detect multiple different cert-manager versions")
)

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Version(context.Context) (*Version, error)
}

Interface is used to check what cert-manager version is installed

type Version

type Version struct {
	// If all found versions are the same,
	// this field will contain that version
	Detected string `json:"detected,omitempty"`

	Sources map[string]string `json:"sources"`
}

type VersionChecker added in v1.7.0

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

VersionChecker implements a version checker using a controller-runtime client

func New

func New(restcfg *rest.Config, scheme *runtime.Scheme) (*VersionChecker, error)

New returns a cert-manager version checker. Prefer New over NewFromClient since New will ensure the scheme is configured correctly.

func NewFromClient added in v1.7.0

func NewFromClient(cl client.Client) *VersionChecker

NewFromClient initialises a VersionChecker using the given client. Prefer New instead, which will ensure that the scheme on the client is configured correctly.

func (*VersionChecker) Version added in v1.7.0

func (o *VersionChecker) Version(ctx context.Context) (*Version, error)

Version determines the installed cert-manager version. First, we look for the "certificates.cert-manager.io" CRD and try to extract the version from that resource's labels. Then, if it uses a webhook, that webhook service resource's labels are checked for a label. Lastly the pods linked to the webhook its labels are checked and the image tag is used to determine the version. If no "certificates.cert-manager.io" CRD is found, the older "certificates.certmanager.k8s.io" CRD is tried too.

Jump to

Keyboard shortcuts

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