defaults

package
v0.0.0-...-ada06ba Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAmazonProfileTablaName         = "amazon_default_profile"
	DefaultAmazonNodePoolProfileTablaName = "amazon_nodepool_default_profile"
	DefaultAzureProfileTablaName          = "azure_default_profile"
	DefaultAzureNodePoolProfileTablaName  = "azure_nodepool_default_profile"
	DefaultGoogleProfileTablaName         = "google_default_profile"
	DefaultGoogleNodePoolProfileTablaName = "google_nodepool_default_profile"
)

cluster profile table names

View Source
const (
	DefaultNodeName = "pool1"
)

default node name for all provider

Variables

This section is empty.

Functions

func GetDefaultProfileName

func GetDefaultProfileName() string

GetDefaultProfileName reads the default profile name env var

func SetDefaultValues

func SetDefaultValues() error

SetDefaultValues saves the default cluster profile into the database if not exists yet

Types

type AKSNodePoolProfile

type AKSNodePoolProfile struct {
	ID               uint   `gorm:"primary_key"`
	Count            int    `gorm:"default:1"`
	NodeInstanceType string `gorm:"default:'Standard_D4_v2'"`
	Name             string `gorm:"unique_index:idx_model_name"`
	NodeName         string `gorm:"unique_index:idx_model_name"`
}

AKSNodePoolProfile describes an Azure cluster profile's nodepools

func (AKSNodePoolProfile) TableName

func (AKSNodePoolProfile) TableName() string

TableName overrides AKSNodePoolProfile's table name

type AKSProfile

type AKSProfile struct {
	DefaultModel
	Location          string                `gorm:"default:'eastus'"`
	KubernetesVersion string                `gorm:"default:'1.9.2'"`
	NodePools         []*AKSNodePoolProfile `gorm:"foreignkey:Name"`
}

AKSProfile describes an Azure cluster profile

func (*AKSProfile) AfterFind

func (d *AKSProfile) AfterFind() error

AfterFind loads nodepools to profile

func (*AKSProfile) BeforeDelete

func (d *AKSProfile) BeforeDelete() error

BeforeDelete deletes all nodepools to belongs to profile

func (*AKSProfile) BeforeSave

func (d *AKSProfile) BeforeSave() error

BeforeSave clears nodepools

func (*AKSProfile) DeleteProfile

func (d *AKSProfile) DeleteProfile() error

DeleteProfile deletes cluster profile from database

func (*AKSProfile) GetProfile

func (d *AKSProfile) GetProfile() *components.ClusterProfileResponse

GetProfile load profile from database and converts ClusterProfileResponse

func (*AKSProfile) GetType

func (d *AKSProfile) GetType() string

GetType returns profile's cloud type

func (*AKSProfile) IsDefinedBefore

func (d *AKSProfile) IsDefinedBefore() bool

IsDefinedBefore returns true if database contains en entry with profile name

func (*AKSProfile) SaveInstance

func (d *AKSProfile) SaveInstance() error

SaveInstance saves cluster profile into database

func (AKSProfile) TableName

func (AKSProfile) TableName() string

TableName overrides AKSProfile's table name

func (*AKSProfile) UpdateProfile

func (d *AKSProfile) UpdateProfile(r *components.ClusterProfileRequest, withSave bool) error

UpdateProfile update profile's data with ClusterProfileRequest's data and if bool is true then update in the database

type AWSNodePoolProfile

type AWSNodePoolProfile struct {
	ID           uint   `gorm:"primary_key"`
	InstanceType string `gorm:"default:'m4.xlarge'"`
	Name         string `gorm:"unique_index:idx_model_name"`
	NodeName     string `gorm:"unique_index:idx_model_name"`
	SpotPrice    string `gorm:"default:'0.2'"`
	MinCount     int    `gorm:"default:1"`
	MaxCount     int    `gorm:"default:2"`
	Image        string `gorm:"default:'ami-16bfeb6f'"`
}

AWSNodePoolProfile describes an Amazon cluster profile's nodepools

func (AWSNodePoolProfile) TableName

func (AWSNodePoolProfile) TableName() string

TableName overrides AWSNodePoolProfile's table name

type AWSProfile

type AWSProfile struct {
	DefaultModel
	Location           string                `gorm:"default:'eu-west-1'"`
	MasterInstanceType string                `gorm:"default:'m4.xlarge'"`
	MasterImage        string                `gorm:"default:'ami-16bfeb6f'"`
	NodePools          []*AWSNodePoolProfile `gorm:"foreignkey:Name"`
}

AWSProfile describes an Amazon cluster profile

func (*AWSProfile) AfterFind

func (d *AWSProfile) AfterFind() error

AfterFind loads nodepools to profile

func (*AWSProfile) BeforeDelete

func (d *AWSProfile) BeforeDelete() error

