ipam

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package ipam contains utilities for the Liqo IPAM module.

Index

Constants

View Source
const (
	IPAM_IPAcquire_FullMethodName          = "/IPAM/IPAcquire"
	IPAM_IPRelease_FullMethodName          = "/IPAM/IPRelease"
	IPAM_NetworkAcquire_FullMethodName     = "/IPAM/NetworkAcquire"
	IPAM_NetworkRelease_FullMethodName     = "/IPAM/NetworkRelease"
	IPAM_NetworkIsAvailable_FullMethodName = "/IPAM/NetworkIsAvailable"
)

Variables

View Source
var File_pkg_ipam_ipam_proto protoreflect.FileDescriptor
View Source
var IPAM_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "IPAM",
	HandlerType: (*IPAMServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "IPAcquire",
			Handler:    _IPAM_IPAcquire_Handler,
		},
		{
			MethodName: "IPRelease",
			Handler:    _IPAM_IPRelease_Handler,
		},
		{
			MethodName: "NetworkAcquire",
			Handler:    _IPAM_NetworkAcquire_Handler,
		},
		{
			MethodName: "NetworkRelease",
			Handler:    _IPAM_NetworkRelease_Handler,
		},
		{
			MethodName: "NetworkIsAvailable",
			Handler:    _IPAM_NetworkIsAvailable_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/ipam/ipam.proto",
}

IPAM_ServiceDesc is the grpc.ServiceDesc for IPAM service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterIPAMServer

func RegisterIPAMServer(s grpc.ServiceRegistrar, srv IPAMServer)

Types

type IPAMClient

type IPAMClient interface {
	IPAcquire(ctx context.Context, in *IPAcquireRequest, opts ...grpc.CallOption) (*IPAcquireResponse, error)
	IPRelease(ctx context.Context, in *IPReleaseRequest, opts ...grpc.CallOption) (*IPReleaseResponse, error)
	NetworkAcquire(ctx context.Context, in *NetworkAcquireRequest, opts ...grpc.CallOption) (*NetworkAcquireResponse, error)
	NetworkRelease(ctx context.Context, in *NetworkReleaseRequest, opts ...grpc.CallOption) (*NetworkReleaseResponse, error)
	NetworkIsAvailable(ctx context.Context, in *NetworkAvailableRequest, opts ...grpc.CallOption) (*NetworkAvailableResponse, error)
}

IPAMClient is the client API for IPAM service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewIPAMClient

func NewIPAMClient(cc grpc.ClientConnInterface) IPAMClient

type IPAMServer

type IPAMServer interface {
	IPAcquire(context.Context, *IPAcquireRequest) (*IPAcquireResponse, error)
	IPRelease(context.Context, *IPReleaseRequest) (*IPReleaseResponse, error)
	NetworkAcquire(context.Context, *NetworkAcquireRequest) (*NetworkAcquireResponse, error)
	NetworkRelease(context.Context, *NetworkReleaseRequest) (*NetworkReleaseResponse, error)
	NetworkIsAvailable(context.Context, *NetworkAvailableRequest) (*NetworkAvailableResponse, error)
	// contains filtered or unexported methods
}

IPAMServer is the server API for IPAM service. All implementations must embed UnimplementedIPAMServer for forward compatibility.

type IPAcquireRequest

type IPAcquireRequest struct {
	Cidr string `protobuf:"bytes,1,opt,name=cidr,proto3" json:"cidr,omitempty"`
	// contains filtered or unexported fields
}

func (*IPAcquireRequest) Descriptor deprecated

func (*IPAcquireRequest) Descriptor() ([]byte, []int)

Deprecated: Use IPAcquireRequest.ProtoReflect.Descriptor instead.

func (*IPAcquireRequest) GetCidr

func (x *IPAcquireRequest) GetCidr() string

func (*IPAcquireRequest) ProtoMessage

func (*IPAcquireRequest) ProtoMessage()

func (*IPAcquireRequest) ProtoReflect

func (x *IPAcquireRequest) ProtoReflect() protoreflect.Message

func (*IPAcquireRequest) Reset

func (x *IPAcquireRequest) Reset()

func (*IPAcquireRequest) String

func (x *IPAcquireRequest) String() string

type IPAcquireResponse

type IPAcquireResponse struct {
	Ip     string          `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
	Result *ResponseResult `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*IPAcquireResponse) Descriptor deprecated

func (*IPAcquireResponse) Descriptor() ([]byte, []int)

