clusters

package
v0.3.29 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

Create accepts a CreateOpts struct and creates a new cluster using the values provided.

func Delete

func Delete(c *gcorecloud.ServiceClient, clusterID string) (r tasks.Result)

Delete accepts a unique ID and deletes the cluster associated with it.

func ExtractClusterIDFromTask

func ExtractClusterIDFromTask(task *tasks.Task) (string, error)

func ExtractClustersInto

func ExtractClustersInto(r pagination.Page, v interface{}) error

func ExtractVersionInto

func ExtractVersionInto(r pagination.Page, v interface{}) error

func ExtractVersions

func ExtractVersions(r pagination.Page) ([]string, error)

ExtractVersions accepts a Page struct, specifically a VersionPage struct, and extracts the elements into a slice of strings.

func Instances

func Instances(c *gcorecloud.ServiceClient, clusterID string) pagination.Pager

Instances returns a Pager which allows you to iterate over a collection of cluster instances.

func InstancesAll

func InstancesAll(c *gcorecloud.ServiceClient, clusterID string) ([]instances.Instance, error)

InstancesAll returns all cluster instances.

func List

Versions returns a Pager which allows you to iterate over a collection of clusters. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

func Resize

func Resize(c *gcorecloud.ServiceClient, clusterID string, opts ResizeOptsBuilder) (r tasks.Result)

Resize accepts a ResizeOpts struct and updates an existing cluster using the values provided.

func Upgrade

func Upgrade(c *gcorecloud.ServiceClient, clusterID string, opts UpgradeOptsBuilder) (r tasks.Result)

Upgrade accepts a UpgradeOpts struct and upgrades an existing cluster using the values provided.

func Versions

Versions returns available cluster versions.

func VersionsAll

func VersionsAll(c *gcorecloud.ServiceClient) ([]string, error)

VersionsAll returns all cluster versions.

func Volumes

func Volumes(c *gcorecloud.ServiceClient, clusterID string) pagination.Pager

Volumes returns a Pager which allows you to iterate over a collection of cluster instances.

func VolumesAll

func VolumesAll(c *gcorecloud.ServiceClient, clusterID string) ([]volumes.Volume, error)

VolumesAll returns all cluster volumes.

Types

type Cluster

type Cluster struct {
	StatusReason       string            `json:"status_reason"`
	APIAddress         *gcorecloud.URL   `json:"api_address"`
	CoeVersion         string            `json:"coe_version"`
	ContainerVersion   string            `json:"container_version"`
	DiscoveryURL       *gcorecloud.URL   `json:"discovery_url"`
	HealthStatusReason map[string]string `json:"health_status_reason"`
	ProjectID          string            `json:"project_id"`
	UserID             string            `json:"user_id"`
	NodeAddresses      []net.IP          `json:"node_addresses"`
	MasterAddresses    []net.IP          `json:"master_addresses"`
	FixedNetwork       string            `json:"fixed_network"`
	FixedSubnet        string            `json:"fixed_subnet"`
	FloatingIPEnabled  bool              `json:"floating_ip_enabled"`
	Faults             map[string]string `json:"faults"`
	*ClusterList
}

Cluster represents a cluster structure.

type ClusterCACertificate

type ClusterCACertificate struct {
	ClusterUUID string `json:"cluster_uuid"`
	PEM         string `json:"pem"`
}

ClusterCACertificate represents a cluster CA certificate structure.

type ClusterCertificateCAResult

type ClusterCertificateCAResult struct {
	gcorecloud.Result
}

ClusterCertificateCAResult represents the result of CA cluster certificates

func Certificate

func Certificate(c *gcorecloud.ServiceClient, clusterID string) (r ClusterCertificateCAResult)

Certificate accepts a unique ID and return cluster CA.

func (ClusterCertificateCAResult) Extract

Extract is a function that accepts a result and extracts a cluster CA certificate.

type ClusterCertificateSignResult

