https://github.com/withlin/macvlan-ipam-etcd
a macvlan ipam with etcd
https://github.com/withlin/macvlan-ipam-etcd
Last synced: 12 months ago
JSON representation
a macvlan ipam with etcd
- Host: GitHub
- URL: https://github.com/withlin/macvlan-ipam-etcd
- Owner: withlin
- License: apache-2.0
- Created: 2021-02-25T11:06:32.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-01T10:44:26.000Z (about 5 years ago)
- Last Synced: 2025-04-19T21:44:28.592Z (about 1 year ago)
- Language: Go
- Size: 37.1 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# macvlan-ipam-etcd
a macvlan ipam with etcd
## 背景
解决macvlan使用hostlocal分配ip的ip冲突导致各种个样的bug
## 如何构建
```golang
go build
```
## 目前简单如何使用
```shell
mv macvlan-ipam-etcd /opt/cni/bin/
```
### 测试
```text
echo '{ "cniVersion": "0.3.1", "name": "examplenet", "ipam": { "name": "myetcd-ipam", "type": "macvlan-ipam-etcd", "etcdConfig": { "etcdURL": "http://127.0.0.1:2379"}, "ranges": [ [{"subnet": "203.0.113.0/24"}]] } }' | CNI_COMMAND=ADD CNI_CONTAINERID=example CNI_NETNS=/dev/null CNI_IFNAME=dummy0 CNI_PATH=. ./macvlan-ipam-etcd
```
### 利用libcni调用macvlan教程
```text
cat >/etc/cni/net.d/10-macvlan-etcd.conf < mtu 65536 qdisc noop state DOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0@if2: mtu 1500 qdisc noqueue state UP group default
link/ether e6:97:d2:de:e9:c8 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.22.0.2/16 brd 10.22.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::e497:d2ff:fede:e9c8/64 scope link
valid_lft forever preferred_lft forever
```
### 后续支持
使用Daemonset的方式,部署到容器云。
# macvlan-ipam-etcd
a macvlan ipam with etcd
## 背景
解决macvlan使用hostlocal分配ip的ip冲突导致各种个样的bug
## 如何构建
```golang
go build
```
## 目前简单如何使用
```shell
mv macvlan-ipam-etcd /opt/cni/bin/
```
### 测试
```text
echo '{ "cniVersion": "0.3.1", "name": "examplenet", "ipam": { "name": "myetcd-ipam", "type": "macvlan-ipam-etcd", "etcdConfig": { "etcdURL": "http://127.0.0.1:2379"}, "ranges": [ [{"subnet": "203.0.113.0/24"}]] } }' | CNI_COMMAND=ADD CNI_CONTAINERID=example CNI_NETNS=/dev/null CNI_IFNAME=dummy0 CNI_PATH=. ./macvlan-ipam-etcd
```
### 利用libcni调用macvlan教程
```text
cat >/etc/cni/net.d/10-macvlan-etcd.conf < mtu 65536 qdisc noop state DOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0@if2: mtu 1500 qdisc noqueue state UP group default
link/ether e6:97:d2:de:e9:c8 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.22.0.2/16 brd 10.22.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::e497:d2ff:fede:e9c8/64 scope link
valid_lft forever preferred_lft forever
```
### 后续支持
1. 使用Daemonset的方式,部署到容器云。
2. 支持读取Pod的Anno动态注解