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
- func CreateNameForENI(clusterID, instanceID, nodeName string) string
- func NewBCENetworkResourceSet(node *ipam.NetResource, k8sObj *ccev2.NetResourceSet, ...) *bceNetworkResourceSet
- type BCEAllocatorProvider
- func (provider *BCEAllocatorProvider) Init(ctx context.Context) error
- func (provider *BCEAllocatorProvider) Start(ctx context.Context, getterUpdater ipam.NetResourceSetGetterUpdater) (allocator.NetResourceSetEventHandler, error)
- func (provider *BCEAllocatorProvider) StartEndpointManager(ctx context.Context, getterUpdater endpoint.CCEEndpointGetterUpdater) (endpoint.EndpointEventHandler, error)
- type ENIQuotaManager
- type InstancesManager
- func (m *InstancesManager) CreateNetResource(obj *ccev2.NetResourceSet, node *ipam.NetResource) ipam.NetResourceOperations
- func (m *InstancesManager) ForeachInstance(instanceID, nodeName string, fn ipamTypes.InterfaceIterator) error
- func (m *InstancesManager) GetPoolQuota() ipamTypes.PoolQuotaMap
- func (m *InstancesManager) HandlerVPCError(scopedLog *logrus.Entry, vpcError error, subnetID string) (retError error)
- func (m *InstancesManager) NodeEndpoint(cep *ccev2.CCEEndpoint) (endpoint.DirectEndpointOperation, error)
- func (m *InstancesManager) Resync(ctx context.Context) time.Time
- func (*InstancesManager) ResyncPool(ctx context.Context, scopedLog *logrus.Entry) (map[string]ipamTypes.AllocationMap, error)
- type VpcEniNetResourceSetEventHandler
- func (handler *VpcEniNetResourceSetEventHandler) Create(resource *ccev2.NetResourceSet) error
- func (handler *VpcEniNetResourceSetEventHandler) Delete(netResourceSetName string) error
- func (handler *VpcEniNetResourceSetEventHandler) ResourceType() string
- func (handler *VpcEniNetResourceSetEventHandler) Resync(context.Context, time.Time)
- func (handler *VpcEniNetResourceSetEventHandler) Update(resource *ccev2.NetResourceSet) error
Constants ¶
const (
DayDuration = 24 * time.Hour
)
Variables ¶
This section is empty.
Functions ¶
func CreateNameForENI ¶
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 ¶
func (provider *BCEAllocatorProvider) Start(ctx context.Context, getterUpdater ipam.NetResourceSetGetterUpdater) (allocator.NetResourceSetEventHandler, error)
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 ¶
func (m *InstancesManager) CreateNetResource(obj *ccev2.NetResourceSet, node *ipam.NetResource) ipam.NetResourceOperations
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 ¶
func (m *InstancesManager) NodeEndpoint(cep *ccev2.CCEEndpoint) (endpoint.DirectEndpointOperation, error)
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 ¶
func (handler *VpcEniNetResourceSetEventHandler) Resync(context.Context, time.Time)
Resync implements allocator.NetResourceSetEventHandler
func (*VpcEniNetResourceSetEventHandler) Update ¶
func (handler *VpcEniNetResourceSetEventHandler) Update(resource *ccev2.NetResourceSet) error
Update implements allocator.NetResourceSetEventHandler