Skip to content

Commit

Permalink
Merge pull request #1143 from cynepco3hahue/disks-images-provider
Browse files Browse the repository at this point in the history
Move our PVC tests to work with hostPath
  • Loading branch information
Artyom Lukianov committed Jun 13, 2018
2 parents f775104 + bf7da59 commit d07a440
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 373 deletions.
2 changes: 1 addition & 1 deletion hack/config-default.sh
@@ -1,5 +1,5 @@
binaries="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virtctl cmd/fake-qemu-process cmd/virt-api cmd/subresource-access-test"
docker_images="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virt-api images/iscsi-demo-target-tgtd images/vm-killer cmd/registry-disk-v1alpha images/cirros-registry-disk-demo images/fedora-cloud-registry-disk-demo images/alpine-registry-disk-demo cmd/subresource-access-test images/winrmcli"
docker_images="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virt-api images/disks-images-provider images/vm-killer cmd/registry-disk-v1alpha images/cirros-registry-disk-demo images/fedora-cloud-registry-disk-demo images/alpine-registry-disk-demo cmd/subresource-access-test images/winrmcli"
docker_prefix=${DOCKER_PREFIX:-kubevirt}
docker_tag=${DOCKER_TAG:-latest}
master_ip=192.168.200.2
Expand Down
Expand Up @@ -13,28 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright 2017 Red Hat, Inc.
# Copyright 2018 Red Hat, Inc.
#

FROM fedora:27

MAINTAINER "The KubeVirt Project" <kubevirt-dev@googlegroups.com>
ENV container docker

RUN dnf -y install scsi-target-utils bzip2 e2fsprogs
# Prepare all images
RUN mkdir -p /images/custom /images/alpine \
&& truncate -s 64M /images/custom/disk.img \
&& curl http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/x86_64/alpine-virt-3.7.0-x86_64.iso > /images/alpine/disk.img

RUN mkdir -p /images
ADD entrypoint.sh /

# Add alpine image
RUN curl http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/x86_64/alpine-virt-3.7.0-x86_64.iso > /images/1-alpine.img

# Cirros has been removed from the demo target for now.
# Uncomment this line if we need to add the cirros image back
# in for testing purposes.
# ADD https://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img /images/2-cirros.img

ADD run-tgt.sh /

EXPOSE 3260

CMD ["/run-tgt.sh"]
CMD ["/entrypoint.sh"]
33 changes: 33 additions & 0 deletions images/disks-images-provider/entrypoint.sh
@@ -0,0 +1,33 @@
#!/bin/bash
#
# This file is part of the KubeVirt project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright 2018 Red Hat, Inc.
#

set -euo pipefail

# gracefully handle the TERM signal sent when deleting the daemonset
trap 'exit' TERM

echo "copy all images to host mount directory"
cp -R /images/* /hostImages/

# let the monitoring script know we're done'
echo "done"

while true; do
sleep 60
done
117 changes: 0 additions & 117 deletions images/iscsi-demo-target-tgtd/README.md

This file was deleted.

100 changes: 0 additions & 100 deletions images/iscsi-demo-target-tgtd/run-tgt.sh

This file was deleted.

Expand Up @@ -20,7 +20,7 @@ spec:
apiVersion: v1
kind: PersistentVolume
metadata:
name: iscsi-disk-alpine
name: host-path-disk-alpine
labels:
kubevirt.io: ""
os: "alpine"
Expand All @@ -29,10 +29,8 @@ spec:
storage: 1Gi
accessModes:
- ReadWriteOnce
iscsi:
iqn: iqn.2017-01.io.kubevirt:sn.42
lun: 2
targetPortal: "127.0.0.1"
hostPath:
path: /tmp/hostImages/alpine
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -55,7 +53,7 @@ spec:
apiVersion: v1
kind: PersistentVolume
metadata:
name: iscsi-disk-custom
name: host-path-disk-custom
labels:
kubevirt.io: ""
os: "custom"
Expand All @@ -64,47 +62,35 @@ spec:
storage: 1Gi
accessModes:
- ReadWriteOnce
iscsi:
iqn: iqn.2017-01.io.kubevirt:sn.42
lun: 1
targetPortal: "127.0.0.1"
hostPath:
path: /tmp/hostImages/custom
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: iscsi-demo-target-tgtd
name: disks-images-provider
namespace: {{.Namespace}}
labels:
kubevirt.io: "iscsi-demo-target"
kubevirt.io: "disks-images-provider"
spec:
template:
metadata:
labels:
name: iscsi-demo-target-tgtd
kubevirt.io: iscsi-demo-target
name: iscsi-demo-target-tgtd
name: disks-images-provider
kubevirt.io: disks-images-provider
name: disks-images-provider
spec:
hostNetwork: true
serviceAccountName: kubevirt-testing
containers:
- name: target
image: {{.DockerPrefix}}/iscsi-demo-target-tgtd:{{.DockerTag}}
image: {{.DockerPrefix}}/disks-images-provider:{{.DockerTag}}
volumeMounts:
- name: host
mountPath: /host
env:
- name: EXPORT_HOST_PATHS
value:
- name: images
mountPath: /hostImages
securityContext:
privileged: true
readinessProbe:
exec:
command:
- cat
- /tmp/previous_state
initialDelaySeconds: 10
periodSeconds: 5
volumes:
- name: host
- name: images
hostPath:
path: /
path: /tmp/hostImages
type: DirectoryOrCreate

0 comments on commit d07a440

Please sign in to comment.