magnum

package
v0.0.0-...-386b7fa Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

README

Cluster Autoscaler for OpenStack Magnum

The cluster autoscaler for Magnum scales worker nodes within any specified nodegroup. It will run as a Deployment in your cluster. This README will go over some of the necessary steps required to get the cluster autoscaler up and running.

Permissions and credentials

The autoscaler needs a ServiceAccount with permissions for Kubernetes and requires credentials for interacting with OpenStack.

An example ServiceAccount is given in examples/cluster-autoscaler-svcaccount.yaml.

The credentials for authenticating with OpenStack are stored in a secret and mounted as a file inside the container. examples/cluster-autoscaler-secret can be modified with the contents of your cloud-config. This file can be obtained from your master node, in /etc/kubernetes (may be named kube_openstack_config instead of cloud-config).

Autoscaler deployment

The deployment in examples/cluster-autoscaler-deployment.yaml can be used, but the arguments passed to the autoscaler will need to be changed to match your cluster.

Argument Usage
--cluster-name The name of your Kubernetes cluster. If there are multiple clusters sharing the same name then the cluster IDs should be used instead.
--cloud-provider Can be omitted if the autoscaler is built with BUILD_TAGS=magnum.
--nodes Of the form min:max:NodeGroupName. Node groups are not yet implemented in Magnum so only a single node group is currently supported.

Notes

Magnum does not yet support multiple node groups within a single cluster, but this is currently in development. Once node groups are available for Magnum, support for autoscaling clusters using nodegroups will be made available by adding another implementation of the Magnum manager interface.

The autoscaler will not remove nodes which have non-default kube-system pods. This prevents the node that the autoscaler is running on from being scaled down. If you are deploying the autoscaler into a cluster which already has more than one node, it is best to deploy it onto any node which already has non-default kube-system pods, to minimise the number of nodes which cannot be removed when scaling.

Or, if you are using a Magnum version which supports scheduling on the master node, then the example deployment file examples/cluster-autoscaler-deployment-master.yaml can be used.

Documentation

Index

Constants

View Source
const (
	// ProviderName is the cloud provider name for Magnum
	ProviderName = "magnum"
	// GPULabel is the label added to nodes with GPU resource.
	GPULabel = "cloud.google.com/gke-accelerator"
)

Variables

This section is empty.

Functions

func BuildMagnum

BuildMagnum is called by the autoscaler to build a magnum cloud provider.

The magnumManager is created here, and the node groups are created based on the specs provided via the command line parameters.

Types

type BlockStorageOpts

type BlockStorageOpts struct {
	BSVersion             string `gcfg:"bs-version"`        // overrides autodetection. v1 or v2. Defaults to auto
	TrustDevicePath       bool   `gcfg:"trust-device-path"` // See Issue #33128
	IgnoreVolumeAZ        bool   `gcfg:"ignore-volume-az"`
	NodeVolumeAttachLimit int    `gcfg:"node-volume-attach-limit"` // override volume attach limit for Cinder. Default is : 256
}

BlockStorageOpts is used to talk to Cinder service

type Config

type Config struct {
	Global struct {
		AuthURL         string `gcfg:"auth-url"`
		Username        string
		UserID          string `gcfg:"user-id"`
		Password        string
		TenantID        string `gcfg:"tenant-id"`
		TenantName      string `gcfg:"tenant-name"`
		TrustID         string `gcfg:"trust-id"`
		DomainID        string `gcfg:"domain-id"`
		DomainName      string `gcfg:"domain-name"`
		Region          string
		CAFile          string `gcfg:"ca-file"`
		SecretName      string `gcfg:"secret-name"`
		SecretNamespace string `gcfg:"secret-namespace"`
	}
	LoadBalancer LoadBalancerOpts
	BlockStorage BlockStorageOpts
	Route        RouterOpts
	Metadata     MetadataOpts
}

Config is used to read and store information from the cloud configuration file

Taken from kubernetes/pkg/cloudprovider/providers/openstack/openstack.go LoadBalancer, BlockStorage, Route, Metadata are not needed for the autoscaler, but are kept so that if a cloud-config file with those sections is provided then the parsing will not fail.

type LoadBalancerOpts

