vpceni

package
v0.0.0-...-ec72bf4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 52 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 NewBCENetworkResourceSet

func NewBCENetworkResourceSet(node *ipam.NetResource, k8sObj *ccev2.NetResourceSet, manager *InstancesManager) *bceNetworkResourceSet

NewBCENetworkResourceSet returns a new *bceNetworkResourceSet

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
	RefreshEniCapacityToK8s(ctx context.Context, maxENINum, maxIPNum int) 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) ForeachInstance

func (m *InstancesManager) ForeachInstance(instanceID, nodeName 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

type VpcEniNetResourceSetEventHandler

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

func (*VpcEniNetResourceSetEventHandler) Create

func (handler *VpcEniNetResourceSetEventHandler) Create(resource *ccev2.NetResourceSet) error

Create implements allocator.NetResourceSetEventHandler

func (*VpcEniNetResourceSetEventHandler) Delete

func (handler *VpcEniNetResourceSetEventHandler) Delete(netResourceSetName string) error

Delete implements allocator.NetResourceSetEventHandler

func (*VpcEniNetResourceSetEventHandler) ResourceType

func (handler *VpcEniNetResourceSetEventHandler) ResourceType() string

func (*VpcEniNetResourceSetEventHandler) Resync

Resync implements allocator.NetResourceSetEventHandler

func (*VpcEniNetResourceSetEventHandler) Update

func (handler *VpcEniNetResourceSetEventHandler) Update(resource *ccev2.NetResourceSet) error

Update implements allocator.NetResourceSetEventHandler

Jump to

Keyboard shortcuts

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