type ClusterCertificateSignResult struct {
	gcorecloud.Result
}

ClusterCertificateSignResult represents the result of signing cluster certificate operation

func SignCertificate

SignCertificate accepts a unique ID and sign cluster certificate.

func (ClusterCertificateSignResult) Extract

Extract is a function that accepts a result and extracts a cluster signed certificate.

type ClusterList

type ClusterList struct {
	UUID              string             `json:"uuid"`
	Name              string             `json:"name"`
	ClusterTemplateID string             `json:"cluster_template_id"`
	KeyPair           string             `json:"keypair"`
	NodeCount         int                `json:"node_count"`
	MasterCount       int                `json:"master_count"`
	DockerVolumeSize  int                `json:"docker_volume_size"`
	Labels            map[string]string  `json:"labels"`
	MasterFlavorID    string             `json:"master_flavor_id"`
	FlavorID          string             `json:"flavor_id"`
	CreateTimeout     int                `json:"create_timeout"`
	StackID           string             `json:"stack_id"`
	Status            string             `json:"status"`
	HealthStatus      types.HealthStatus `json:"health_status"`
	Version           string             `json:"version"`
	CreatedAt         time.Time          `json:"created_at"`
	UpdatedAt         *time.Time         `json:"updated_at"`
}

Cluster represents a cluster structure in list response.

type ClusterListWithPool

type ClusterListWithPool struct {
	Pools []pools.ClusterListPool `json:"pools"`
	*ClusterList
}

func ExtractClusters

func ExtractClusters(r pagination.Page) ([]ClusterListWithPool, error)

ExtractCluster accepts a Page struct, specifically a ClusterPage struct, and extracts the elements into a slice of ClusterListWithPool structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

Versions returns all magnum clusters.

type ClusterPage

type ClusterPage struct {
	pagination.LinkedPageBase
}

VersionPage is the page returned by a pager when traversing over a collection of clusters.

func (ClusterPage) IsEmpty

func (r ClusterPage) IsEmpty() (bool, error)

IsEmpty checks whether a ClusterPage struct is empty.

func (ClusterPage) NextPageURL

