From 5e5328db3d042537cf1e8bb7f70c9bd937829310 Mon Sep 17 00:00:00 2001 From: Miguel Duarte Barroso Date: Fri, 13 Mar 2020 15:59:02 +0100 Subject: [PATCH] macvtap-cni, automation: `make components` now synchs macvtap-cni Signed-off-by: Miguel Duarte Barroso --- hack/components.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/hack/components.sh b/hack/components.sh index 92c9f5d8f9..27c37e3165 100755 --- a/hack/components.sh +++ b/hack/components.sh @@ -71,3 +71,48 @@ KUBEMACPOOL_IMAGE=quay.io/kubevirt/kubemacpool KUBEMACPOOL_IMAGE_TAGGED=${KUBEMACPOOL_IMAGE}:${KUBEMACPOOL_TAG} sed -i "s#\"${KUBEMACPOOL_IMAGE}:.*\"#\"${KUBEMACPOOL_IMAGE_TAGGED}\"#" pkg/components/components.go sed -i "s#\"${KUBEMACPOOL_IMAGE}:.*\"#\"${KUBEMACPOOL_IMAGE_TAGGED}\"#" test/releases/${CNAO_VERSION}.go + +echo 'macvtap' +MACVTAP_URL=$(cat components.yaml | shyaml get-value components.macvtap-cni.url) +MACVTAP_COMMIT=$(cat components.yaml | shyaml get-value components.macvtap-cni.commit) +MACVTAP_REPO=$(echo ${MACVTAP_URL} | sed 's#https://\(.*\)#\1#') +MACVTAP_PATH=${GOPATH}/src/${MACVTAP_REPO} + +echo 'Fetch macvtap-cni sources' +( + go get ${MACVTAP_REPO} || true + cd ${MACVTAP_PATH} + git fetch origin + git reset --hard + git checkout ${MACVTAP_COMMIT} +) + +rm -rf data/macvtap/* +echo 'Copy the templates from the macvtap-cni repo ...' +cp ${MACVTAP_PATH}/templates/namespace.yaml.in data/macvtap/000-ns.yaml +echo "{{ if .EnableSCC }}" >> data/macvtap/001-rbac.yaml +cat ${MACVTAP_PATH}/templates/scc.yaml.in >> data/macvtap/001-rbac.yaml +echo "{{ end }}" >> data/macvtap/001-rbac.yaml +cat < data/macvtap/002-macvtap-daemonset.yaml +--- +kind: ConfigMap +apiVersion: v1 +metadata: + name: macvtap-deviceplugin-config + namespace: {{ .Namespace }} +data: + DP_MACVTAP_CONF: "[]" +--- +EOF +cat ${MACVTAP_PATH}/templates/macvtap.yaml.in >> data/macvtap/002-macvtap-daemonset.yaml + +echo 'Get macvtap-cni image name and update it under CNAO' +MACVTAP_TAG=$( + cd ${MACVTAP_PATH} + git describe --tags +) +# TODO: uncomment the following lines *once* there is macvtap upgrade is supported +#MACVTAP_IMAGE=quay.io/kubevirt/macvtap-cni +#MACVTAP_IMAGE_TAGGED=${MACVTAP_IMAGE}:${MACVTAP_TAG} +#sed -i "s#\"${MACVTAP_IMAGE}:.*\"#\"${MACVTAP_IMAGE_TAGGED}\"#" pkg/components/components.go +#sed -i "s#\"${MACVTAP_IMAGE}:.*\"#\"${MACVTAP_IMAGE_TAGGED}\"#" test/releases/${CNAO_VERSION}.go