templateresolver

package
v0.0.0-...-b25b198 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package templateresolver provides vsphere template resolution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OVATemplateResult

type OVATemplateResult map[TemplateQuery]*TemplateResult

OVATemplateResult carries the results of OVA template resolution for the control plane or a machine deployment of a cluster.

func (*OVATemplateResult) String

func (r *OVATemplateResult) String() string

type Query

type Query struct {
	// OVATemplateQueries carries the set of OVA template queries.
	OVATemplateQueries map[TemplateQuery]struct{}
}

Query sets constraints for resolution of vSphere OVA templates. Its structure reflects Cluster API cluster topology.

func (Query) String

func (q Query) String() string

type Resolver

type Resolver struct {
	Log logr.Logger
}

func NewResolver

func NewResolver(log logr.Logger) *Resolver

func (*Resolver) GetVSphereEndpoint

func (r *Resolver) GetVSphereEndpoint(svrContext *VSphereContext) (vc.Client, error)

GetVSphereEndpoint gets vsphere client based on credentials set in config variables

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, svrContext *VSphereContext, query Query, vcClient vc.Client) Result

Resolve queries VC using the vcClient for template resolution of the OVAs from the input query.

type Result

type Result struct {
	// OVATemplates carries the mapping from TemplateQuery to TemplateResult.
	// It is set to nil if resolving the control plane part was skipped.
	// The key is the OVA version.
	OVATemplates OVATemplateResult

	// UsefulErrorMessage carries the errors resulted in template resolution
	UsefulErrorMessage string
}

Result carries the results of vSphere OVA template resolution. Its structure reflects Cluster API cluster topology.

func (Result) String

func (r Result) String() string

type TemplateQuery

type TemplateQuery struct {
	// OVAVersion is a version of the template
	OVAVersion string
	// OSInfo is the OS information the template should satisfy
	OSInfo runv1.OSInfo
}

TemplateQuery sets constraints for resolution of vSphere OVA templates for the control plane or a machine deployment of a cluster.

func (*TemplateQuery) String

func (q *TemplateQuery) String() string

type TemplateResolver

type TemplateResolver interface {
	// Resolve returns VM template path and MOIDs satisfying query constraints.
	Resolve(ctx context.Context, svrContext *VSphereContext, query Query, vcClient vc.Client) Result
	GetVSphereEndpoint(svrContext *VSphereContext) (vc.Client, error)
}

TemplateResolver resolves vSphere templates

func New

func New(log logr.Logger) TemplateResolver

New returns a newly created instance of the vSphere template resolver implementation.

type TemplateResult

type TemplateResult struct {
	// TemplatePath is the path of the template. If empty, then no template satisfied the query.
	TemplatePath string
	// TemplateMOID is the MOID of the template. If empty, then no template satisfied the query.
	TemplateMOID string
}

TemplateResult carries the resolved template path and MOID.

func (*TemplateResult) String

func (r *TemplateResult) String() string

type VSphereContext

type VSphereContext struct {
	Server             string
	Username           string
	Password           string
	DataCenter         string
	TLSThumbprint      string
	InsecureSkipVerify bool
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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