Updated vino operator type code

Change-Id: I1b97b2aaa8864f3b46ccde7d7f97434d08f5c0df
This commit is contained in:
Thirunavukkarasu Palani 2020-12-10 23:51:31 +00:00
parent b0969c2b21
commit 28ba560f8e
3 changed files with 456 additions and 13 deletions

View File

@ -20,22 +20,101 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// VinoSpec defines the desired state of Vino
type VinoSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
//Define nodelabel parameters
NodeSelector *NodeSelector `json:"nodelabels,omitempty"`
//Define CPU configuration
Configuration *CPUConfiguration `json:"configuration,omitempty"`
//Define network Parametes
Network *Network `json:"networks,omitempty"`
//Define node details
Node []NodeSet `json:"nodes,omitempty"`
}
// Foo is an example field of Vino. Edit Vino_types.go to remove/update
Foo string `json:"foo,omitempty"`
type NodeSelector struct {
// Node type needs to specified
MatchLabels map[string]string `json:"matchLabels"`
}
type CPUConfiguration struct {
//Exclude CPU example 0-4,54-60
CPUExclude string `json:"cpuExclude,omitempty"`
}
//Define network specs
type Network struct {
//Network Parameter defined
Name string `json:"name,omitempty"`
SubNet string `json:"subnet,omitempty"`
AllocationStart string `json:"allocationStart,omitempty"`
AllocationStop string `json:"allocationStop,omitempty"`
DNSServers []string `json:"dns_servers,omitempty"`
Routes *VMRoutes `json:"routes,omitempty"`
}
//Routes defined
type VMRoutes struct {
To string `json:"to,omitempty"`
Via string `json:"via,omitempty"`
}
//VinoSpec node definitions
type NodeSet struct {
//Parameter for Node master or worker-standard
Name string `json:"name,omitempty"`
NodeLabel *VMNodeFlavor `json:"labels,omitempty"`
Count int `json:"count,omitempty"`
LibvirtTemplateDefinition *LibvirtTemplate `json:"libvirtTemplateDefinition,omitempty"`
NetworkInterface *NetworkInterface `json:"networkInterfaces,omitempty"`
DiskDrives *DiskDrivesTemplate `json:"diskDrives,omitempty"`
}
//Define node flavor
type VMNodeFlavor struct {
VMFlavor map[string]string `json:"vmFlavor,omitempty"`
}
//Define Libvirt template
type LibvirtTemplate struct {
Name string `json:"Name,omitempty"`
Namespace string `json:"Namespace,omitempty"`
}
type NetworkInterface struct {
//Define parameter for netwok interfaces
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
NetworkName string `json:"network,omitempty"`
MTU int `json:"mtu,omitempty"`
Options *InterfaceOptions `json:"options,omitempty"`
}
//VinoSpec Network option parameter definition
type InterfaceOptions struct {
InterfaceName []string `json:"interfaceName,omitempty"`
BridgeName map[string]string `json:"bridgeName,omitempty"`
Vlan int `json:"vlan,omitempty"`
}
//Define disk drive for the nodes
type DiskDrivesTemplate struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Path string `json:"path,omitempty"`
Options *DiskOptions `json:"options,omitempty"`
}
//Define disk size
type DiskOptions struct {
SizeGB int `json:"sizeGb,omitempty"`
Sparse bool `json:"sparse,omitempty"`
}
// VinoStatus defines the observed state of Vino
type VinoStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}
// +kubebuilder:object:root=true

View File

