* Add Virtual Kubelet provider for VIC Initial virtual kubelet provider for VMware VIC. This provider currently handles creating and starting of a pod VM via the VIC portlayer and persona server. Image store handling via the VIC persona server. This provider currently requires the feature/wolfpack branch of VIC. * Added pod stop and delete. Also added node capacity. Added the ability to stop and delete pod VMs via VIC. Also retrieve node capacity information from the VCH. * Cleanup and readme file Some file clean up and added a Readme.md markdown file for the VIC provider. * Cleaned up errors, added function comments, moved operation code 1. Cleaned up error handling. Set standard for creating errors. 2. Added method prototype comments for all interface functions. 3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder. * Add mocking code and unit tests for podcache, podcreator, and podstarter Used the unit test framework used in VIC to handle assertions in the provider's unit test. Mocking code generated using OSS project mockery, which is compatible with the testify assertion framework. * Vendored packages for the VIC provider Requires feature/wolfpack branch of VIC and a few specific commit sha of projects used within VIC. * Implementation of POD Stopper and Deleter unit tests (#4) * Updated files for initial PR
90 lines
2.7 KiB
Go
90 lines
2.7 KiB
Go
// Copyright 2016 VMware, Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package constants
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/vmware/vic/pkg/version"
|
|
)
|
|
|
|
/* VCH constants */
|
|
const (
|
|
SerialOverLANPort = 2377
|
|
VchAdminPortalPort = 2378
|
|
AttachServerPort = 2379
|
|
ManagementHostName = "management.localhost"
|
|
ClientHostName = "client.localhost"
|
|
|
|
// DebugPortLayerPort defines the portlayer port while debug level is greater than 2
|
|
DebugPortLayerPort = 2380
|
|
|
|
// BridgeScopeType denotes a scope that is of type bridge
|
|
BridgeScopeType = "bridge"
|
|
// ExternalScopeType denotes a scope that is of type external
|
|
ExternalScopeType = "external"
|
|
// DefaultBridgeRange is the default pool for bridge networks
|
|
DefaultBridgeRange = "172.16.0.0/12"
|
|
// PortsOpenNetwork indicates no port blocking
|
|
PortsOpenNetwork = "0-65535"
|
|
// Constants for assemble the VM display name on vSphere
|
|
MaxVMNameLength = 80
|
|
ShortIDLen = 12
|
|
// vSphere Display name for the VCH's Guest Name and for VAC support
|
|
defaultAltVCHGuestName = "Photon - VCH"
|
|
defaultAltContainerGuestName = "Photon - Container"
|
|
|
|
PropertyCollectorTimeout = 3 * time.Minute
|
|
|
|
// Temporary names until they're altered to actual URLs.
|
|
ContainerStoreName = "container"
|
|
VolumeStoreName = "volume"
|
|
|
|
// volume mode flag
|
|
Mode = "Mode"
|
|
|
|
// PCI Slot Number logic
|
|
PCISlotNumberBegin int32 = 0x4A0
|
|
PCISlotNumberEnd int32 = 1 << 11
|
|
PCISlotNumberInc int32 = 1 << 5
|
|
|
|
// NilSlot is an invalid PCI slot number
|
|
NilSlot int32 = 0
|
|
|
|
// All paths on the datastore for images are relative to <datastore>/VIC/
|
|
StorageParentDir = "VIC"
|
|
|
|
// Key-value storage directory.
|
|
KVStoreFolder = "kvStores"
|
|
|
|
// All volumes are stored in this directory.
|
|
VolumesDir = "volumes"
|
|
|
|
// default log directory
|
|
DefaultLogDir = "/var/log/vic"
|
|
|
|
// Scratch layer ID
|
|
ScratchLayerID = "scratch"
|
|
)
|
|
|
|
func DefaultAltVCHGuestName() string {
|
|
return fmt.Sprintf("%s %s, %s, %7s", defaultAltVCHGuestName, version.Version, version.BuildNumber, version.GitCommit)
|
|
}
|
|
|
|
func DefaultAltContainerGuestName() string {
|
|
return fmt.Sprintf("%s %s, %s, %7s", defaultAltContainerGuestName, version.Version, version.BuildNumber, version.GitCommit)
|
|
}
|