Skip to content

Commit b40c35b

Browse files
authored
Makefile: add deepflow and kwok installation (#3036)
1 parent 5a0686b commit b40c35b

8 files changed

+131
-18
lines changed

.github/workflows/build-windows.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ concurrency:
2323

2424
env:
2525
GO_VERSION: '1.20.5'
26-
GOSEC_VERSION: '2.15.0'
26+
GOSEC_VERSION: '2.16.0'
2727

2828
jobs:
2929
filter:

.github/workflows/build-x86-image.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ concurrency:
2222

2323
env:
2424
GO_VERSION: '1.20.5'
25-
GOSEC_VERSION: '2.15.0'
26-
HELM_VERSION: v3.11.3
27-
SUBMARINER_VERSION: '0.14.3'
25+
GOSEC_VERSION: '2.16.0'
26+
HELM_VERSION: v3.12.2
27+
SUBMARINER_VERSION: '0.14.6'
2828

2929
jobs:
3030
build-kube-ovn-base:

.github/workflows/scheduled-e2e.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ concurrency:
1111

1212
env:
1313
GO_VERSION: '1.20.5'
14-
HELM_VERSION: v3.11.3
15-
SUBMARINER_VERSION: '0.14.3'
14+
HELM_VERSION: v3.12.2
15+
SUBMARINER_VERSION: '0.14.6'
1616

1717
jobs:
1818
k8s-conformance-e2e:

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ ovn.yaml
1515
ovn-ic-0.yaml
1616
ovn-ic-1.yaml
1717
kind.yaml
18+
kustomization.yaml
19+
kwok.yaml
20+
kwok-node.yaml
1821
broker-info.subm
1922
broker-info.subm.*
2023
broker-info-internal.subm

Makefile

+60-12
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ CHART_UPGRADE_RESTART_OVS=$(shell echo $${CHART_UPGRADE_RESTART_OVS:-false})
2525
MULTUS_IMAGE = ghcr.io/k8snetworkplumbingwg/multus-cni:snapshot-thick
2626
MULTUS_YAML = https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/deployments/multus-daemonset-thick.yml
2727

28-
KUBEVIRT_VERSION = v0.58.1
28+
KUBEVIRT_VERSION = v0.59.2
2929
KUBEVIRT_OPERATOR_IMAGE = quay.io/kubevirt/virt-operator:$(KUBEVIRT_VERSION)
3030
KUBEVIRT_API_IMAGE = quay.io/kubevirt/virt-api:$(KUBEVIRT_VERSION)
3131
KUBEVIRT_CONTROLLER_IMAGE = quay.io/kubevirt/virt-controller:$(KUBEVIRT_VERSION)
@@ -36,23 +36,31 @@ KUBEVIRT_OPERATOR_YAML = https://github.com/kubevirt/kubevirt/releases/download/
3636
KUBEVIRT_CR_YAML = https://github.com/kubevirt/kubevirt/releases/download/$(KUBEVIRT_VERSION)/kubevirt-cr.yaml
3737
KUBEVIRT_TEST_YAML = https://kubevirt.io/labs/manifests/vm.yaml
3838

39-
CILIUM_VERSION = 1.12.9
39+
CILIUM_VERSION = 1.13.4
4040
CILIUM_IMAGE_REPO = quay.io/cilium/cilium
4141

42-
CERT_MANAGER_VERSION = v1.11.1
42+
CERT_MANAGER_VERSION = v1.12.2
4343
CERT_MANAGER_CONTROLLER = quay.io/jetstack/cert-manager-controller:$(CERT_MANAGER_VERSION)
4444
CERT_MANAGER_CAINJECTOR = quay.io/jetstack/cert-manager-cainjector:$(CERT_MANAGER_VERSION)
4545
CERT_MANAGER_WEBHOOK = quay.io/jetstack/cert-manager-webhook:$(CERT_MANAGER_VERSION)
4646
CERT_MANAGER_YAML = https://github.com/cert-manager/cert-manager/releases/download/$(CERT_MANAGER_VERSION)/cert-manager.yaml
4747

48-
SUBMARINER_VERSION = $(shell echo $${SUBMARINER_VERSION:-0.14.3})
48+
SUBMARINER_VERSION = $(shell echo $${SUBMARINER_VERSION:-0.14.6})
4949
SUBMARINER_OPERATOR = quay.io/submariner/submariner-operator:$(SUBMARINER_VERSION)
5050
SUBMARINER_GATEWAY = quay.io/submariner/submariner-gateway:$(SUBMARINER_VERSION)
5151
SUBMARINER_LIGHTHOUSE_AGENT = quay.io/submariner/lighthouse-agent:$(SUBMARINER_VERSION)
5252
SUBMARINER_LIGHTHOUSE_COREDNS = quay.io/submariner/lighthouse-coredns:$(SUBMARINER_VERSION)
5353
SUBMARINER_ROUTE_AGENT = quay.io/submariner/submariner-route-agent:$(SUBMARINER_VERSION)
5454
SUBMARINER_NETTEST = quay.io/submariner/nettest:$(SUBMARINER_VERSION)
5555

56+
DEEPFLOW_CHART_VERSION = 6.2.6
57+
DEEPFLOW_CHART_REPO = https://deepflow-ce.oss-cn-beijing.aliyuncs.com/chart/stable
58+
DEEPFLOW_IMAGE_REPO = registry.cn-beijing.aliyuncs.com/deepflow-ce
59+
DEEPFLOW_GRAFANA_PORT = 30080
60+
61+
KWOK_VERSION = v0.3.0
62+
KWOK_IMAGE = registry.k8s.io/kwok/kwok:$(KWOK_VERSION)
63+
5664
VPC_NAT_GW_IMG = $(REGISTRY)/vpc-nat-gateway:$(VERSION)
5765

5866
E2E_NETWORK = bridge
@@ -245,8 +253,10 @@ endef
245253

246254
define kind_create_cluster
247255
kind create cluster --config $(1) --name $(2)
248-
kubectl delete --ignore-not-found sc standard
249-
kubectl delete --ignore-not-found -n local-path-storage deploy local-path-provisioner
256+
@if [ "x$(3)" = "x1" ]; then \
257+
kubectl delete --ignore-not-found sc standard; \
258+
kubectl delete --ignore-not-found -n local-path-storage deploy local-path-provisioner; \
259+
fi
250260
kubectl describe no
251261
endef
252262

@@ -266,6 +276,10 @@ define kind_load_submariner_images
266276
$(call kind_load_image,$(1),$(SUBMARINER_NETTEST),1)
267277
endef
268278

279+
define kind_load_kwok_image
280+
$(call kind_load_image,$(1),$(KWOK_IMAGE),1)
281+
endef
282+
269283
define kubectl_wait_exist_and_ready
270284
@echo "Waiting for $(2) $(1)/$(3) to exist..."
271285
@n=0; while ! kubectl -n $(1) get $(2) -o name | awk -F / '{print $$2}' | grep -q ^$(3)$$; do \
@@ -317,7 +331,7 @@ kind-enable-hairpin:
317331

318332
.PHONY: kind-create
319333
kind-create:
320-
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn)
334+
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn,1)
321335