@ -24,12 +24,243 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CPUConfiguration) DeepCopyInto(out *CPUConfiguration) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CPUConfiguration.
func (in *CPUConfiguration) DeepCopy() *CPUConfiguration {
if in == nil {
return nil
}
out := new(CPUConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DiskDrivesTemplate) DeepCopyInto(out *DiskDrivesTemplate) {
*out = *in
if in.Options != nil {
in, out := &in.Options, &out.Options
*out = new(DiskOptions)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskDrivesTemplate.
func (in *DiskDrivesTemplate) DeepCopy() *DiskDrivesTemplate {
if in == nil {
return nil
}
out := new(DiskDrivesTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DiskOptions) DeepCopyInto(out *DiskOptions) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskOptions.
func (in *DiskOptions) DeepCopy() *DiskOptions {
if in == nil {
return nil
}
out := new(DiskOptions)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *InterfaceOptions) DeepCopyInto(out *InterfaceOptions) {
*out = *in
if in.InterfaceName != nil {
in, out := &in.InterfaceName, &out.InterfaceName
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.BridgeName != nil {
in, out := &in.BridgeName, &out.BridgeName
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InterfaceOptions.
func (in *InterfaceOptions) DeepCopy() *InterfaceOptions {
if in == nil {
return nil
}
out := new(InterfaceOptions)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LibvirtTemplate) DeepCopyInto(out *LibvirtTemplate) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LibvirtTemplate.
func (in *LibvirtTemplate) DeepCopy() *LibvirtTemplate {
if in == nil {
return nil
}
out := new(LibvirtTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Network) DeepCopyInto(out *Network) {
*out = *in
if in.DNSServers != nil {
in, out := &in.DNSServers, &out.DNSServers
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Routes != nil {
in, out := &in.Routes, &out.Routes
*out = new(VMRoutes)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Network.
func (in *Network) DeepCopy() *Network {
if in == nil {
return nil
}
out := new(Network)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NetworkInterface) DeepCopyInto(out *NetworkInterface) {
*out = *in
if in.Options != nil {
in, out := &in.Options, &out.Options
*out = new(InterfaceOptions)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterface.
func (in *NetworkInterface) DeepCopy() *NetworkInterface {
if in == nil {
return nil
}
out := new(NetworkInterface)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeSelector) DeepCopyInto(out *NodeSelector) {
*out = *in
if in.MatchLabels != nil {
in, out := &in.MatchLabels, &out.MatchLabels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSelector.
func (in *NodeSelector) DeepCopy() *NodeSelector {
if in == nil {
return nil
}
out := new(NodeSelector)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeSet) DeepCopyInto(out *NodeSet) {
*out = *in
if in.NodeLabel != nil {
in, out := &in.NodeLabel, &out.NodeLabel
*out = new(VMNodeFlavor)
(*in).DeepCopyInto(*out)
}
if in.LibvirtTemplateDefinition != nil {
in, out := &in.LibvirtTemplateDefinition, &out.LibvirtTemplateDefinition
*out = new(LibvirtTemplate)
**out = **in
}
if in.NetworkInterface != nil {
in, out := &in.NetworkInterface, &out.NetworkInterface
*out = new(NetworkInterface)
(*in).DeepCopyInto(*out)
}
if in.DiskDrives != nil {
in, out := &in.DiskDrives, &out.DiskDrives
*out = new(DiskDrivesTemplate)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSet.
func (in *NodeSet) DeepCopy() *NodeSet {
if in == nil {
return nil
}
out := new(NodeSet)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VMNodeFlavor) DeepCopyInto(out *VMNodeFlavor) {
*out = *in
if in.VMFlavor != nil {
in, out := &in.VMFlavor, &out.VMFlavor
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMNodeFlavor.
func (in *VMNodeFlavor) DeepCopy() *VMNodeFlavor {
if in == nil {
return nil
}
out := new(VMNodeFlavor)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VMRoutes) DeepCopyInto(out *VMRoutes) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMRoutes.
func (in *VMRoutes) DeepCopy() *VMRoutes {
if in == nil {
return nil
}
out := new(VMRoutes)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Vino) DeepCopyInto(out *Vino) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
@ -86,6 +317,28 @@ func (in *VinoList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VinoSpec) DeepCopyInto(out *VinoSpec) {
*out = *in
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = new(NodeSelector)
(*in).DeepCopyInto(*out)
}
if in.Configuration != nil {
in, out := &in.Configuration, &out.Configuration
*out = new(CPUConfiguration)
**out = **in
}
if in.Network != nil {
in, out := &in.Network, &out.Network
*out = new(Network)
(*in).DeepCopyInto(*out)
}
if in.Node != nil {
in, out := &in.Node, &out.Node
*out = make([]NodeSet, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VinoSpec.

View File

@ -34,10 +34,121 @@ spec:
spec:
description: VinoSpec defines the desired state of Vino
properties:
foo:
description: Foo is an example field of Vino. Edit Vino_types.go to
remove/update
type: string
configuration:
description: Define CPU configuration
properties:
cpuExclude:
description: Exclude CPU example 0-4,54-60
type: string
type: object
networks:
description: Define network Parametes
properties:
allocationStart:
type: string
allocationStop:
type: string
dns_servers:
items:
type: string
type: array
name:
description: Network Parameter defined
type: string
routes:
description: Routes defined
properties:
to:
type: string
via:
type: string
type: object
subnet:
type: string
type: object
nodelabels:
description: Define nodelabel parameters
properties:
matchLabels:
additionalProperties:
type: string
description: Node type needs to specified
type: object
required:
- matchLabels
type: object
nodes:
description: Define node details
items:
description: VinoSpec node definitions
properties:
count:
type: integer
diskDrives:
description: Define disk drive for the nodes
properties:
name:
type: string
options:
description: Define disk size
properties:
sizeGb:
type: integer
sparse:
type: boolean
type: object
path:
type: string
type:
type: string
type: object
labels:
description: Define node flavor
properties:
vmFlavor:
additionalProperties:
type: string
type: object
type: object
libvirtTemplateDefinition:
description: Define Libvirt template
properties:
Name:
type: string
Namespace:
type: string
type: object
name:
description: Parameter for Node master or worker-standard
type: string
networkInterfaces:
properties:
mtu:
type: integer
name:
description: Define parameter for netwok interfaces
type: string
network:
type: string
options:
description: VinoSpec Network option parameter definition
properties:
bridgeName:
additionalProperties:
type: string
type: object
interfaceName:
items:
type: string
type: array
vlan:
type: integer
type: object
type:
type: string
type: object
type: object
type: array
type: object
status:
description: VinoStatus defines the observed state of Vino