Skip to content

Commit 2799a44

Browse files
Shiyang WangRyan Hallisey
authored andcommitted
add download-templates for cdi jinjia2 (#86)
1 parent 9d6352c commit 2799a44

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Files generated by JetBrains IDEs, e.g. IntelliJ IDEA
2+
.idea/
3+
*.iml

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ RUN yum install -y iptables wget \
3939
### UPSTREAM ONLY ###
4040
COPY requirements.yml /opt/ansible/requirements.yml
4141
COPY download-templates.sh /usr/bin/download-templates
42-
RUN mkdir /opt/apb/kubevirt-templates \
42+
RUN mkdir /opt/apb/kubevirt-templates /opt/apb/kubevirt-templates/cdi \
4343
&& download-templates /opt/apb/kubevirt-templates
4444

4545
RUN ansible-galaxy install -r /opt/ansible/requirements.yml \

download-templates.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/bin/bash
22

33
KUBEVIRT_TEMPLATE_DIR="${1:-$(dirname "${BASH_SOURCE}")}"
4+
CDI_TEMPLATE_DIR="${KUBEVIRT_TEMPLATE_DIR}/cdi"
45

56
echo "Download release templates from KubeVirt"
67
vm_template_url="https://raw.githubusercontent.com/kubevirt/kubevirt"
78
manifest_url="https://github.com/kubevirt/kubevirt/releases/download"
8-
9+
cdi_manifest_url="https://github.com/kubevirt/containerized-data-importer/releases/download"
910

1011
if [ -z "${version}" ]; then
1112
version=$(git ls-remote --tags https://github.com/kubevirt/kubevirt | sed 's/.*refs\/tags\///g' | grep -v '\^{}')
@@ -36,3 +37,24 @@ for item in ${version}; do
3637
wget -O "${KUBEVIRT_TEMPLATE_DIR}/${item}/kubevirt.yaml" "${manifest_url}/${item}/kubevirt.yaml"
3738
echo "Download for ${item} complete"
3839
done
40+
41+
if [ -z "${cdi_version}" ]; then
42+
cdi_version=$(git ls-remote --tags https://github.com/kubevirt/containerized-data-importer | sed 's/.*refs\/tags\///g' | grep -v '\^{}')
43+
fi
44+
45+
for item in ${cdi_version}; do
46+
echo ${item}
47+
echo "Downloading template for ${item}"
48+
if [ ! -d "${item}" ]; then
49+
mkdir "${CDI_TEMPLATE_DIR}/${item}"
50+
fi
51+
major=`echo ${item} | cut -dv -f2 | cut -d. -f1`
52+
minor=`echo ${item} | cut -dv -f2 | cut -d. -f2`
53+
patch=`echo ${item} | cut -dv -f2 | cut -d. -f3`
54+
if [ "$major" -ge "1" ] && [ "$minor" -ge 2 ]; then
55+
# We support j2 template since v1.2.0
56+
wget -O "${CDI_TEMPLATE_DIR}/${item}/cdi-controller.yaml.j2" "${cdi_manifest_url}/${item}/cdi-controller.yaml.j2"
57+
fi
58+
wget -O "${CDI_TEMPLATE_DIR}/${item}/cdi-controller.yaml" "${cdi_manifest_url}/${item}/cdi-controller.yaml"
59+
echo "Download for ${item} complete"
60+
done

0 commit comments

Comments
 (0)