cloud

package
v0.1.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Copyright 2019 The Kubernetes Authors.

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.

Index

Constants

View Source
const (
	VolumeTypeTier1 = "tier1"
	VolumeTypeTier3 = "tier3"
)

PowerVS volume types

View Source
const (
	// DefaultVolumeSize represents the default volume size.
	DefaultVolumeSize int64 = 10 * util.GiB
	// DefaultVolumeType specifies which storage to use for newly created Volumes.
	DefaultVolumeType = VolumeTypeTier1
)

Defaults

View Source
const (
	CloudInstanceIDLabel = "powervs.kubernetes.io/cloud-instance-id"
	PvmInstanceIdLabel   = "powervs.kubernetes.io/pvm-instance-id"
)
View Source
const (
	PollTimeout          = 120 * time.Second
	PollInterval         = 5 * time.Second
	TIMEOUT              = 60 * time.Minute
	VolumeInUseState     = "in-use"
	VolumeAvailableState = "available"
)

Variables

View Source
var (
	// ErrNotFound is returned when a resource is not found.
	ErrNotFound = errors.New("resource was not found")

	// ErrAlreadyExists is returned when a resource is already existent.
	ErrAlreadyExists = errors.New("resource already exists")
)
View Source
var DefaultKubernetesAPIClient = func() (kubernetes.Interface, error) {

	config, err := rest.InClusterConfig()
	if err != nil {
		return nil, err
	}

	clientset, err := kubernetes.NewForConfig(config)
	if err != nil {
		return nil, err
	}
	return clientset, nil
}

Get default kubernetes API client

View Source
var (
	ValidVolumeTypes = []string{
		VolumeTypeTier1,
		VolumeTypeTier3,
	}
)

Functions

This section is empty.

Types

type Cloud

type Cloud interface {
	CreateDisk(volumeName string, diskOptions *DiskOptions) (disk *Disk, err error)
	DeleteDisk(volumeID string) (success bool, err error)
	AttachDisk(volumeID string, nodeID string) (err error)
	DetachDisk(volumeID string, nodeID string) (err error)
	ResizeDisk(volumeID string, reqSize int64) (newSize int64, err error)
	WaitForVolumeState(volumeID, state string) error
	GetDiskByName(name string) (disk *Disk, err error)
	GetDiskByID(volumeID string) (disk *Disk, err error)
	GetPVMInstanceByName(instanceName string) (instance *PVMInstance, err error)
	GetPVMInstanceByID(instanceID string) (instance *PVMInstance, err error)
	GetImageByID(imageID string) (image *PVMImage, err error)
	IsAttached(volumeID string, nodeID string) (attached bool, err error)
}

func NewPowerVSCloud

func NewPowerVSCloud(cloudInstanceID string, debug bool) (Cloud, error)

type Disk

type Disk struct {
	VolumeID    string
	DiskType    string
	WWN         string
	Name        string
	Shareable   bool
	CapacityGiB int64
}

Disk represents a PowerVS volume

type DiskOptions

type DiskOptions struct {
	//PowerVS options
	Shareable bool
	//CapacityGigaBytes float64
	CapacityBytes int64
	VolumeType    string
}

DiskOptions represents parameters to create an PowerVS volume

type KubernetesAPIClient

type KubernetesAPIClient func() (kubernetes.Interface, error)

type Metadata

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

Metadata is info about the instance on which the driver is running

func KubernetesAPIInstanceInfo

func KubernetesAPIInstanceInfo(clientset kubernetes.Interface) (*Metadata, error)

Get instance info from kubernetes API

func (*Metadata) GetCloudInstanceId

func (m *Metadata) GetCloudInstanceId() string

GetCloudInstanceId returns cloud instance id of the instance

func (*Metadata) GetPvmInstanceId

func (m *Metadata) GetPvmInstanceId() string

GetPvmInstanceId returns pvm instance id of the instance

type MetadataService

type MetadataService interface {
	GetCloudInstanceId() string
	GetPvmInstanceId() string
}

MetadataService represents Power VS metadata service.

func NewMetadataService

func NewMetadataService(k8sAPIClient KubernetesAPIClient) (MetadataService, error)

Get New Metadata Service

type PVMImage

type PVMImage struct {
	ID       string
	Name     string
	DiskType string
}

type PVMInstance

type PVMInstance struct {
	ID      string
	ImageID string
	Name    string
}

type PowerVSClient

type PowerVSClient interface {
}

type User

type User struct {
	ID      string
	Email   string
	Account string
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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