templates

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// TemplateOsLabel is a label that specifies the OS of the template
	TemplateOsLabel = "os.template.kubevirt.io/%s"

	// TemplateWorkloadLabel is a label that specifies the workload of the template
	TemplateWorkloadLabel = "workload.template.kubevirt.io/%s"

	// TemplateFlavorLabel is a label that specifies the flavor of the template
	TemplateFlavorLabel = "flavor.template.kubevirt.io/%s"
)

Variables

This section is empty.

Functions

func OSLabelBuilder

func OSLabelBuilder(os *string, workload *string, flavor *string) map[string]string

OSLabelBuilder builds template labels based on template criteria

Types

type OSMapProvider

type OSMapProvider interface {
	GetOSMaps() (map[string]string, map[string]string, error)
}

OSMapProvider is responsible for getting the operating systems maps

type OSMaps

type OSMaps struct {
	Client client.Client
}

OSMaps is responsible for getting the operating systems maps which contain mapping of GuestOS to common templates and mapping of osinfo to common templates

func NewOSMapProvider

func NewOSMapProvider(client client.Client) *OSMaps

NewOSMapProvider creates new OSMapProvider

func (*OSMaps) GetOSMaps

func (o *OSMaps) GetOSMaps() (map[string]string, map[string]string, error)

GetOSMaps retrieve the OS mapping config map

type TemplateHandler

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

TemplateHandler attempts to process templates based on given parameters

func NewTemplateHandler

func NewTemplateHandler(templateProvider TemplateProvider) *TemplateHandler

NewTemplateHandler creates new TemplateHandler

func (*TemplateHandler) ProcessTemplate

func (f *TemplateHandler) ProcessTemplate(template *templatev1.Template, vmName *string, namespace string) (*kubevirtv1.VirtualMachine, error)

ProcessTemplate processes template with provided parameter values

type TemplateProvider

type TemplateProvider interface {
	Find(namespace *string, os *string, workload *string, flavor *string) (*templatev1.TemplateList, error)
	Process(namespace string, vmName *string, template *templatev1.Template) (*templatev1.Template, error)
}

TemplateProvider searches for and processes templates in Openshift

type Templates

type Templates struct {
	Client *tempclient.TemplateV1Client
}

Templates is responsible for finding and processing templates

func NewTemplateProvider

func NewTemplateProvider(client *tempclient.TemplateV1Client) *Templates

NewTemplateProvider creates new TemplateProvider

func (*Templates) Find

func (t *Templates) Find(namespace *string, os *string, workload *string, flavor *string) (*templatev1.TemplateList, error)

Find looks for a template based on given namespace and options

func (*Templates) Process

func (t *Templates) Process(namespace string, vmName *string, template *templatev1.Template) (*templatev1.Template, error)

Process calls the openshift api to process parameters

Jump to

Keyboard shortcuts

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