providers

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKubernetesSupport

func AddKubernetesSupport(opts *options.KubernetesData) error

func GetCloudProvider

func GetCloudProvider(i Interface) (*v1.CloudProvider, error)

get data from api

func List

func List() []string

func MergeAndWriteCloudProvider

func MergeAndWriteCloudProvider(i Interface) error

get data from api , merge it with previous data and write the data previous data written in cloud_old.json

func MergeCloudProvider

func MergeCloudProvider(oldData, curData *v1.CloudProvider) (*v1.CloudProvider, error)

region merge rule:

if region doesn't exist in old data, but exists in cur data, then add it
if region exists in old data, but doesn't exists in cur data, then delete it
if region exist in both, then
	if field data exists in both cur and old data , then take the cur data
	otherwise, take data from (old or cur)whichever contains it

instanceType merge rule: same as region rule, except

if instance exists in old data, but doesn't exists in cur data, then add it , set the deprecated true

In MergeCloudProvider, we merge only the region and instanceType data

func MergeKubernetesSupport

func MergeKubernetesSupport(data *v1.CloudProvider, kubeData *v1.KubernetesVersion) (*v1.CloudProvider, error)

If kubeData.version exists in old data, then

		if kubeData.Envs is empty, then delete it,
     otherwise, replace it

If kubeData.version doesn't exists in old data, then append it

func WriteCloudProvider

func WriteCloudProvider(data *v1.CloudProvider) error

func WriteObject

func WriteObject(obj runtime.Object) error

Types

type Interface

type Interface interface {
	GetName() string
	ListRegions() ([]v1.Region, error)
	ListZones() ([]string, error)
	ListMachineTypes() ([]v1.MachineType, error)
	GetCredentialFormat() v1.CredentialFormat
}

func NewCloudProvider

func NewCloudProvider(opts Options) (Interface, error)

type Options

type Options struct {
	Provider string
	Do       credential.DigitalOcean
	Packet   credential.Packet
	GCE      credential.GCE
	AWS      credential.AWS
	Azure    credential.Azure
	Vultr    credential.Vultr
	Linode   credential.Linode
	Scaleway credential.Scaleway
}

func NewOptions

func NewOptions() *Options

func NewOptionsForCredential

func NewOptionsForCredential(c v1.Credential) Options

func (*Options) AddFlags

func (c *Options) AddFlags(fs *pflag.FlagSet)

func (*Options) ValidateFlags

func (c *Options) ValidateFlags(cmd *cobra.Command, args []string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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