Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify tolerations onlywhen #19

Merged
merged 2 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 4 additions & 51 deletions content/en/docs/containerized-data-importer/alpine-vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,59 +36,14 @@ Block needed to reference the PVC as a disk and the `cloudinitdisk`:

You will have to reference the `cloudinitdisk` as a second disk in `spec.template.spec.domain.devices.disks`.

{{% onlyWhenNot tolerations %}}

{{% details title="Task Hint" %}}
Your VM definition should look like this:

```yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-alpine
spec:
running: false
template:
spec:
domain:
devices:
disks:
- name: alpinedisk
disk:
bus: virtio
- name: cloudinitdisk
disk:
bus: virtio
interfaces:
- name: default
masquerade: {}
resources:
requests:
memory: 256M
networks:
- name: default
pod: {}
volumes:
- name: alpinedisk
persistentVolumeClaim:
claimName: {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-alpinedisk
- name: cloudinitdisk
cloudInitNoCloud:
userData: |-
#cloud-config
password: {{% param "dummypwd" %}}
chpasswd: { expire: False }
```
{{% /details %}}

{{% /onlyWhenNot %}}

{{% onlyWhen tolerations %}}

{{% alert title="Tolerations" color="warning" %}}
Don't forget the `tolerations` from the setup chapter to make sure the VM will be scheduled on one of the baremetal nodes.
{{% /alert %}}

{{% /onlyWhen %}}

{{% details title="Task Hint" %}}
Your yaml should look like this:
```yaml
Expand Down Expand Up @@ -118,12 +73,12 @@ spec:
networks:
- name: default
pod: {}
tolerations:
{{< onlyWhen tolerations >}}tolerations:
- effect: NoSchedule
key: baremetal
operator: Equal
value: "true"
volumes:
{{< /onlyWhen >}}volumes:
- name: alpinedisk
persistentVolumeClaim:
claimName: {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-alpinedisk
Expand All @@ -136,8 +91,6 @@ spec:
```
{{% /details %}}

{{% /onlyWhen %}}