Deprecated: Use IPAcquireResponse.ProtoReflect.Descriptor instead.

func (*IPAcquireResponse) GetIp

func (x *IPAcquireResponse) GetIp() string

func (*IPAcquireResponse) GetResult

func (x *IPAcquireResponse) GetResult() *ResponseResult

func (*IPAcquireResponse) ProtoMessage

func (*IPAcquireResponse) ProtoMessage()

func (*IPAcquireResponse) ProtoReflect

func (x *IPAcquireResponse) ProtoReflect() protoreflect.Message

func (*IPAcquireResponse) Reset

func (x *IPAcquireResponse) Reset()

func (*IPAcquireResponse) String

func (x *IPAcquireResponse) String() string

type IPReleaseRequest

type IPReleaseRequest struct {
	Ip   string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
	Cidr string `protobuf:"bytes,2,opt,name=cidr,proto3" json:"cidr,omitempty"`
	// contains filtered or unexported fields
}

func (*IPReleaseRequest) Descriptor deprecated

func (*IPReleaseRequest) Descriptor() ([]byte, []int)

Deprecated: Use IPReleaseRequest.ProtoReflect.Descriptor instead.

func (*IPReleaseRequest) GetCidr

func (x *IPReleaseRequest) GetCidr() string

func (*IPReleaseRequest) GetIp

func (x *IPReleaseRequest) GetIp() string

func (*IPReleaseRequest) ProtoMessage

func (*IPReleaseRequest) ProtoMessage()

func (*IPReleaseRequest) ProtoReflect

func (x *IPReleaseRequest) ProtoReflect() protoreflect.Message

func (*IPReleaseRequest) Reset

func (x *IPReleaseRequest) Reset()

func (*IPReleaseRequest) String

func (x *IPReleaseRequest) String() string

type IPReleaseResponse

type IPReleaseResponse struct {
	Result *ResponseResult `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*IPReleaseResponse) Descriptor deprecated

func (*IPReleaseResponse) Descriptor() ([]byte, []int)

Deprecated: Use IPReleaseResponse.ProtoReflect.Descriptor instead.

func (*IPReleaseResponse) GetResult

func (x *IPReleaseResponse) GetResult() *ResponseResult

func (*IPReleaseResponse) ProtoMessage

func (*IPReleaseResponse) ProtoMessage()

func (*IPReleaseResponse) ProtoReflect

func (x *IPReleaseResponse) ProtoReflect() protoreflect.Message

func (*IPReleaseResponse) Reset

func (x *IPReleaseResponse) Reset()

func (*IPReleaseResponse) String

func (x *IPReleaseResponse) String() string

type LiqoIPAM

type LiqoIPAM struct {
	UnimplementedIPAMServer

	IpamCore *ipamcore.Ipam

	HealthServer *health.Server
	client.Client
	// contains filtered or unexported fields
}

LiqoIPAM is the struct implementing the IPAM interface.

func New

func New(ctx context.Context, cl client.Client, opts *ServerOptions) (*LiqoIPAM, error)

New creates a new instance of the LiqoIPAM.

func (*LiqoIPAM) IPAcquire

func (lipam *LiqoIPAM) IPAcquire(_ context.Context, req *IPAcquireRequest) (*IPAcquireResponse, error)

IPAcquire acquires a free IP from a given CIDR.

func (*LiqoIPAM) IPRelease

func (lipam *LiqoIPAM) IPRelease(_ context.Context, req *IPReleaseRequest) (*IPReleaseResponse, error)

IPRelease releases an IP from a given CIDR.

func (*LiqoIPAM) NetworkAcquire

func (lipam *LiqoIPAM) NetworkAcquire(_ context.Context, req *NetworkAcquireRequest) (*NetworkAcquireResponse, error)

NetworkAcquire acquires a network. If it is already reserved, it allocates and reserves a new free one with the same prefix length.

func (*LiqoIPAM) NetworkIsAvailable

func (lipam *LiqoIPAM) NetworkIsAvailable(_ context.Context, req *NetworkAvailableRequest) (*NetworkAvailableResponse, error)

NetworkIsAvailable checks if a network is available.

func (*LiqoIPAM) NetworkRelease

func (lipam *LiqoIPAM) NetworkRelease(_ context.Context, req *NetworkReleaseRequest) (*NetworkReleaseResponse, error)

NetworkRelease releases a network.

type NetworkAcquireRequest

type NetworkAcquireRequest struct {
	Cidr         string `protobuf:"bytes,1,opt,name=cidr,proto3" json:"cidr,omitempty"`
	Immutable    bool   `protobuf:"varint,2,opt,name=immutable,proto3" json:"immutable,omitempty"`       // If true, the network cannot be remapped. It will be allocated if available, or an error will be returned.
	PreAllocated uint32 `protobuf:"varint,3,opt,name=preAllocated,proto3" json:"preAllocated,omitempty"` // The number of IPs to pre-allocate (reserve) in the CIDR, starting from the first IP of the CIDR.
	// contains filtered or unexported fields
}

func (*NetworkAcquireRequest) Descriptor deprecated

func (*NetworkAcquireRequest) Descriptor() ([]byte, []int)

Deprecated: Use NetworkAcquireRequest.ProtoReflect.Descriptor instead.

func (*NetworkAcquireRequest) GetCidr

func (x *NetworkAcquireRequest) GetCidr() string

func (*NetworkAcquireRequest) GetImmutable

func (x *NetworkAcquireRequest) GetImmutable() bool

func (*NetworkAcquireRequest) GetPreAllocated

func (x *NetworkAcquireRequest) GetPreAllocated() uint32

func (*NetworkAcquireRequest) ProtoMessage

func (*NetworkAcquireRequest) ProtoMessage()

func (*NetworkAcquireRequest) ProtoReflect

func (x *NetworkAcquireRequest) ProtoReflect() protoreflect.Message

func (*NetworkAcquireRequest) Reset

func (x *NetworkAcquireRequest) Reset()

func (*NetworkAcquireRequest) String

func (x *NetworkAcquireRequest) String() string

type NetworkAcquireResponse

type NetworkAcquireResponse struct {
	Cidr   string          `protobuf:"bytes,1,opt,name=cidr,proto3" json:"cidr,omitempty"`
	Result *ResponseResult `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*NetworkAcquireResponse) Descriptor deprecated