322336
.PHONY: kind-init
323337
kind-init: kind-init-ipv4
@@ -333,22 +347,27 @@ kind-init-ovn-ic: kind-init-ovn-ic-ipv4
333347
.PHONY: kind-init-ovn-ic-ipv4
334348
kind-init-ovn-ic-ipv4: kind-clean-ovn-ic kind-init
335349
@$(MAKE) kind-generate-config
336-
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn1)
350+
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn1,1)
337351

338352
.PHONY: kind-init-ovn-ic-ipv6
339353
kind-init-ovn-ic-ipv6: kind-clean-ovn-ic kind-init-ipv6
340354
@ip_family=ipv6 $(MAKE) kind-generate-config
341-
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn1)
355+
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn1,1)
342356

343357
.PHONY: kind-init-ovn-ic-dual
344358
kind-init-ovn-ic-dual: kind-clean-ovn-ic kind-init-dual
345359
@ip_family=dual $(MAKE) kind-generate-config
346-
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn1)
360+
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn1,1)
347361

348362
.PHONY: kind-init-ovn-submariner
349363
kind-init-ovn-submariner: kind-clean-ovn-submariner kind-init
350364
@pod_cidr_v4=10.18.0.0/16 svc_cidr_v4=10.112.0.0/12 $(MAKE) kind-generate-config
351-
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn1)
365+
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn1,1)
366+
367+
.PHONY: kind-init-deepflow
368+
kind-init-deepflow: kind-clean
369+
@port_mapping=$(DEEPFLOW_GRAFANA_PORT):$(DEEPFLOW_GRAFANA_PORT) $(MAKE) kind-generate-config
370+
$(call kind_create_cluster,yamls/kind.yaml,kube-ovn,0)
352371

