cptp

command
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: 19 Imported by: 0

README


title: ptp plugin description: "plugins/main/ptp/README.md" date: 2020-11-02 toc: true draft: false weight: 200

cptp

cce 定制ptp,定制功能如下:

  1. 新增容器内静态邻居表项,以主机端的veth的mac地址作为网关的邻居表项。
  2. 容器内默认路由始终设置IPAM返回的gateway,并主动为gateway设置onlink路由,兼容IPAM响应的没有子网的地址。
  3. 新增主机上到容器的静态邻居表项,邻居项加到host端的veth设备上,目的mac地址是容器内的veth的mac。

概述

ptp插件通过使用veth设备在容器和主机之间创建点对点链接。 veth对的一端放置在容器内,另一端位于主机上。 host-local IPAM插件可用于为容器分配IP地址。 容器接口的流量将通过主机的接口进行路由。

说明1: 为兼容Calico Felix NetworkPolicy, 当前cptp插件创建host veth时仍按照V1的11字符命名规范. 后续会改为与原始ptp相同的8字符命名规范.

配置示例

{
	"name": "mynet",
	"type": "ptp",
	"ipam": {
		"type": "host-local",
		"subnet": "10.1.1.0/24"
	},
	"dns": {
		"nameservers": [ "10.1.1.1", "8.8.8.8" ]
	},
	"capabilities": {
		"bandwidth": {
			"enable": true,
			"mode": "tc"
		},
		"bpf-netns-allerate":{
			"enable": true
		}
	}
}

Network configuration reference

  • name (string, required): the name of the network
  • type (string, required): "ptp"
  • ipMasq (boolean, optional): set up IP Masquerade on the host for traffic originating from ip of this network and destined outside of this network. Defaults to false.
  • mtu (integer, optional): explicitly set MTU to the specified value. Defaults to value chosen by the kernel.
  • ipam (dictionary, required): IPAM configuration to be used for this network.
  • dns (dictionary, optional): DNS information to return as described in the Result.

原始代码地址

https://github.com/containernetworking/plugins/blob/4a6147a1552064af80b4f7567b30c5174153c62a/plugins/main/ptp/ptp.go

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. *

Jump to

Keyboard shortcuts

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