hcloud

package
v1.7.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package hcloud contains the Hcloud implementation of the [platform.Platform].

Index

Constants

View Source
const (
	// HCloudMetadataEndpoint is the local HCloud metadata endpoint.
	HCloudMetadataEndpoint = "http://169.254.169.254/hetzner/v1/metadata"

	// HCloudNetworkEndpoint is the local HCloud metadata endpoint for the network-config.
	HCloudNetworkEndpoint = "http://169.254.169.254/hetzner/v1/metadata/network-config"

	// HCloudUserDataEndpoint is the local HCloud metadata endpoint for the config.
	HCloudUserDataEndpoint = "http://169.254.169.254/hetzner/v1/userdata"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Hcloud

type Hcloud struct{}

Hcloud is the concrete type that implements the runtime.Platform interface.

func (*Hcloud) Configuration

func (h *Hcloud) Configuration(ctx context.Context, r state.State) ([]byte, error)

Configuration implements the runtime.Platform interface.

func (*Hcloud) KernelArgs

func (h *Hcloud) KernelArgs() procfs.Parameters

KernelArgs implements the runtime.Platform interface.

func (*Hcloud) Mode

func (h *Hcloud) Mode() runtime.Mode

Mode implements the runtime.Platform interface.

func (*Hcloud) Name

func (h *Hcloud) Name() string

Name implements the runtime.Platform interface.

func (*Hcloud) NetworkConfiguration

func (h *Hcloud) NetworkConfiguration(ctx context.Context, _ state.State, ch chan<- *runtime.PlatformNetworkConfig) error

NetworkConfiguration implements the runtime.Platform interface.

func (*Hcloud) ParseMetadata

func (h *Hcloud) ParseMetadata(unmarshalledNetworkConfig *NetworkConfig, metadata *MetadataConfig) (*runtime.PlatformNetworkConfig, error)

ParseMetadata converts HCloud metadata to platform network configuration.

type MetadataConfig

type MetadataConfig struct {
	Hostname         string `yaml:"hostname,omitempty"`
	Region           string `yaml:"region,omitempty"`
	AvailabilityZone string `yaml:"availability-zone,omitempty"`
	InstanceID       string `yaml:"instance-id,omitempty"`
	PublicIPv4       string `yaml:"public-ipv4,omitempty"`
}

MetadataConfig holds meta info.

type NetworkConfig

type NetworkConfig struct {
	Version int `yaml:"version"`
	Config  []struct {
		Mac        string `yaml:"mac_address"`
		Interfaces string `yaml:"name"`
		Subnets    []struct {
			NameServers []string `yaml:"dns_nameservers,omitempty"`
			Address     string   `yaml:"address,omitempty"`
			Gateway     string   `yaml:"gateway,omitempty"`
			Ipv4        bool     `yaml:"ipv4,omitempty"`
			Ipv6        bool     `yaml:"ipv6,omitempty"`
			Type        string   `yaml:"type"`
		} `yaml:"subnets"`
		Type string `yaml:"type"`
	} `yaml:"config"`
}

NetworkConfig holds hcloud network-config info.

Jump to

Keyboard shortcuts

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