This repository was archived by the owner on Apr 8, 2025. It is now read-only.
File tree 2 files changed +45
-6
lines changed
2 files changed +45
-6
lines changed Original file line number Diff line number Diff line change @@ -5,26 +5,37 @@ 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 all - build push and deploy to kubernetes"
16
18
17
19
build :
18
20
@$(IMAGE_BUILDER ) build . -f ./docker/userspacecni/Dockerfile -t $(IMAGE_NAME )
19
21
20
- deploy :
22
+ push :
23
+ @$(IMAGE_BUILDER ) push $(IMAGE_NAME )
24
+
25
+ copy :
21
26
# Copying the ovs binary to host /opt/cni/bin/
22
27
@mkdir -p /opt/cni/bin/
23
28
@$(IMAGE_BUILDER ) run -it --rm -v /opt/cni/bin/:/opt/cni/bin/ $(IMAGE_NAME )
24
29
25
30
generate-bin : generate
31
+ # Used in dockerfile
26
32
@cd userspace && go build -v
27
33
28
34
generate :
29
- for package in cnivpp/api/* ; do cd $$ package ; pwd ; go generate ; cd - ; done
35
+ # Used in dockerfile
36
+ @for package in cnivpp/api/* ; do cd $$ package ; pwd ; go generate ; cd - ; done
37
+
38
+ deploy :
39
+ # Use sed to replace image name and then apply deployment file
40
+ @sed " s|\(image:\).*\(#registory\)|\1 $( IMAGE_NAME) \2|g" ./kubernetes/userspace-daemonset.yml | kubectl apply -f -
30
41
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