type LoadBalancerOpts struct {
	LBVersion            string     `gcfg:"lb-version"`          // overrides autodetection. Only support v2.
	UseOctavia           bool       `gcfg:"use-octavia"`         // uses Octavia V2 service catalog endpoint
	SubnetID             string     `gcfg:"subnet-id"`           // overrides autodetection.
	FloatingNetworkID    string     `gcfg:"floating-network-id"` // If specified, will create floating ip for loadbalancer, or do not create floating ip.
	LBMethod             string     `gcfg:"lb-method"`           // default to ROUND_ROBIN.
	LBProvider           string     `gcfg:"lb-provider"`
	CreateMonitor        bool       `gcfg:"create-monitor"`
	MonitorDelay         MyDuration `gcfg:"monitor-delay"`
	MonitorTimeout       MyDuration `gcfg:"monitor-timeout"`
	MonitorMaxRetries    uint       `gcfg:"monitor-max-retries"`
	ManageSecurityGroups bool       `gcfg:"manage-security-groups"`
	NodeSecurityGroupIDs []string   // Do not specify, get it automatically when enable manage-security-groups. TODO(FengyunPan): move it into cache
}

LoadBalancerOpts have the options to talk to Neutron LBaaSV2 or Octavia

type MetadataOpts

type MetadataOpts struct {
	SearchOrder    string     `gcfg:"search-order"`
	RequestTimeout MyDuration `gcfg:"request-timeout"`
}

MetadataOpts is used for configuring how to talk to metadata service or config drive

type MyDuration

type MyDuration struct {
	time.Duration
}

MyDuration is the encoding.TextUnmarshaler interface for time.Duration

func (*MyDuration) UnmarshalText

func (d *MyDuration) UnmarshalText(text []byte) error

UnmarshalText is used to convert from text to Duration

type NodeRef

type NodeRef struct {
	Name       string
	MachineID  string
	ProviderID string
	IPs        []string
}

NodeRef stores the name, machineID and providerID of a node.

type RouterOpts

type RouterOpts struct {
	RouterID string `gcfg:"router-id"` // required
}

RouterOpts is used for Neutron routes

type UpdateOptsInt

type UpdateOptsInt struct {
	Op    clusters.UpdateOp `json:"op" required:"true"`
	Path  string            `json:"path" required:"true"`
	Value int               `json:"value,omitempty"`
}

UpdateOptsInt has a value of type int rather than string.

A Magnum API running with python2 accepts a string for replacing node_count, but with python3 only an integer type is accepted.

TODO: Can remove when this is provided by gophercloud https://github.com/gophercloud/gophercloud/issues/1458

func (UpdateOptsInt) ToClustersUpdateMap

func (opts UpdateOptsInt) ToClustersUpdateMap() (map[string]interface{}, error)

ToClustersUpdateMap assembles a request body based on the contents of UpdateOpts.

Directories