func (r ClusterPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of clusters has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type ClusterSignCertificate

type ClusterSignCertificate struct {
	ClusterUUID string `json:"cluster_uuid"`
	PEM         string `json:"pem"`
	CSR         string `json:"csr"`
}

ClusterSignCertificate represents a cluster signed certificate structure.

type ClusterSignCertificateOpts

type ClusterSignCertificateOpts struct {
	CSR string `json:"csr" validate:"required"`
}

ClusterSignCertificateOpts represents a options to sign cluster certificate.

func (ClusterSignCertificateOpts) ToClusterSignCertificateMap

func (opts ClusterSignCertificateOpts) ToClusterSignCertificateMap() (map[string]interface{}, error)

ToClusterSignCertificateMap builds a request body from ClusterSignCertificateOpts.

type ClusterSignCertificateOptsBuilder

type ClusterSignCertificateOptsBuilder interface {
	ToClusterSignCertificateMap() (map[string]interface{}, error)
}

ClusterSignCertificateOptsBuilder allows extensions to add additional parameters to the SignCertificate request.

type ClusterTaskResult

type ClusterTaskResult struct {
	K8sClusters []string `json:"k8s_clusters" mapstructure:"k8s_clusters"`
}

type ClusterWithPool

type ClusterWithPool struct {
	*Cluster
	Pools []pools.ClusterPool `json:"pools"`
}

type Config

type Config struct {
	Config string `json:"config,omitempty"`
}

Config represents a k8s config structure.

type ConfigResult

type ConfigResult struct {
	gcorecloud.Result
}

ConfigResult represents the result of kubernetes config

func GetConfig

func GetConfig(c *gcorecloud.ServiceClient, clusterID string) (r ConfigResult)

GetConfig accepts a unique ID and get cluster k8s config.

func (ConfigResult) Extract

func (r ConfigResult) Extract() (*Config, error)

Extract is a function that accepts a result and extracts a cluster config.

type CreateOpts

type CreateOpts struct {
	Name                      string             `json:"name" required:"true"`
	FixedNetwork              string             `json:"fixed_network" required:"true" validate:"required,uuid4"`
	FixedSubnet               string             `json:"fixed_subnet" required:"true" validate:"required,uuid4"`
	MasterCount               int                `json:"master_count,omitempty" validate:"omitempty,gt=0"`
	KeyPair                   string             `json:"keypair,omitempty"`
	PodsIPPool                *gcorecloud.CIDR   `json:"pods_ip_pool,omitempty"`
	ServicesIPPool            *gcorecloud.CIDR   `json:"services_ip_pool,omitempty"`
	AutoHealingEnabled        bool               `json:"auto_healing_enabled"`
	MasterLBFloatingIPEnabled bool               `json:"master_lb_floating_ip_enabled,omitempty"`
	Version                   string             `json:"version,omitempty" validate:"omitempty,sem"`
	Pools                     []pools.CreateOpts `json:"pools" required:"true" validate:"required,min=1,dive"`
}

CreateOpts represents options used to create a cluster.

func (CreateOpts) ToClusterCreateMap

func (opts CreateOpts) ToClusterCreateMap() (map[string]interface{}, error)

ToClusterCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToClusterCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Cluster.

func Get

func Get(c *gcorecloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific cluster based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*ClusterWithPool, error)

Extract is a function that accepts a result and extracts a cluster resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

type ListOpts struct {
	Limit   int    `q:"limit"`
	Marker  string `q:"marker"`
	SortKey string `q:"sort_key"`
	SortDir string `q:"sort_dir"`
	Detail  bool   `q:"detail"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the clusters attributes you want to see returned. SortKey allows you to sort by a particular clusters attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToClusterListQuery

func (opts ListOpts) ToClusterListQuery() (string, error)

ToClusterListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToClusterListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the Versions request.

type ResizeOpts

type ResizeOpts struct {
	NodeCount     int      `json:"node_count" required:"true" validate:"required,gt=0"`
	NodesToRemove []string `json:"nodes_to_remove,omitempty" validate:"omitempty,dive,uuid4"`
	Pool          string   `json:"pool,omitempty" validate:"required_with=NodesToRemove,omitempty,uuid4"`
}

ResizeOpts represents options used to update a cluster.

func (ResizeOpts) ToClusterResizeMap

func (opts ResizeOpts) ToClusterResizeMap() (map[string]interface{}, error)

ToClusterResizeMap builds a request body from ResizeOpts.

type ResizeOptsBuilder

type ResizeOptsBuilder interface {
	ToClusterResizeMap() (map[string]interface{}, error)
}

ResizeOptsBuilder allows extensions to add additional parameters to the Resize request.

type UpgradeOpts

type UpgradeOpts struct {
	Pool    string `json:"pool,omitempty" validate:"omitempty,uuid4"`
	Version string `json:"version" required:"true" validate:"required,sem"`
}

UpgradeOpts represents options used to upgrade a cluster.

func (UpgradeOpts) ToClusterUpgradeMap

func (opts UpgradeOpts) ToClusterUpgradeMap() (map[string]interface{}, error)

ToClusterUpgradeMap builds a request body from UpgradeOpts.

type UpgradeOptsBuilder

type UpgradeOptsBuilder interface {
	ToClusterUpgradeMap() (map[string]interface{}, error)
}

UpgradeOptsBuilder allows extensions to add additional parameters to the Upgrade request.

type VersionPage

type VersionPage struct {
	pagination.LinkedPageBase
}

VersionPage is the page returned by a pager when traversing over a collection of cluster versions.

func (VersionPage) IsEmpty

func (r VersionPage) IsEmpty() (bool, error)

IsEmpty checks whether a VersionPage struct is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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