Documentation ¶
Overview ¶
Package packet implements a client to the Equinix Metal API.
Index ¶
- Constants
- Variables
- func DefaultCreateTags(namespace, name, clusterName string) []string
- func GenerateClusterTag(clusterName string) string
- func GenerateMachineNameTag(name string) string
- func GenerateNamespaceTag(namespace string) string
- func ItemsInList(list []string, items []string) bool
- type Client
- func (p *Client) CreateIP(ctx context.Context, _, clusterName, projectID, facility, metro string) (net.IP, error)
- func (p *Client) EnableProjectBGP(ctx context.Context, projectID string) error
- func (p *Client) EnsureNodeBGPEnabled(ctx context.Context, id string) error
- func (p *Client) GetDevice(ctx context.Context, deviceID string) (*metal.Device, *http.Response, error)
- func (p *Client) GetDeviceAddresses(device *metal.Device) []corev1.NodeAddress
- func (p *Client) GetDeviceByTags(ctx context.Context, project string, tags []string) (*metal.Device, error)
- func (p *Client) GetIPByClusterIdentifier(ctx context.Context, _, name, projectID string) (*metal.IPReservation, error)
- func (p *Client) NewDevice(ctx context.Context, req CreateDeviceRequest) (*metal.Device, error)
- type CreateDeviceRequest
Constants ¶
const (
// DefaultLocalASN sets the Local ASN for BGP to our default of 65000.
DefaultLocalASN = 65000
)
Variables ¶
var ( // ErrControlPlanEndpointNotFound is returned when the control plane endpoint is not found. ErrControlPlanEndpointNotFound = errors.New("control plane not found") // ErrElasticIPQuotaExceeded is returned when the quota for elastic IPs is exceeded. ErrElasticIPQuotaExceeded = errors.New("could not create an Elastic IP due to quota limits on the account, please contact Equinix Metal support") // ErrInvalidIP is returned when the IP is invalid. ErrInvalidIP = errors.New("invalid IP") // ErrMissingEnvVar is returned when a required environment variable is missing. ErrMissingEnvVar = errors.New("missing required env var") // ErrInvalidRequest is returned when the request is invalid. ErrInvalidRequest = errors.New("invalid request") )
Functions ¶
func DefaultCreateTags ¶ added in v0.5.0
DefaultCreateTags returns the default tags for an Equinix Metal resource.
func GenerateClusterTag ¶
GenerateClusterTag generates a tag for a cluster.
func GenerateMachineNameTag ¶ added in v0.5.0
GenerateMachineNameTag generates a tag for a machine.
func GenerateNamespaceTag ¶ added in v0.5.0
GenerateNamespaceTag generates a tag for a namespace.
func ItemsInList ¶
ItemsInList checks if all items are in the list.
Types ¶
type Client ¶ added in v0.5.0
Client is a wrapper around the Equinix Metal API client.
func (*Client) CreateIP ¶ added in v0.5.0
func (p *Client) CreateIP(ctx context.Context, _, clusterName, projectID, facility, metro string) (net.IP, error)
CreateIP reserves an IP via Packet API. The request fails straight if no IP are available for the specified project. This prevent the cluster to become ready.
func (*Client) EnableProjectBGP ¶ added in v0.6.0
EnableProjectBGP enables bgp on the project.
func (*Client) EnsureNodeBGPEnabled ¶ added in v0.6.0
EnsureNodeBGPEnabled check if the node has bgp enabled, and set it if it does not.
func (*Client) GetDevice ¶ added in v0.5.0
func (p *Client) GetDevice(ctx context.Context, deviceID string) (*metal.Device, *http.Response, error)
GetDevice returns the device with the given ID.
func (*Client) GetDeviceAddresses ¶ added in v0.5.0
func (p *Client) GetDeviceAddresses(device *metal.Device) []corev1.NodeAddress
GetDeviceAddresses returns the addresses of the device.
func (*Client) GetDeviceByTags ¶ added in v0.5.0
func (p *Client) GetDeviceByTags(ctx context.Context, project string, tags []string) (*metal.Device, error)
GetDeviceByTags returns the first device that matches all of the tags.
func (*Client) GetIPByClusterIdentifier ¶ added in v0.5.0
func (p *Client) GetIPByClusterIdentifier(ctx context.Context, _, name, projectID string) (*metal.IPReservation, error)
GetIPByClusterIdentifier returns the IP reservation for the given cluster identifier.
type CreateDeviceRequest ¶
type CreateDeviceRequest struct { ExtraTags []string MachineScope *scope.MachineScope ControlPlaneEndpoint string }
CreateDeviceRequest is an object representing the API request to create a Device.