templates

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 8 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"

	// TemplateNameOsAnnotation is an annotation that specifies human readable os name
	TemplateNameOsAnnotation = "name.os.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 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