cluster

package
v0.0.0-...-e35233a Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusDeleted        = "deleted"
	StatusDeleting       = "deleting"
	StatusFailed         = "failed"
	StatusNormal         = "normal"
	StatusReady          = "ready"
	StatusProvisioning   = "provisioning"
	StatusFailedToDelete = "failed to delete"
	StatusExpired        = "expired"
	StatusFailedToExpire = "failed to expire"
)

Variables

This section is empty.

Functions

func InitDefaultClusterService

func InitDefaultClusterService(config ibmcloud.Configuration)

Types

type Cluster

type Cluster struct {
	ID                  string
	RequestID           string
	IBMClusterRequestID string
	Name                string
	ConsoleURL          string
	Hostname            string
	LoginURL            string
	WorkshopURL         string
	IdentityProviderURL string
	MasterURL           string
	Status              string
	Error               string
	User                User
	PublicVlan          string
	PrivateVlan         string
}

type ClusterService

type ClusterService struct {
	IbmCloudClient ibmcloud.ICClient
	Config         ibmcloud.Configuration
}

ClusterService represents a registry of all cluster resources

var DefaultClusterService *ClusterService

func (*ClusterService) CreateNewRequest

func (s *ClusterService) CreateNewRequest(requestedBy string, n int, zone string, deleteInHours int, noSubnet bool) (Request, error)

CreateNewRequest creates a new request and starts provisioning clusters

func (*ClusterService) CreateUsers

func (s *ClusterService) CreateUsers(n, startIndex int) ([]User, error)

CreateUsers creates n number of users For example if n == 3 and startIndex == 1000 then the following users will be created: rd-dev-1001, rd-dev-1002, rd-dev-1003

func (*ClusterService) DeleteCluster

func (s *ClusterService) DeleteCluster(id string) error

DeleteCluster deletes the cluster with the given ID

func (*ClusterService) GetCluster

func (s *ClusterService) GetCluster(id string) (*Cluster, error)

GetCluster returns the cluster with the given ID

func (*ClusterService) GetClusters

func (s *ClusterService) GetClusters(zone string) ([]Cluster, error)

GetClusters returns an array of the clusters with status not equal to "deleted" for the given zone.

func (*ClusterService) GetRequestWithClusters

func (s *ClusterService) GetRequestWithClusters(requestID string) (*RequestWithClusters, error)

func (*ClusterService) GetZones

func (s *ClusterService) GetZones() ([]ibmcloud.Location, error)

func (*ClusterService) Requests

func (s *ClusterService) Requests() ([]Request, error)

func (*ClusterService) ResumeProvisioningRequests

func (s *ClusterService) ResumeProvisioningRequests() error

ResumeProvisioningRequests load requests that are still provisioning and wait for their clusters to be ready to update the status

func (*ClusterService) StartDeletingExpiredClusters

func (s *ClusterService) StartDeletingExpiredClusters(intervalInSec int)

StartDeletingExpiredClusters starts a goroutine to check expired clusters every n seconds and delete them

func (*ClusterService) Users

func (s *ClusterService) Users() ([]User, error)

type Request

type Request struct {
	ID            string
	Requested     int // Number of clusters requested
	Created       int64
	Status        string
	Error         string
	RequestedBy   string
	Zone          string
	DeleteInHours int
	NoSubnet      bool
}

Request represents a cluster request

type RequestWithClusters

type RequestWithClusters struct {
	Request  `json:",inline"`
	Clusters []Cluster
}

Request represents a cluster request with detailed information about all request clusters

type User

type User struct {
	ID            string // <iam_object>.user_id & <cloud_direct_object>.username
	CloudDirectID string // <cloud_direct_object>.id
	Email         string
	Password      string
	ClusterID     string
	PolicyID      string
	Recycled      int64 // last recycle timestamp
}

func GetUserByClusterID

func GetUserByClusterID(clusterID string) (*User, error)

getUserByClusterID returns the first found user with the given cluster_id and with the earliest "recycled" timestamp returns an error if no user found

Jump to

Keyboard shortcuts

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