This repository was archived by the owner on Apr 8, 2025. It is now read-only.
File tree 2 files changed +48
-6
lines changed
2 files changed +48
-6
lines changed Original file line number Diff line number Diff line change @@ -5,26 +5,40 @@ IMAGE_BUILDER?=docker
5
5
IMAGE_NAME? =$(IMAGE_REGISTRY ) userspacecni:$(IMAGE_VERSION )
6
6
7
7
default : build
8
- all : build deploy
9
-
8
+ local : build copy
9
+ all : build push deploy
10
10
11
11
help :
12
12
@echo " Make Targets:"
13
13
@echo " make build - Build UserSpace CNI container."
14
- @echo " make deploy - Copy binary from container to host: /opt/cni/bin."
15
- @echo " make all - build and deploy"
14
+ @echo " make copy - Copy binary from container to host:/opt/cni/bin."
15
+ @echo " make local - build and copy"
16
+ @echo " make deploy - kubectl apply daemonset"
17
+ @echo " make undeploy - kubectl delete daemonset"
18
+ @echo " make all - build push and deploy to kubernetes"
16
19
17
20
build :
18
21
@$(IMAGE_BUILDER ) build . -f ./docker/userspacecni/Dockerfile -t $(IMAGE_NAME )
19
22
20
- deploy :
23
+ push :
24
+ @$(IMAGE_BUILDER ) push $(IMAGE_NAME )
25
+
26
+ copy :
21
27
# Copying the ovs binary to host /opt/cni/bin/
22
28
@mkdir -p /opt/cni/bin/
23
29
@$(IMAGE_BUILDER ) run -it --rm -v /opt/cni/bin/:/opt/cni/bin/ $(IMAGE_NAME )
24
30
25
31
generate-bin : generate
32
+ # Used in dockerfile
26
33
@cd userspace && go build -v
27
34
28
35
generate :
29
- for package in cnivpp/api/* ; do cd $$ package ; pwd ; go generate ; cd - ; done
36
+ # Used in dockerfile
37
+ @for package in cnivpp/api/* ; do cd $$ package ; pwd ; go generate ; cd - ; done
38
+
39
+ deploy :
40
+ # Use sed to replace image name and then apply deployment file
41
+ @sed " s|\(image:\).*\(#registory\)|\1 $( IMAGE_NAME) \2|g" ./kubernetes/userspace-daemonset.yml | kubectl apply -f -
30
42
43
+ undeploy :
44
+ kubectl delete -f ./kubernetes/userspace-daemonset.yml
Original file line number Diff line number Diff line change
1
+ ---
2
+ apiVersion : apps/v1
3
+ kind : DaemonSet
4
+ metadata :
5
+ name : userspace-cni
6
+ namespace : kube-system
7
+ spec :
8
+ selector :
9
+ matchLabels :
10
+ app : userspace-cni
11
+ template :
12
+ metadata :
13
+ labels :
14
+ app : userspace-cni
15
+ spec :
16
+ containers :
17
+ - name : userspace-cni-plugin
18
+ image : localhost:5000/userspacecni # registory:imagename
19
+ imagePullPolicy : IfNotPresent
20
+ volumeMounts :
21
+ - name : cnibin
22
+ mountPath : /opt/cni/bin
23
+ command : ["/bin/sh","-c"]
24
+ args : ["cp -rf /root/userspace-cni-network-plugin/userspace/userspace /opt/cni/bin; sleep inf"]
25
+ volumes :
26
+ - name : cnibin
27
+ hostPath :
28
+ path : /opt/cni/bin
You can’t perform that action at this time.
0 commit comments