BeforeDelete deletes all nodepools to belongs to profile

func (*AWSProfile) BeforeSave

func (d *AWSProfile) BeforeSave() error

BeforeSave clears nodepools

func (*AWSProfile) DeleteProfile

func (d *AWSProfile) DeleteProfile() error

DeleteProfile deletes cluster profile from database

func (*AWSProfile) GetProfile

func (d *AWSProfile) GetProfile() *components.ClusterProfileResponse

GetProfile load profile from database and converts ClusterProfileResponse

func (*AWSProfile) GetType

func (d *AWSProfile) GetType() string

GetType returns profile's cloud type

func (*AWSProfile) IsDefinedBefore

func (d *AWSProfile) IsDefinedBefore() bool

IsDefinedBefore returns true if database contains en entry with profile name

func (*AWSProfile) SaveInstance

func (d *AWSProfile) SaveInstance() error

SaveInstance saves cluster profile into database

func (AWSProfile) TableName

func (AWSProfile) TableName() string

TableName overrides AWSProfile's table name

func (*AWSProfile) UpdateProfile

func (d *AWSProfile) UpdateProfile(r *components.ClusterProfileRequest, withSave bool) error

UpdateProfile update profile's data with ClusterProfileRequest's data and if bool is true then update in the database

type ClusterProfile

type ClusterProfile interface {
	IsDefinedBefore() bool
	SaveInstance() error
	GetType() string
	GetProfile() *components.ClusterProfileResponse
	UpdateProfile(*components.ClusterProfileRequest, bool) error
	DeleteProfile() error
}

ClusterProfile describes a cluster profile

func GetAllProfiles

func GetAllProfiles(cloudType string) ([]ClusterProfile, error)

GetAllProfiles loads all saved cluster profile from database by given cloud type

func GetDefaultProfiles

func GetDefaultProfiles() []ClusterProfile

GetDefaultProfiles create all types of clouds with default profile name

func GetProfile

func GetProfile(cloudType string, name string) (ClusterProfile, error)

GetProfile finds cluster profile from database by given name and cloud type

type DefaultModel

type DefaultModel struct {
	Name      string `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

DefaultModel describes the common variables all types of clouds

type GKENodePoolProfile

type GKENodePoolProfile struct {
	ID               uint   `gorm:"primary_key"`
	Count            int    `gorm:"default:1"`
	NodeInstanceType string `gorm:"default:'n1-standard-1'"`
	Name             string `gorm:"unique_index:idx_model_name"`
	NodeName         string `gorm:"unique_index:idx_model_name"`
	ServiceAccount   string
}

GKENodePoolProfile describes a Google cluster profile's nodepools

func (GKENodePoolProfile) TableName

func (GKENodePoolProfile) TableName() string

TableName overrides GKENodePoolProfile's table name

type GKEProfile

type GKEProfile struct {
	DefaultModel
	Location      string                `gorm:"default:'us-central1-a'"`
	NodeVersion   string                `gorm:"default:'1.9.4-gke.1'"`
	MasterVersion string                `gorm:"default:'1.9.4-gke.1'"`
	NodePools     []*GKENodePoolProfile `gorm:"foreignkey:Name"`
}

GKEProfile describes a Google cluster profile

func (*GKEProfile) AfterFind

func (d *GKEProfile) AfterFind() error

AfterFind loads nodepools to profile

func (*GKEProfile) BeforeDelete

func (d *GKEProfile) BeforeDelete() error

BeforeDelete deletes all nodepools to belongs to profile

func (*GKEProfile) BeforeSave

func (d *GKEProfile) BeforeSave() error

BeforeSave clears nodepools

func (*GKEProfile) DeleteProfile

func (d *GKEProfile) DeleteProfile() error

DeleteProfile deletes cluster profile from database

func (*GKEProfile) GetProfile

func (d *GKEProfile) GetProfile() *components.ClusterProfileResponse

GetProfile load profile from database and converts ClusterProfileResponse

func (*GKEProfile) GetType

func (d *GKEProfile) GetType() string

GetType returns profile's cloud type

func (*GKEProfile) IsDefinedBefore

func (d *GKEProfile) IsDefinedBefore() bool

IsDefinedBefore returns true if database contains en entry with profile name

func (*GKEProfile) SaveInstance

func (d *GKEProfile) SaveInstance() error

SaveInstance saves cluster profile into database

func (GKEProfile) TableName

func (GKEProfile) TableName() string

TableName overrides GKEProfile's table name

func (*GKEProfile) UpdateProfile

func (d *GKEProfile) UpdateProfile(r *components.ClusterProfileRequest, withSave bool) error

UpdateProfile update profile's data with ClusterProfileRequest's data and if bool is true then update in the database

Jump to

Keyboard shortcuts

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