Skip to content

Commit

Permalink
Add e2e example for Machine creation using ephemeral resources (#1136)
Browse files Browse the repository at this point in the history
* Add e2e example manifests for `machine` with ephemeral resources

* address review comments

* address review comments
  • Loading branch information
Rohit-0505 authored Nov 11, 2024
1 parent 336f3b9 commit 97703e1
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- network.yaml
- machine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: compute.ironcore.dev/v1alpha1
kind: Machine
metadata:
name: machine-sample
spec:
machineClassRef:
name: machineclass-sample
ignitionRef:
name: ignition
key: ignition.yaml
networkInterfaces:
- name: primary
ephemeral:
networkInterfaceTemplate:
spec:
ipFamilies:
- IPv4
ips:
- value: 10.0.0.12
networkRef:
name: network-sample
virtualIP:
ephemeral:
virtualIPTemplate:
spec:
type: Public
ipFamily: IPv4
volumes:
- name: root-disk
ephemeral:
volumeTemplate:
spec:
volumeClassRef:
name: volumeclass-sample
image: gardenlinux:rootfs-image
resources:
storage: 10Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: networking.ironcore.dev/v1alpha1
kind: Network
metadata:
name: network-sample
50 changes: 50 additions & 0 deletions config/samples/e2e/machine-with-ephemeral-resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Machine with ephemeral resources

This example deploys a `Machine` with `ephemeral` `volume` and `networkinterface`.
The following artifacts will be deployed in your namespace:
- IronCore `Network`, `NetworkInterface` and `VirtualIP`
- IronCore `Machine`
- IronCore `Volume`
- Secret containing the `ignition`

## Prerequisites

- [Butane](https://coreos.github.io/butane/)

## Usage
1. Adapt the `namespace` in `kustomization.yaml`
2. Replace `your-user`, `your-pw-hash` and `your-ssh-key`s in the `ignition/ignition.yaml`
3. Run `ignition/regenerate-ignition.sh`
4. Create the below `patch-machine.yaml` in `machine-with-ephemeral-resources` folder with the desired `machineClassRef`, `machinePoolRef`, `volumeClassRef`, `volumePoolRef`, `image` etc. as per your environment

```
apiVersion: compute.ironcore.dev/v1alpha1
kind: Machine
metadata:
name: machine-sample
spec:
machineClassRef:
name: new-machineClass
machinePoolRef:
name: new-machinePool
volumes:
- name: root-disk
ephemeral:
volumeTemplate:
spec:
volumeClassRef:
name: new-volumeClass
volumePoolRef:
name: new-volumePool
image: gardenlinux:rootfs-dev-20231025
resources:
storage: 15Gi
```

5. Update the `kustomization.yaml` with below content
```
patches:
- path: patch-machine.yaml
```

6. Run (`kubectl apply -k ./`)
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ namespace: test

resources:
- ../bases/ignition
- ../bases/nonephemeral-machine
- ../bases/machine-with-ephemeral-resources
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `Machine` non ephemeral resources
# `Machine` with non ephemeral resources

This example deploys a `Machine` with `non-ephemeral` `volume` and `networkinterface`.
The following artifacts will be deployed in your namespace:
Expand All @@ -15,7 +15,7 @@ The following artifacts will be deployed in your namespace:
1. Adapt the `namespace` in `kustomization.yaml`
2. Replace `your-user`, `your-pw-hash` and `your-ssh-key` in the `ignition/ignition.yaml`
3. Run `ignition/regenerate-ignition.sh`
4. Create the below `patch-machineclassref.yaml` in `machine-with-non-ephemeral-resource` folder with the desired `machineClassRef` and `machinePoolRef` as per your environment
4. Create the below `patch-machine.yaml` in `machine-with-non-ephemeral-resources` folder with the desired `machineClassRef` and `machinePoolRef` as per your environment

```
apiVersion: compute.ironcore.dev/v1alpha1
Expand All @@ -29,7 +29,7 @@ spec:
name: new-machinePool
```

5. Create the below`patch-volume.yaml`in `machine-with-non-ephemeral-resource` folder with the desired `volumeClassRef`and `volumePoolRef` as per your environment
5. Create the below`patch-volume.yaml`in `machine-with-non-ephemeral-resources` folder with the desired `volumeClassRef`and `volumePoolRef` as per your environment

```
apiVersion: storage.ironcore.dev/v1alpha1
Expand All @@ -38,16 +38,15 @@ metadata:
name: volume-sample
spec:
volumeClassRef:
name: new-volumeClass The new name of the volume class reference
name: new-volumeClass
image: new-image:rootfs
volumePoolRef:
name: new-volumePool
```
6. Update the `kustomization.yaml` with below content
```
patches:
- path: patch-machineclassref.yaml
- path: patch-machine.yaml
- path: patch-volume.yaml
```

7. Run (`kubectl apply -k ./`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: test

resources:
- ../bases/ignition
- ../bases/machine-with-nonephemeral-resources

0 comments on commit 97703e1

Please sign in to comment.