Path Synopsis
Package gophercloud provides a multi-vendor interface to OpenStack-compatible clouds.
Package gophercloud provides a multi-vendor interface to OpenStack-compatible clouds.
openstack
Package openstack contains resources for the individual OpenStack projects supported in Gophercloud.
Package openstack contains resources for the individual OpenStack projects supported in Gophercloud.
openstack/blockstorage/extensions/volumeactions
Package volumeactions provides information and interaction with volumes in the OpenStack Block Storage service.
Package volumeactions provides information and interaction with volumes in the OpenStack Block Storage service.
openstack/blockstorage/v1/volumes
Package volumes provides information and interaction with volumes in the OpenStack Block Storage service.
Package volumes provides information and interaction with volumes in the OpenStack Block Storage service.
openstack/blockstorage/v2/volumes
Package volumes provides information and interaction with volumes in the OpenStack Block Storage service.
Package volumes provides information and interaction with volumes in the OpenStack Block Storage service.
openstack/blockstorage/v3/volumes
Package volumes provides information and interaction with volumes in the OpenStack Block Storage service.
Package volumes provides information and interaction with volumes in the OpenStack Block Storage service.
openstack/common/extensions
Package extensions provides information and interaction with the different extensions available for an OpenStack service.
Package extensions provides information and interaction with the different extensions available for an OpenStack service.
openstack/compute/v2/extensions/attachinterfaces
Package attachinterfaces provides the ability to retrieve and manage network interfaces through Nova.
Package attachinterfaces provides the ability to retrieve and manage network interfaces through Nova.
openstack/compute/v2/extensions/volumeattach
Package volumeattach provides the ability to attach and detach volumes from servers.
Package volumeattach provides the ability to attach and detach volumes from servers.
openstack/compute/v2/flavors
Package flavors provides information and interaction with the flavor API in the OpenStack Compute service.
Package flavors provides information and interaction with the flavor API in the OpenStack Compute service.
openstack/compute/v2/images
Package images provides information and interaction with the images through the OpenStack Compute service.
Package images provides information and interaction with the images through the OpenStack Compute service.
openstack/compute/v2/servers
Package servers provides information and interaction with the server API resource in the OpenStack Compute service.
Package servers provides information and interaction with the server API resource in the OpenStack Compute service.
openstack/containerinfra/v1/clusters
Package clusters contains functionality for working with Magnum Cluster resources.
Package clusters contains functionality for working with Magnum Cluster resources.
openstack/identity/v2/tenants
Package tenants provides information and interaction with the tenants API resource for the OpenStack Identity service.
Package tenants provides information and interaction with the tenants API resource for the OpenStack Identity service.
openstack/identity/v2/tokens
Package tokens provides information and interaction with the token API resource for the OpenStack Identity service.
Package tokens provides information and interaction with the token API resource for the OpenStack Identity service.
openstack/identity/v3/extensions/trusts
Package trusts enables management of OpenStack Identity Trusts.
Package trusts enables management of OpenStack Identity Trusts.
openstack/identity/v3/tokens
Package tokens provides information and interaction with the token API resource for the OpenStack Identity service.
Package tokens provides information and interaction with the token API resource for the OpenStack Identity service.
openstack/networking/v2/extensions/external
Package external provides information and interaction with the external extension for the OpenStack Networking service.
Package external provides information and interaction with the external extension for the OpenStack Networking service.
openstack/networking/v2/extensions/layer3/floatingips
package floatingips enables management and retrieval of Floating IPs from the OpenStack Networking service.
package floatingips enables management and retrieval of Floating IPs from the OpenStack Networking service.
openstack/networking/v2/extensions/layer3/routers
Package routers enables management and retrieval of Routers from the OpenStack Networking service.
Package routers enables management and retrieval of Routers from the OpenStack Networking service.
openstack/networking/v2/extensions/lbaas_v2/l7policies
Package l7policies provides information and interaction with L7Policies and Rules of the LBaaS v2 extension for the OpenStack Networking service.
Package l7policies provides information and interaction with L7Policies and Rules of the LBaaS v2 extension for the OpenStack Networking service.
openstack/networking/v2/extensions/lbaas_v2/listeners
Package listeners provides information and interaction with Listeners of the LBaaS v2 extension for the OpenStack Networking service.
Package listeners provides information and interaction with Listeners of the LBaaS v2 extension for the OpenStack Networking service.
openstack/networking/v2/extensions/lbaas_v2/loadbalancers
Package loadbalancers provides information and interaction with Load Balancers of the LBaaS v2 extension for the OpenStack Networking service.
Package loadbalancers provides information and interaction with Load Balancers of the LBaaS v2 extension for the OpenStack Networking service.
openstack/networking/v2/extensions/lbaas_v2/monitors
Package monitors provides information and interaction with Monitors of the LBaaS v2 extension for the OpenStack Networking service.
Package monitors provides information and interaction with Monitors of the LBaaS v2 extension for the OpenStack Networking service.
openstack/networking/v2/extensions/lbaas_v2/pools
Package pools provides information and interaction with Pools and Members of the LBaaS v2 extension for the OpenStack Networking service.
Package pools provides information and interaction with Pools and Members of the LBaaS v2 extension for the OpenStack Networking service.
openstack/networking/v2/extensions/security/groups
Package groups provides information and interaction with Security Groups for the OpenStack Networking service.
Package groups provides information and interaction with Security Groups for the OpenStack Networking service.
openstack/networking/v2/extensions/security/rules
Package rules provides information and interaction with Security Group Rules for the OpenStack Networking service.
Package rules provides information and interaction with Security Group Rules for the OpenStack Networking service.
openstack/networking/v2/networks
Package networks contains functionality for working with Neutron network resources.
Package networks contains functionality for working with Neutron network resources.
openstack/networking/v2/ports
Package ports contains functionality for working with Neutron port resources.
Package ports contains functionality for working with Neutron port resources.
openstack/orchestration/v1/stackresources
Package stackresources provides operations for working with stack resources.
Package stackresources provides operations for working with stack resources.
openstack/orchestration/v1/stacks
Package stacks provides operation for working with Heat stacks.
Package stacks provides operation for working with Heat stacks.
pagination
Package pagination contains utilities and convenience structs that implement common pagination idioms within OpenStack APIs.
Package pagination contains utilities and convenience structs that implement common pagination idioms within OpenStack APIs.
testhelper
Package testhelper container methods that are useful for writing unit tests.
Package testhelper container methods that are useful for writing unit tests.

Jump to

Keyboard shortcuts

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