## {{% task %}} Create and start the VM

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ spec:
networks:
- name: default
pod: {}
tolerations:
{{< onlyWhen tolerations >}}tolerations:
- effect: NoSchedule
key: baremetal
operator: Equal
value: "true"
volumes:
{{< /onlyWhen >}}volumes:
- name: containerdisk
containerDisk:
image: {{% param "fedoraCloudCDI" %}}
Expand Down Expand Up @@ -250,12 +250,12 @@ spec:
networks:
- name: default
pod: {}
tolerations:
{{< onlyWhen tolerations >}}tolerations:
- effect: NoSchedule
key: baremetal
operator: Equal
value: "true"
volumes:
{{< /onlyWhen >}}volumes:
- name: containerdisk
containerDisk:
image: {{% param "fedoraCloudCDI" %}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ spec:
networks:
- name: default
pod: {}
tolerations:
{{< onlyWhen tolerations >}}tolerations:
- effect: NoSchedule
key: baremetal
operator: Equal
value: "true"
volumes:
{{< /onlyWhen >}}volumes:
- name: containerdisk
containerDisk:
image: {{% param "fedoraCoreOSCDI" %}}
Expand Down Expand Up @@ -216,12 +216,12 @@ spec:
networks:
- name: default
pod: {}
tolerations:
{{< onlyWhen tolerations >}}tolerations:
- effect: NoSchedule
key: baremetal
operator: Equal
value: "true"
volumes:
{{< /onlyWhen >}}volumes:
- name: containerdisk
containerDisk:
image: {{% param "fedoraCoreOSCDI" %}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,95 +335,14 @@ Deploy two VMs with different instance types:
* Deploy a cirros VM using an `o` class instancetype and the same preference.
* rite the VM specification in `{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-o1-cirros.yaml`


{{% onlyWhenNot tolerations %}}

{{% details title="Solution" %}}
`{{% param "labsfoldername" %}}/{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}/vm_{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-u1-cirros.yaml` specification:
```yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-u1-cirros
spec:
running: false
instancetype:
kind: VirtualMachineClusterInstancetype
name: u1.nano
preference:
kind: VirtualMachineClusterPreference
name: cirros
template:
metadata:
labels:
kubevirt.io/size: nano
kubevirt.io/domain: {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-u1-cirros
spec:
domain:
devices:
disks:
- name: containerdisk
- name: cloudinitdisk
interfaces:
- name: default
masquerade: {}
networks:
- name: default
pod: {}
volumes:
- name: containerdisk
containerDisk:
image: quay.io/kubevirt/cirros-container-disk-demo
- name: cloudinitdisk
cloudInitNoCloud:
userDataBase64: SGkuXG4=
```

`{{% param "labsfoldername" %}}/{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}/vm_{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-o1-cirros.yaml` specification:
```yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-o1-cirros
spec:
running: false
instancetype:
kind: VirtualMachineClusterInstancetype
name: o1.nano
preference:
kind: VirtualMachineClusterPreference
name: cirros
template:
metadata:
labels:
kubevirt.io/size: nano
kubevirt.io/domain: {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-o1-cirros
spec:
domain:
devices:
disks:
- name: containerdisk
- name: cloudinitdisk
interfaces:
- name: default
masquerade: {}
networks:
- name: default
pod: {}
volumes:
- name: containerdisk
containerDisk:
image: quay.io/kubevirt/cirros-container-disk-demo
{{% /details %}}

{{% /onlyWhenNot %}}

{{% onlyWhen tolerations %}}

{{% alert title="Tolerations" color="warning" %}}
Don't forget the `tolerations` from the setup chapter to make sure the VM will be scheduled on one of the baremetal nodes.
{{% /alert %}}

{{% /onlyWhen %}}

{{% details title="Solution" %}}
`{{% param "labsfoldername" %}}/{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}/vm_{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-u1-cirros.yaml` specification:
```yaml
Expand Down Expand Up @@ -456,12 +375,12 @@ spec:
networks:
- name: default
pod: {}
tolerations:
{{< onlyWhen tolerations >}}tolerations:
- effect: NoSchedule
key: baremetal
operator: Equal
value: "true"
volumes:
{{< /onlyWhen >}}volumes:
- name: containerdisk
containerDisk:
image: quay.io/kubevirt/cirros-container-disk-demo
Expand Down Expand Up @@ -501,12 +420,12 @@ spec:
networks:
- name: default
pod: {}
tolerations:
{{< onlyWhen tolerations >}}tolerations:
- effect: NoSchedule
key: baremetal
operator: Equal
value: "true"
volumes:
{{< /onlyWhen >}}volumes:
- name: containerdisk
containerDisk:
image: quay.io/kubevirt/cirros-container-disk-demo
Expand All @@ -515,7 +434,6 @@ spec:
userDataBase64: SGkuXG4=
```

{{% /onlyWhen %}}

Apply and start both VMs with

Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/scaling-vms/vm-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ spec:
requests:
memory: 1Gi
terminationGracePeriodSeconds: 0
tolerations:
{{< onlyWhen tolerations >}}tolerations:
- effect: NoSchedule
key: baremetal
operator: Equal
value: "true"
volumes:
{{< /onlyWhen >}}volumes:
- name: datavolumedisk
dataVolume:
name: fedora-cloud-nginx-base
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/storage/mounting-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,12 @@ spec:
networks:
- name: default
pod: {}
tolerations:
{{< onlyWhen tolerations >}}tolerations:
- effect: NoSchedule
key: baremetal
operator: Equal
value: "true"
volumes:
{{< /onlyWhen >}}volumes:
- name: containerdisk
containerDisk:
image: quay.io/containerdisks/fedora:40
Expand Down