github.com/Equinix-Metal/virtlet@v1.5.2-0.20210807010419-342346535dc5/pkg/api/virtlet.k8s/v1/virtletconfig.go (about)

     1  /*
     2  Copyright 2018 Mirantis
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or ≈git-agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1
    18  
    19  import (
    20  	meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  )
    22  
    23  // VirtletConfig denotes a configuration for VirtletManager.
    24  type VirtletConfig struct {
    25  	// FdServerSocketPath specifies the path to fdServer socket.
    26  	FDServerSocketPath *string `json:"fdServerSocketPath,omitempty"`
    27  	// DatabasePath specifies the path to Virtlet database.
    28  	DatabasePath *string `json:"databasePath,omitempty"`
    29  	// DownloadProtocol specifies the download protocol to use.
    30  	// It defaults to "https".
    31  	DownloadProtocol *string `json:"downloadProtocol,omitempty"`
    32  	// ImageDir specifies the image store directory.
    33  	ImageDir *string `json:"imageDir,omitempty"`
    34  	// ImageTranslationConfigsDir specifies the directory with
    35  	// image translation configuration files. Empty string means
    36  	// such directory is not used.
    37  	ImageTranslationConfigsDir *string `json:"imageTranslationConfigsDir,omitempty"`
    38  	// SkipImageTranslation disables image translations.
    39  	SkipImageTranslation *bool `json:"skipImageTranslation,omitempty"`
    40  	// LibvirtURI specifies the libvirt connnection URI.
    41  	LibvirtURI *string `json:"libvirtURI,omitempty"`
    42  	// RawDevices specifies a comma-separated list of raw device
    43  	// glob patterns which VMs can access.
    44  	RawDevices *string `json:"rawDevices,omitempty"`
    45  	// CRISocketPath specifies the socket path for the gRPC endpoint.
    46  	CRISocketPath *string `json:"criSocketPath,omitempty"`
    47  	// DisableLogging disables the streaming server
    48  	DisableLogging *bool `json:"disableLogging,omitempty"`
    49  	// True if KVM should be disabled.
    50  	DisableKVM *bool `json:"disableKVM,omitempty"`
    51  	// True if SR-IOV support should be enabled.
    52  	EnableSriov *bool `json:"enableSriov,omitempty"`
    53  	// CNIPluginDir specifies the location of CNI configurations.
    54  	CNIPluginDir *string `json:"cniPluginDir,omitempty"`
    55  	// CNIConfigDir specifies the location of CNI configurations.
    56  	CNIConfigDir *string `json:"cniConfigDir,omitempty"`
    57  	// CalicoSubnetSize specifies the size of Calico subnetwork.
    58  	CalicoSubnetSize *int `json:"calicoSubnetSize,omitempty"`
    59  	// EnableRegexpImageTranslation is true if regexp-based image
    60  	// translations are enabled.
    61  	EnableRegexpImageTranslation *bool `json:"enableRegexpImageTranslation,omitempty"`
    62  	// CPUModel specifies the default CPU model to use in the libvirt domain definition.
    63  	// It can be overridden using VirtletCPUModel pod annotation.
    64  	CPUModel *string `json:"cpuModel,omitempty"`
    65  	// StreamPort specifies the configurable stream port of virtlet server.
    66  	StreamPort *int `json:"streamPort,omitempty"`
    67  	// LogLevel specifies the log level to use
    68  	LogLevel *int `json:"logLevel,omitempty"`
    69  	// Kubelet's root dir
    70  	KubeletRootDir *string `json:"kubeletRootDir,omitempty"`
    71  }
    72  
    73  // VirtletConfigMappingSpec is the contents of a VirtletConfigMapping.
    74  type VirtletConfigMappingSpec struct {
    75  	meta_v1.TypeMeta   `json:",inline"`
    76  	meta_v1.ObjectMeta `json:"metadata"`
    77  	// NodeSelector specifies the labels that must be matched for this
    78  	// mapping to apply to the node.
    79  	NodeSelector map[string]string `json:"nodeSelector,omitempty"`
    80  	// Node name to match.
    81  	NodeName string `json:"nodeName,omitempty"`
    82  	// Priority specifies the priority of this setting.
    83  	Priority int
    84  	// VirtletConfig to apply.
    85  	Config *VirtletConfig `json:"config,omitempty"`
    86  }
    87  
    88  // +genclient
    89  // +genclient:noStatus
    90  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    91  
    92  // VirtletConfigMapping specifies the mapping of node names or labels
    93  // to Virtlet configs.
    94  type VirtletConfigMapping struct {
    95  	meta_v1.TypeMeta   `json:",inline"`
    96  	meta_v1.ObjectMeta `json:"metadata"`
    97  
    98  	Spec VirtletConfigMappingSpec `json:"spec,omitempty"`
    99  }
   100  
   101  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   102  
   103  // VirtletConfigMappingList lists the mappings between node names or
   104  // labels and Virtlet configs.
   105  type VirtletConfigMappingList struct {
   106  	meta_v1.TypeMeta `json:",inline"`
   107  	meta_v1.ListMeta `json:"metadata"`
   108  	Items            []VirtletConfigMapping `json:"items,omitempty"`
   109  }