353372
.PHONY: kind-init-iptables
354373
kind-init-iptables:
@@ -510,7 +529,7 @@ kind-install-ovn-ic-dual: kind-install-dual
510529
sed -e 's/10.16.0/10.18.0/g' \
511530
-e 's/10.96.0/10.98.0/g' \
512531
-e 's/100.64.0/100.68.0/g' \
513-
-e 's/fd00:10:16:/fd00:10:18:/g' \
532+
-e 's/fd00:10:16:/fd00:10:18:/g' \
514533
-e 's/fd00:10:96:/fd00:10:98:/g' \
515534
-e 's/fd00:100:64:/fd00:100:68:/g' \
516535
-e 's/VERSION=.*/VERSION=$(VERSION)/' \
@@ -745,6 +764,34 @@ kind-install-cilium-chaining: kind-load-image kind-untaint-control-plane
745764
ENABLE_LB=false ENABLE_NP=false CNI_CONFIG_PRIORITY=10 bash
746765
kubectl describe no
747766

767+
.PHONY: kind-install-deepflow
768+
kind-install-deepflow: kind-install
769+
helm repo add deepflow $(DEEPFLOW_CHART_REPO)
770+
helm repo update deepflow
771+
$(eval CLICKHOUSE_PERSISTENCE = $(shell helm show values --version $(DEEPFLOW_CHART_VERSION) --jsonpath '{.clickhouse.storageConfig.persistence}' deepflow/deepflow | sed 's/0Gi/Gi/g'))
772+
helm install deepflow -n deepflow deepflow/deepflow \
773+
--create-namespace --version $(DEEPFLOW_CHART_VERSION) \
774+
--set global.image.repository=$(DEEPFLOW_IMAGE_REPO) \
775+
--set grafana.image.repository=$(DEEPFLOW_IMAGE_REPO)/grafana \
776+
--set deepflow-agent.sysctlInitContainer.enabled=false \
777+
--set 'mysql.storageConfig.persistence.size=5Gi' \
778+
--set-json 'clickhouse.storageConfig.persistence=$(CLICKHOUSE_PERSISTENCE)'
779+
kubectl -n deepflow patch svc deepflow-grafana --type=json \
780+
-p '[{"op": "replace", "path": "/spec/ports/0/nodePort", "value": $(DEEPFLOW_GRAFANA_PORT)}]'
781+
echo -e "\nGrafana URL: http://127.0.0.1:$(DEEPFLOW_GRAFANA_PORT)\nGrafana auth: admin:deepflow\n"
782+
783+
.PHONY: kind-install-kwok
784+
kind-install-kwok: kind-install-underlay
785+
kwok_version=$(KWOK_VERSION) j2 yamls/kwok-kustomization.yaml.j2 -o kustomization.yaml
786+
kubectl kustomize ./ > kwok.yaml
787+
$(call kind_load_kwok_image,kube-ovn)
788+
kubectl apply -f kwok.yaml
789+
kubectl -n kube-system rollout status deploy kwok-controller --timeout 60s
790+
for i in {1..20}; do \
791+
kwok_node_name=fake-node-$$i j2 yamls/kwok-node.yaml.j2 -o kwok-node.yaml; \
792+
kubectl apply -f kwok-node.yaml; \
793+
done
794+
748795
.PHONY: kind-reload
749796
kind-reload: kind-reload-ovs
750797
kubectl delete pod -n kube-system -l app=kube-ovn-controller
@@ -809,6 +856,7 @@ clean:
809856
$(RM) yamls/kind.yaml
810857
$(RM) ovn.yaml kube-ovn.yaml kube-ovn-crd.yaml
811858
$(RM) ovn-ic-0.yaml ovn-ic-1.yaml
859+
$(RM) kustomization.yaml kwok.yaml kwok-node.yaml
812860
$(RM) kube-ovn.tar vpc-nat-gateway.tar image-amd64.tar image-arm64.tar
813861

