plugin

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AccessKey string `mapstructure:"access_key"`
	SecretKey string `mapstructure:"secret_key"`
	OrgID     string `mapstructure:"organization_id"`
	ProjectID string `mapstructure:"project_id"`
	Region    string `mapstructure:"region"`
	Zone      string `mapstructure:"zone"`
}

Config represents a plugin configuration object

type Plugin

type Plugin struct {
	State
	// contains filtered or unexported fields
}

Plugin represents the Scaleway target plugin

func New

func New(logger hclog.Logger) *Plugin

New returns a new Scaleway target plugin instance

func (*Plugin) ClusterRunPreScaleInTasks

func (p *Plugin) ClusterRunPreScaleInTasks(ctx context.Context, blueprint instance.Server, config map[string]string, num int) ([]scaleutils.NodeResourceID, error)

ClusterRunPreScaleInTasks is a temporary alternative to the built-in `RunPreScaleInTasks`, see https://github.com/hashicorp/nomad-autoscaler/issues/572 for more information.

func (*Plugin) LookupNodeID

func (p *Plugin) LookupNodeID(node *api.Node) (id string, err error)

LookupNodeID translates a Nomad node ID to a Scaleway ID

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() (*base.PluginInfo, error)

PluginInfo returns plugin information

func (*Plugin) Scale

func (p *Plugin) Scale(action sdk.ScalingAction, config map[string]string) error

Scale performs a scaling action against the target

func (*Plugin) ScaleDown

func (p *Plugin) ScaleDown(ctx context.Context, blueprint instance.Server, n int64, config map[string]string) error

ScaleDown scales down the server pool by `n` servers

func (*Plugin) ScaleUp

func (p *Plugin) ScaleUp(blueprint instance.Server, n int64, opt *instance.ServerOpt) error

ScaleUp scales up the server pool by `n` servers, options can be nil

func (*Plugin) SetConfig

func (p *Plugin) SetConfig(config map[string]string) error

SetConfig sets the plugin configuration, usually called by the Nomad autoscaler

func (*Plugin) Status

func (p *Plugin) Status(config map[string]string) (*sdk.TargetStatus, error)

Status fetches information from the Scaleway platform to be used by the Nomad autoscaler

type State

type State int32

State represents a plugin state

const (
	StateIdle State = iota
	StateActive
)

A set of possible plugin states

func (*State) Get

func (s *State) Get() State

Get returns the current state

func (*State) SetActive

func (s *State) SetActive()

SetActive changes the state to active

func (*State) SetIdle

func (s *State) SetIdle()

SetIdle changes the state to idle

Jump to

Keyboard shortcuts

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