-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If volumeDevices had an entry with 'devicePath: /', it's used as a persistent root filesystem for the VM. It gets overwritten again if the image digest changes. See examples/cirros-vm-persistent-rootfs.yaml
- Loading branch information
Ivan Shvedunov
committed
Sep 19, 2018
1 parent
cfb5e53
commit d835a5a
Showing
45 changed files
with
1,258 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: local-block-pvc | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
volumeMode: Block | ||
storageClassName: local-storage | ||
resources: | ||
requests: | ||
storage: 100Mi | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: local-block-pv | ||
spec: | ||
capacity: | ||
storage: 100Mi | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Retain | ||
storageClassName: local-storage | ||
volumeMode: Block | ||
local: | ||
# set up with: | ||
# docker exec kube-node-1 /bin/bash -c 'dd if=/dev/zero of=/rawtest bs=1M count=1000 && losetup -f /rawtest --show' | ||
path: /dev/loop0 | ||
claimRef: | ||
name: local-block-pvc | ||
namespace: default | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- kube-node-1 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: cirros-vm-p | ||
annotations: | ||
kubernetes.io/target-runtime: virtlet.cloud | ||
# CirrOS doesn't load nocloud data from SCSI CD-ROM for some reason | ||
VirtletDiskDriver: virtio | ||
VirtletSSHKeys: | | ||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCaJEcFDXEK2ZbX0ZLS1EIYFZRbDAcRfuVjpstSc0De8+sV1aiu+dePxdkuDRwqFtCyk6dEZkssjOkBXtri00MECLkir6FcH3kKOJtbJ6vy3uaJc9w1ERo+wyl6SkAh/+JTJkp7QRXj8oylW5E20LsbnA/dIwWzAF51PPwF7A7FtNg9DnwPqMkxFo1Th/buOMKbP5ZA1mmNNtmzbMpMfJATvVyiv3ccsSJKOiyQr6UG+j7sc/7jMVz5Xk34Vd0l8GwcB0334MchHckmqDB142h/NCWTr8oLakDNvkfC1YneAfAO41hDkUbxPtVBG5M/o7P4fxoqiHEX+ZLfRxDtHB53 me@localhost | ||
spec: | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: extraRuntime | ||
operator: In | ||
values: | ||
- virtlet | ||
# This is the number of seconds Virtlet gives the VM to shut down cleanly. | ||
# The default value of 30 seconds is ok for containers but probably too | ||
# low for VM, so overriding it here is strongly advised. | ||
terminationGracePeriodSeconds: 120 | ||
containers: | ||
- name: cirros-vm | ||
image: virtlet.cloud/cirros | ||
imagePullPolicy: IfNotPresent | ||
# tty and stdin required for `kubectl attach -t` to work | ||
tty: true | ||
stdin: true | ||
volumeDevices: | ||
- devicePath: / | ||
name: testpvc | ||
volumes: | ||
- name: testpvc | ||
persistentVolumeClaim: | ||
claimName: local-block-pvc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
pkg/libvirttools/TestDomainDefinitions__ceph_flexvolume.out.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
pkg/libvirttools/TestDomainDefinitions__cloud-init_with_user_data.out.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
pkg/libvirttools/TestDomainDefinitions__persistent_rootfs.out.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
- name: GetImagePathDigestAndVirtualSize | ||
value: fake/image1 | ||
- name: CMD | ||
value: | ||
cmd: blockdev --getsz /fakedev/69eec606-0493-5825-73a4-c5e0c0236155/volumeDevices/kubernetes.io~local-volume/root | ||
stdout: "1000" | ||
- name: CMD | ||
value: | ||
cmd: dmsetup create virtlet-dm-69eec606-0493-5825-73a4-c5e0c0236155 | ||
stdin: | | ||
0 999 linear /fakedev/69eec606-0493-5825-73a4-c5e0c0236155/volumeDevices/kubernetes.io~local-volume/root 1 | ||
- name: CMD | ||
value: | ||
cmd: qemu-img convert -O raw /fake/volume/path /dev/mapper/virtlet-dm-69eec606-0493-5825-73a4-c5e0c0236155 | ||
- name: 'domain conn: DefineDomain' | ||
value: |- | ||
<domain type="kvm"> | ||
<name>virtlet-231700d5-c9a6-container1</name> | ||
<uuid>231700d5-c9a6-5a49-738d-99a954c51550</uuid> | ||
<memory unit="MiB">1024</memory> | ||
<vcpu>1</vcpu> | ||
<cputune> | ||
<shares>0</shares> | ||
<period>0</period> | ||
<quota>0</quota> | ||
</cputune> | ||
<os> | ||
<type>hvm</type> | ||
<boot dev="hd"></boot> | ||
</os> | ||
<features> | ||
<acpi></acpi> | ||
</features> | ||
<on_poweroff>destroy</on_poweroff> | ||
<on_reboot>restart</on_reboot> | ||
<on_crash>restart</on_crash> | ||
<devices> | ||
<emulator>/vmwrapper</emulator> | ||
<disk type="block" device="disk"> | ||
<driver name="qemu" type="raw"></driver> | ||
<source dev="/dev/mapper/virtlet-dm-69eec606-0493-5825-73a4-c5e0c0236155"></source> | ||
<target dev="sda" bus="scsi"></target> | ||
<address type="drive" controller="0" bus="0" target="0" unit="0"></address> | ||
</disk> | ||
<disk type="file" device="cdrom"> | ||
<driver name="qemu" type="raw"></driver> | ||
<source file="/var/lib/virtlet/config/config-231700d5-c9a6-5a49-738d-99a954c51550.iso"></source> | ||
<target dev="sdb" bus="scsi"></target> | ||
<readonly></readonly> | ||
<address type="drive" controller="0" bus="0" target="0" unit="1"></address> | ||
</disk> | ||
<controller type="scsi" index="0" model="virtio-scsi"> | ||
<address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"></address> | ||
</controller> | ||
<controller type="pci" model="pci-root"></controller> | ||
<serial type="unix"> | ||
<source mode="connect" path="/var/lib/libvirt/streamer.sock"> | ||
<reconnect enabled="yes" timeout="1"></reconnect> | ||
</source> | ||
<target port="0"></target> | ||
</serial> | ||
<input type="tablet" bus="usb"></input> | ||
<graphics type="vnc" port="-1"></graphics> | ||
<video> | ||
<model type="cirrus"></model> | ||
</video> | ||
</devices> | ||
<commandline xmlns="http://libvirt.org/schemas/domain/qemu/1.0"> | ||
<env name="VIRTLET_EMULATOR" value="/usr/bin/kvm"></env> | ||
<env name="VIRTLET_NET_KEY" value="/tmp/fakenetns"></env> | ||
<env name="VIRTLET_CONTAINER_ID" value="231700d5-c9a6-5a49-738d-99a954c51550"></env> | ||
<env name="VIRTLET_CONTAINER_LOG_PATH" value="/var/log/pods/69eec606-0493-5825-73a4-c5e0c0236155/container1_42.log"></env> | ||
</commandline> | ||
</domain> | ||
- name: 'domain conn: virtlet-231700d5-c9a6-container1: Create' | ||
- name: 'domain conn: virtlet-231700d5-c9a6-container1: iso image' | ||
value: | ||
meta-data: '{"instance-id":"testName_0.default","local-hostname":"testName_0"}' | ||
network-config: | | ||
version: 1 | ||
user-data: | | ||
#cloud-config | ||
- name: 'domain conn: virtlet-231700d5-c9a6-container1: Destroy' | ||
- name: 'domain conn: virtlet-231700d5-c9a6-container1: Undefine' | ||
- name: CMD | ||
value: | ||
cmd: dmsetup remove virtlet-dm-69eec606-0493-5825-73a4-c5e0c0236155 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
pkg/libvirttools/TestDomainDefinitions__raw_block_volume.out.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
pkg/libvirttools/TestDomainDefinitions__virtio_disk_driver.out.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
pkg/libvirttools/TestPersistentRootVolume__first_image_too_big.out.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
- name: setup | ||
- name: 'image: GetImagePathDigestAndVirtualSize' | ||
value: persistent/image1 | ||
- name: CMD | ||
value: | ||
cmd: blockdev --getsz /dev/rootdev | ||
stdout: "8" |
Oops, something went wrong.