814862
.PHONY: changelog

yamls/kind.yaml.j2

+13
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ kubeadmConfigPatches:
5555
nodes:
5656
- role: control-plane
5757
image: kindest/node:{{ k8s_version }}
58+
{%- if port_mapping is defined %}
59+
{%- set container_port = port_mapping.split(':')[0] %}
60+
{%- set host_port = port_mapping.split(':')[1] %}
61+
extraPortMappings:
62+
- containerPort: {{ container_port }}
63+
hostPort: {{ host_port }}
64+
# optional: set the bind address on the host
65+
# 0.0.0.0 is the current default
66+
listenAddress: "127.0.0.1"
67+
# optional: set the protocol to one of TCP, UDP, SCTP.
68+
# TCP is the default
69+
protocol: TCP
70+
{%- endif %}
5871
{%- if single is equalto "false" %}
5972
- role: worker
6073
image: kindest/node:{{ k8s_version }}

yamls/kwok-kustomization.yaml.j2

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
images:
4+
- name: registry.k8s.io/kwok/kwok
5+
newTag: "{{ kwok_version }}"
6+
resources:
7+
- "https://github.com/kubernetes-sigs/kwok/kustomize/kwok?ref={{ kwok_version }}"

yamls/kwok-node.yaml.j2

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: v1
2+
kind: Node
3+
metadata:
4+
annotations:
5+
node.alpha.kubernetes.io/ttl: "0"
6+
kwok.x-k8s.io/node: fake
7+
labels:
8+
beta.kubernetes.io/arch: amd64
9+
beta.kubernetes.io/os: linux
10+
kubernetes.io/arch: amd64
11+
kubernetes.io/hostname: "{{ kwok_node_name }}"
12+
kubernetes.io/os: linux
13+
kubernetes.io/role: agent
14+
node-role.kubernetes.io/agent: ""
15+
type: kwok
16+
name: "{{ kwok_node_name }}"
17+
spec:
18+
taints: # Avoid scheduling actual running pods to fake Node
19+
- effect: NoSchedule
20+
key: kwok.x-k8s.io/node
21+
value: fake
22+
status:
23+
allocatable:
24+
cpu: 32
25+
memory: 256Gi
26+
pods: 110
27+
capacity:
28+
cpu: 32
29+
memory: 256Gi
30+
pods: 110
31+
nodeInfo:
32+
architecture: amd64
33+
bootID: ""
34+
containerRuntimeVersion: ""
35+
kernelVersion: ""
36+
kubeProxyVersion: fake
37+
kubeletVersion: fake
38+
machineID: ""
39+
operatingSystem: linux
40+
osImage: ""
41+
systemUUID: ""
42+
phase: Running

0 commit comments

Comments
 (0)