hcloud

package
v1.29.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Apache-2.0 Imports: 32 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ProvidedBy              = "instance.hetzner.cloud/provided-by"
	MisconfiguredInternalIP = "MisconfiguredInternalIP"
)

Variables

This section is empty.

Functions

func NewCloud added in v1.21.0

func NewCloud(cidr string) (cloudprovider.Interface, error)

func RunLoadBalancerTests

func RunLoadBalancerTests(t *testing.T, tests []LoadBalancerTestCase)

Types

type LoadBalancerOps

type LoadBalancerOps interface {
	GetByName(ctx context.Context, name string) (*hcloud.LoadBalancer, error)
	GetByID(ctx context.Context, id int64) (*hcloud.LoadBalancer, error)
	GetByK8SServiceUID(ctx context.Context, svc *corev1.Service) (*hcloud.LoadBalancer, error)
	Create(ctx context.Context, lbName string, service *corev1.Service) (*hcloud.LoadBalancer, error)
	Delete(ctx context.Context, lb *hcloud.LoadBalancer) error
	ReconcileHCLB(ctx context.Context, lb *hcloud.LoadBalancer, svc *corev1.Service) (bool, error)
	ReconcileHCLBTargets(ctx context.Context, lb *hcloud.LoadBalancer, svc *corev1.Service, nodes []*corev1.Node) (bool, error)
	ReconcileHCLBServices(ctx context.Context, lb *hcloud.LoadBalancer, svc *corev1.Service) (bool, error)
}

LoadBalancerOps defines the Load Balancer related operations required by the hcloud-cloud-controller-manager.

type LoadBalancerTestCase

type LoadBalancerTestCase struct {
	Name string

	// Defined in test case as needed
	ClusterName              string
	NetworkID                int
	ServiceUID               string
	ServiceAnnotations       map[annotation.Name]string
	UsePrivateIngressDefault *bool
	UseIPv6Default           *bool
	Nodes                    []*corev1.Node
	LB                       *hcloud.LoadBalancer
	LBCreateResult           *hcloud.LoadBalancerCreateResult
	Mock                     func(t *testing.T, tt *LoadBalancerTestCase)

	// Defines the actual test
	Perform func(t *testing.T, tt *LoadBalancerTestCase)

	Ctx context.Context // Set to context.Background by run if not defined in test

	// Set by run
	LBOps         *hcops.MockLoadBalancerOps
	LBClient      *mocks.LoadBalancerClient
	LoadBalancers *loadBalancers
	Service       *corev1.Service
}

type MockEventRecorder added in v1.24.0

type MockEventRecorder struct{}

func (*MockEventRecorder) AnnotatedEventf added in v1.24.0

func (er *MockEventRecorder) AnnotatedEventf(
	_ runtime.Object,
	_ map[string]string,
	_, _, _ string,
	_ ...interface{},
)

func (*MockEventRecorder) Event added in v1.24.0

func (er *MockEventRecorder) Event(_ runtime.Object, _, _, _ string)

func (*MockEventRecorder) Eventf added in v1.24.0

func (er *MockEventRecorder) Eventf(
	_ runtime.Object,
	_, _, _ string,
	_ ...interface{},
)

Jump to

Keyboard shortcuts

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