Skip to content

Commit 1251cb4

Browse files
committed
chore: add cni-vpc-node image
1 parent 892c5e1 commit 1251cb4

File tree

5 files changed

+98
-6
lines changed

5 files changed

+98
-6
lines changed

.github/workflows/release.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,33 @@ jobs:
2929
with:
3030
go-version: 1.20.5
3131

32+
- name: Build cnivpc
33+
run: DEPLOY=true make cnivpc
34+
3235
- name: Build ipamd
3336
run: DEPLOY=true make ipamd
3437

3538
- name: Build vip-controller
3639
run: DEPLOY=true make vip-controller
3740

38-
- name: Build cni
39-
run: make cni
40-
4141
- name: Package cni
4242
run: >
4343
tar -cv
4444
LICENSE README.md
4545
-C bin/ cnivpc cnivpctl
46+
-C config/ 10-cnivpc.conf
4647
| gzip --best
4748
> 'uk8s-cni-vpc_${{ steps.get_version.outputs.VERSION }}.tar.gz'
4849
4950
- name: Create release
5051
uses: softprops/action-gh-release@v1
5152
with:
5253
draft: true
54+
body: |
55+
## Docker Images
56+
57+
- uhub.service.ucloud.cn/uk8s/cni-vpc-node:${{ steps.get_version.outputs.VERSION }}
58+
- uhub.service.ucloud.cn/uk8s/cni-vpc-ipamd:${{ steps.get_version.outputs.VERSION }}
59+
- uhub.service.ucloud.cn/uk8s/vip-controller:${{ steps.get_version.outputs.VERSION }}
5360
files: |
5461
*.tar.gz

Makefile

+10-3
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@ DOCKER_TEST_BUCKET=uhub.service.ucloud.cn/wxyz
2424
DOCKER_LABEL:=$(if $(DEPLOY),$(CNI_VERSION),dev-$(COMMIT_ID_SHORT))
2525
DOCKER_BUCKET:=$(if $(DEPLOY),$(DOCKER_DEPLOY_BUCKET),$(DOCKER_TEST_BUCKET))
2626

27+
CNIVPC_IMAGE:=$(DOCKER_BUCKET)/cni-vpc-node:$(DOCKER_LABEL)
2728
IPAMD_IMAGE:=$(DOCKER_BUCKET)/cni-vpc-ipamd:$(DOCKER_LABEL)
2829
VIP_CONTROLLER_IMAGE:=$(DOCKER_BUCKET)/vip-controller:$(DOCKER_LABEL)
2930

3031
DOCKER_CMD:=$(if $(DOCKER_CMD),$(DOCKER_CMD),docker)
3132

32-
all: cni
33+
all: cnivpc
3334

34-
.PHONY: cni
35-
cni:
35+
.PHONY: cnivpc-bin
36+
cnivpc-bin:
3637
go build ${LDFLAGS} -o ./bin/cnivpc ./cmd/cnivpc
3738
go build ${LDFLAGS} -o ./bin/cnivpctl ./cmd/cnivpctl
3839

40+
.PHONY: cnivpc
41+
cnivpc: cnivpc-bin
42+
$(DOCKER_CMD) build -t $(CNIVPC_IMAGE) -f dockerfiles/cnivpc/Dockerfile .
43+
$(DOCKER_CMD) push $(CNIVPC_IMAGE)
44+
@echo "Build done: $(CNIVPC_IMAGE)"
45+
3946
.PHONY: ipamd
4047
ipamd:
4148
go build ${LDFLAGS} -o ./bin/cnivpc-ipamd ./cmd/cnivpc-ipamd

deploy/node.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: cni-vpc-node
5+
namespace: kube-system
6+
labels:
7+
app: "cni-vpc-node"
8+
spec:
9+
selector:
10+
matchLabels:
11+
app: "cni-vpc-node"
12+
template:
13+
metadata:
14+
labels:
15+
app: "cni-vpc-node"
16+
spec:
17+
tolerations:
18+
- key: CriticalAddonsOnly
19+
operator: Exists
20+
- key: dedicated
21+
operator: Exists
22+
- effect: NoSchedule
23+
key: node.cloudprovider.kubernetes.io/uninitialized
24+
value: "true"
25+
hostNetwork: true
26+
priorityClassName: system-node-critical
27+
hostPID: true
28+
containers:
29+
- name: cni-vpc-node
30+
image: uhub.service.ucloud.cn/uk8s/cni-vpc-node:1.0.1
31+
securityContext:
32+
privileged: true
33+
imagePullPolicy: "Always"
34+
volumeMounts:
35+
- name: host-cni
36+
mountPath: /opt/cni/
37+
- name: host-bin
38+
mountPath: /host-bin
39+
- name: host-log
40+
mountPath: /var/log
41+
readOnly: true
42+
volumes:
43+
- name: host-cni
44+
hostPath:
45+
path: /opt/cni
46+
- name: host-bin
47+
hostPath:
48+
path: /usr/local/bin
49+
- name: host-log
50+
hostPath:
51+
path: /var/log

dockerfiles/cnivpc/Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM alpine:latest
2+
3+
COPY bin/cnivpc /usr/local/bin/
4+
COPY bin/cnivpctl /usr/local/bin/
5+
COPY scripts/cnivpc-docker-entrypoint.sh /entrypoint.sh
6+
COPY config/10-cnivpc.conf /10-cnivpc.conf
7+
8+
ENTRYPOINT [ "/entrypoint.sh" ]

scripts/cnivpc-docker-entrypoint.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
if [[ -d /opt/cni ]]; then
4+
cp -f /usr/local/bin/cnivpc /opt/cni/bin/cnivpc
5+
cp -f /10-cnivpc.conf /opt/cni/net.d/10-cnivpc.conf
6+
fi
7+
8+
if [[ -d /host-bin ]]; then
9+
cp -f /usr/local/bin/cnivpctl /host-bin/cnivpctl
10+
fi
11+
12+
while true; do
13+
if [[ ! -f "/var/log/cnivpc.log" ]]; then
14+
echo "waitting for cnivpc logs..."
15+
sleep 3
16+
continue
17+
fi
18+
tail -f /var/log/cnivpc.log
19+
done

0 commit comments

Comments
 (0)