func (*NetworkAcquireResponse) Descriptor() ([]byte, []int)

Deprecated: Use NetworkAcquireResponse.ProtoReflect.Descriptor instead.

func (*NetworkAcquireResponse) GetCidr

func (x *NetworkAcquireResponse) GetCidr() string

func (*NetworkAcquireResponse) GetResult

func (x *NetworkAcquireResponse) GetResult() *ResponseResult

func (*NetworkAcquireResponse) ProtoMessage

func (*NetworkAcquireResponse) ProtoMessage()

func (*NetworkAcquireResponse) ProtoReflect

func (x *NetworkAcquireResponse) ProtoReflect() protoreflect.Message

func (*NetworkAcquireResponse) Reset

func (x *NetworkAcquireResponse) Reset()

func (*NetworkAcquireResponse) String

func (x *NetworkAcquireResponse) String() string

type NetworkAvailableRequest

type NetworkAvailableRequest struct {
	Cidr string `protobuf:"bytes,1,opt,name=cidr,proto3" json:"cidr,omitempty"`
	// contains filtered or unexported fields
}

func (*NetworkAvailableRequest) Descriptor deprecated

func (*NetworkAvailableRequest) Descriptor() ([]byte, []int)

Deprecated: Use NetworkAvailableRequest.ProtoReflect.Descriptor instead.

func (*NetworkAvailableRequest) GetCidr

func (x *NetworkAvailableRequest) GetCidr() string

func (*NetworkAvailableRequest) ProtoMessage

func (*NetworkAvailableRequest) ProtoMessage()

func (*NetworkAvailableRequest) ProtoReflect

func (x *NetworkAvailableRequest) ProtoReflect() protoreflect.Message

func (*NetworkAvailableRequest) Reset

func (x *NetworkAvailableRequest) Reset()

func (*NetworkAvailableRequest) String

func (x *NetworkAvailableRequest) String() string

type NetworkAvailableResponse

