vpceni

package
v0.0.0-...-686bfca Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Overview

* Copyright (c) 2023 Baidu, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. *

* Copyright (c) 2023 Baidu, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. *

* Copyright (c) 2023 Baidu, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. *

* Copyright (c) 2023 Baidu, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. *

* Copyright (c) 2023 Baidu, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. *

* Copyright (c) 2023 Baidu, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. *

Index

Constants

View Source
const (
	DayDuration = 24 * time.Hour
)

Variables

This section is empty.

Functions

func CreateNameForENI

func CreateNameForENI(clusterID, instanceID, nodeName string) string

CreateNameForENI creates name for newly created eni

func NewNode

func NewNode(node *ipam.NetResource, k8sObj *ccev2.NetResourceSet, manager *InstancesManager) *bceNode

NewNode returns a new Node

Types

type BCEAllocatorProvider

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

func (*BCEAllocatorProvider) Init

func (provider *BCEAllocatorProvider) Init(ctx context.Context) error

Init implements allocator.AllocatorProvider

func (*BCEAllocatorProvider) Start

Start implements allocator.AllocatorProvider

func (*BCEAllocatorProvider) StartEndpointManager

func (provider *BCEAllocatorProvider) StartEndpointManager(ctx context.Context, getterUpdater endpoint.CCEEndpointGetterUpdater) (endpoint.EndpointEventHandler, error)

StartEndpointManager implements endpoint.DirectAllocatorStarter

type ENIQuotaManager

type ENIQuotaManager interface {
	GetMaxENI() int
	SetMaxENI(max int)
	GetMaxIP() int
	SetMaxIP(max int)

	// SyncCapacity syncs node capacity
	SyncCapacityToK8s(ctx context.Context) error
}

ENIQuotaManager SyncCapacity syncs node capacity

type InstancesManager

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

InstancesManager maintains the list of instances. It must be kept up to date by calling resync() regularly.

func (*InstancesManager) CreateNetResource

CreateNetResource is called when the IPAM layer has learned about a new node which requires IPAM services. This function must return a NodeOperations implementation which will render IPAM services to the node context provided.

func (*InstancesManager) FindSubnetByIDs

func (m *InstancesManager) FindSubnetByIDs(vpcID, availabilityZone string, subnetIDs []string) (bestSubnet *ccev1.Subnet)

FindSubnetByIDs returns the subnet with the most addresses matching VPC ID, availability zone within a provided list of subnet ids

The returned subnet is immutable so it can be safely accessed

func (*InstancesManager) ForeachInstance

func (m *InstancesManager) ForeachInstance(instanceID string, fn ipamTypes.InterfaceIterator) error

ForeachInstance will iterate over each instance inside `instances`, and call `fn`. This function is read-locked for the entire execution.

func (*InstancesManager) GetPoolQuota

func (m *InstancesManager) GetPoolQuota() ipamTypes.PoolQuotaMap

GetPoolQuota returns the number of available IPs in all IP pools

func (*InstancesManager) HandlerVPCError

func (m *InstancesManager) HandlerVPCError(scopedLog *logrus.Entry, vpcError error, subnetID string) (retError error)

HandlerVPCError handles the error returned by the VPC API

func (*InstancesManager) NodeEndpoint

NodeEndpoint implements endpoint.DirectIPAllocator

func (*InstancesManager) Resync

func (m *InstancesManager) Resync(ctx context.Context) time.Time

Resync is called periodically to give the IPAM implementation a chance to resync its own state with external APIs or systems. It is also called when the IPAM layer detects that state got out of sync.

func (*InstancesManager) ResyncPool

func (*InstancesManager) ResyncPool(ctx context.Context, scopedLog *logrus.Entry) (map[string]ipamTypes.AllocationMap, error)

ResyncPool implements endpoint.DirectIPAllocator

Jump to

Keyboard shortcuts

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