type NetworkAvailableResponse struct {
	Available bool            `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"`
	Result    *ResponseResult `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*NetworkAvailableResponse) Descriptor deprecated

func (*NetworkAvailableResponse) Descriptor() ([]byte, []int)

Deprecated: Use NetworkAvailableResponse.ProtoReflect.Descriptor instead.

func (*NetworkAvailableResponse) GetAvailable

func (x *NetworkAvailableResponse) GetAvailable() bool

func (*NetworkAvailableResponse) GetResult

func (x *NetworkAvailableResponse) GetResult() *ResponseResult

func (*NetworkAvailableResponse) ProtoMessage

func (*NetworkAvailableResponse) ProtoMessage()

func (*NetworkAvailableResponse) ProtoReflect

func (x *NetworkAvailableResponse) ProtoReflect() protoreflect.Message

func (*NetworkAvailableResponse) Reset

func (x *NetworkAvailableResponse) Reset()

func (*NetworkAvailableResponse) String

func (x *NetworkAvailableResponse) String() string

type NetworkReleaseRequest

type NetworkReleaseRequest struct {
	Cidr string `protobuf:"bytes,1,opt,name=cidr,proto3" json:"cidr,omitempty"`
	// contains filtered or unexported fields
}

func (*NetworkReleaseRequest) Descriptor deprecated

func (*NetworkReleaseRequest) Descriptor() ([]byte, []int)

Deprecated: Use NetworkReleaseRequest.ProtoReflect.Descriptor instead.

func (*NetworkReleaseRequest) GetCidr

func (x *NetworkReleaseRequest) GetCidr() string

func (*NetworkReleaseRequest) ProtoMessage

func (*NetworkReleaseRequest) ProtoMessage()

func (*NetworkReleaseRequest) ProtoReflect

func (x *NetworkReleaseRequest) ProtoReflect() protoreflect.Message

func (*NetworkReleaseRequest) Reset

func (x *NetworkReleaseRequest) Reset()

func (*NetworkReleaseRequest) String

func (x *NetworkReleaseRequest) String() string

type NetworkReleaseResponse

type NetworkReleaseResponse struct {
	Result *ResponseResult `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*NetworkReleaseResponse) Descriptor deprecated

func (*NetworkReleaseResponse) Descriptor() ([]byte, []int)

Deprecated: Use NetworkReleaseResponse.ProtoReflect.Descriptor instead.

func (*NetworkReleaseResponse) GetResult

func (x *NetworkReleaseResponse) GetResult() *ResponseResult

func (*NetworkReleaseResponse) ProtoMessage

func (*NetworkReleaseResponse) ProtoMessage()

func (*NetworkReleaseResponse) ProtoReflect

func (x *NetworkReleaseResponse) ProtoReflect() protoreflect.Message

func (*NetworkReleaseResponse) Reset

func (x *NetworkReleaseResponse) Reset()

func (*NetworkReleaseResponse) String

func (x *NetworkReleaseResponse) String() string

type Options

type Options struct {
	EnableLeaderElection    bool
	LeaderElectionNamespace string
	LeaderElectionName      string
	LeaseDuration           time.Duration
	RenewDeadline           time.Duration
	RetryPeriod             time.Duration
	PodName                 string
	DeploymentName          string

	ServerOpts ServerOptions
}

Options contains the options for the ipam pod.

type ResponseResult

type ResponseResult struct {
	// contains filtered or unexported fields
}

func (*ResponseResult) Descriptor deprecated

func (*ResponseResult) Descriptor() ([]byte, []int)

Deprecated: Use ResponseResult.ProtoReflect.Descriptor instead.

func (*ResponseResult) ProtoMessage

func (*ResponseResult) ProtoMessage()

func (*ResponseResult) ProtoReflect

func (x *ResponseResult) ProtoReflect() protoreflect.Message

func (*ResponseResult) Reset

func (x *ResponseResult) Reset()

func (*ResponseResult) String

func (x *ResponseResult) String() string

type ServerOptions

type ServerOptions struct {
	Pools           []string
	Port            int
	SyncInterval    time.Duration
	SyncGracePeriod time.Duration
	GraphvizEnabled bool
}

ServerOptions contains the options to configure the IPAM server.

type UnimplementedIPAMServer

type UnimplementedIPAMServer struct{}

UnimplementedIPAMServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedIPAMServer) IPAcquire

func (UnimplementedIPAMServer) IPRelease

func (UnimplementedIPAMServer) NetworkAcquire

func (UnimplementedIPAMServer) NetworkIsAvailable

func (UnimplementedIPAMServer) NetworkRelease

type UnsafeIPAMServer

type UnsafeIPAMServer interface {
	// contains filtered or unexported methods
}

UnsafeIPAMServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to IPAMServer will result in compilation errors.

Directories

Path Synopsis
Package ipamcore provides the core functionality for the IPAM service.
Package ipamcore provides the core functionality for the IPAM service.

Jump to

Keyboard shortcuts

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