-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e example for
Machine
creation using non ephemeral resources (#…
…1133) * Add manifests to create a machine with non-ephemeral resources * update folder structure * increase `eventuallyTimeout` to 10s to avoid sporadic core_test failure * address review comments * update the `eventuallyTimeout` with 3s in `app_suite_test.go`
- Loading branch information
1 parent
daeb37f
commit 8ea3843
Showing
15 changed files
with
229 additions
and
1 deletion.
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,7 @@ | ||
apiVersion: v1 | ||
data: | ||
ignition.yaml: eyJpZ25pdGlvbiI6eyJ2ZXJzaW9uIjoiMy4zLjAifSwicGFzc3dkIjp7InVzZXJzIjpbeyJncm91cHMiOlsid2hlZWwiXSwiaG9tZURpciI6Ii9ob21lL3lvdXItdXNlciIsIm5hbWUiOiJ5b3VyLXVzZXIiLCJwYXNzd29yZEhhc2giOiJ5b3VyLXB3LWhhc2giLCJzaGVsbCI6Ii9iaW4vYmFzaCJ9XX0sInN0b3JhZ2UiOnsiZGlyZWN0b3JpZXMiOlt7Imdyb3VwIjp7Im5hbWUiOiJ5b3VyLXVzZXIifSwicGF0aCI6Ii9ob21lL3lvdXItdXNlci8uc3NoIiwidXNlciI6eyJuYW1lIjoieW91ci11c2VyIn0sIm1vZGUiOjQ0OH1dLCJmaWxlcyI6W3sicGF0aCI6Ii9ldGMvc3lzdGVtZC9yZXNvbHZlZC5jb25mLmQvZG5zLmNvbmYiLCJjb250ZW50cyI6eyJjb21wcmVzc2lvbiI6IiIsInNvdXJjZSI6ImRhdGE6LCU1QlJlc29sdmUlNUQlMEFETlMlM0QxLjEuMS4xJTBBIn0sIm1vZGUiOjQyMH0seyJncm91cCI6eyJuYW1lIjoieW91ci11c2VyIn0sInBhdGgiOiIvaG9tZ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G1tdUg4a3BDTVVNdmFzRHZQeDRySUFxN2lPSE80NWtkSE45a1ZuM0Z3N1gxZ3Y1M0pRdEg2bFVMMjRCNkdXakZtcjR3VFcvQWpxNFVwcU51bHF2Mzc0U2ZUWTN0Wk9tMzQ3VDRpSUh5NUd5a3ZhUEJ4M3hvRnQwUVpkc2s4YVVTSkwyWEhQZWhWcUJ2bENDTURaNjBCRnJGekpQbGR6QWwrNm9Gb0VIM0ZQS3FLcklDa3dINytwR1lDdGhMTjFZMHJOV0RHcHBsUHNyOG82c0dJMW5YZGVsMjgrak1abVAyekJpeFdwNUxuTHFhS093Njd5ektJNkQzdUVlcCtEYzc1LzUxMTc0UGpoNTkvNTI5ZlFVNWovRXZ3QUFBUC8vbFFMTVdpOEVBQUE9In0sIm1vZGUiOjQzOH1dfSwic3lzdGVtZCI6eyJ1bml0cyI6W3siZW5hYmxlZCI6dHJ1ZSwibmFtZSI6InNzaC5zZXJ2aWNlIn0seyJjb250ZW50cyI6IltVbml0XVxuRGVzY3JpcHRpb249SW5zdGFsbCBuZ2lueFxuW1NlcnZpY2VdXG5UeXBlPW9uZXNob3RcblJlbWFpbkFmdGVyRXhpdD15ZXNcbkV4ZWNTdGFydD0vaW5zdGFsbC1uZ2lueC5zaFxuW0luc3RhbGxdXG5XYW50ZWRCeT1tdWx0aS11c2VyLnRhcmdldFxuIiwiZW5hYmxlZCI6dHJ1ZSwibmFtZSI6Imluc3RhbGwtbmdpbnguc2VydmljZSJ9XX19Cg== | ||
kind: Secret | ||
metadata: | ||
creationTimestamp: null | ||
name: ignition |
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,57 @@ | ||
|
||
variant: fcos | ||
version: 1.4.0 | ||
passwd: | ||
users: | ||
- name: your-user | ||
home_dir: /home/your-user | ||
groups: | ||
- wheel | ||
shell: /bin/bash | ||
password_hash: your-pw-hash | ||
storage: | ||
directories: | ||
- path: /home/your-user/.ssh | ||
mode: 0700 | ||
user: | ||
name: your-user | ||
group: | ||
name: your-user | ||
files: | ||
- path: /etc/systemd/resolved.conf.d/dns.conf | ||
mode: 0644 | ||
contents: | ||
inline: | | ||
[Resolve] | ||
DNS=1.1.1.1 | ||
- path: /home/your-user/.ssh/authorized_keys | ||
mode: 0600 | ||
user: | ||
name: your-user | ||
group: | ||
name: your-user | ||
contents: | ||
inline: your-ssh-key | ||
- path: /install-nginx.sh | ||
mode: 0777 | ||
contents: | ||
local: install-nginx.sh | ||
- path: /var/www/html/index.html | ||
mode: 0666 | ||
contents: | ||
local: index.html | ||
systemd: | ||
units: | ||
- name: ssh.service | ||
enabled: true | ||
- name: install-nginx.service | ||
enabled: true | ||
contents: | | ||
[Unit] | ||
Description=Install nginx | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/install-nginx.sh | ||
[Install] | ||
WantedBy=multi-user.target |
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,31 @@ | ||
<html></html> | ||
<title>Hello Gardener Community!</title> | ||
<head> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script> | ||
<style> | ||
.mono { | ||
font-family: monospace, monospace; | ||
} | ||
</style> | ||
</head> | ||
<body class="grey darken-4"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col s12 m6 offset-m3"> | ||
<u class="blue-text darken-4"> | ||
<h3 class="center-align blue-text darken-4 mono">IronCore</h3> | ||
</u> | ||
<img class="materiaboxed" | ||
alt="IronCore Logo" | ||
width="100%" | ||
src="https://github.com/ironcore-dev/ironcore/raw/main/docs/assets/logo.png" /> | ||
<a style="margin-left: 7px" class="waves-effect waves-light btn mono blue darken-4">IroneCore Project</a> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
<script type="application/javascript"> | ||
M.AutoInit(); | ||
</script> | ||
</html> |
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,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
apt-get update | ||
apt-get -yq install nginx |
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,2 @@ | ||
resources: | ||
- ignition-secret.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,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
butane -d . ignition.yaml | \ | ||
kubectl create secret generic ignition --from-file=ignition.yaml=/dev/stdin --dry-run=client -o yaml \ | ||
> ../ignition/ignition-secret.yaml |
6 changes: 6 additions & 0 deletions
6
config/samples/e2e/bases/nonephemeral-machine/kustomization.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,6 @@ | ||
resources: | ||
- network.yaml | ||
- virtualIP.yaml | ||
- networkinterface.yaml | ||
- volume.yaml | ||
- machine.yaml |
20 changes: 20 additions & 0 deletions
20
config/samples/e2e/bases/nonephemeral-machine/machine.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,20 @@ | ||
apiVersion: compute.ironcore.dev/v1alpha1 | ||
kind: Machine | ||
metadata: | ||
name: machine-sample | ||
spec: | ||
machineClassRef: | ||
name: machineclass-sample | ||
volumes: | ||
- name: rootdisk # first disk is root disk | ||
volumeRef: | ||
name: volume-sample | ||
ignitionRef: | ||
name: ignition | ||
key: ignition.yaml | ||
networkInterfaces: | ||
- name: primary | ||
networkInterfaceRef: | ||
name: networkinterface-sample | ||
|
||
|
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,4 @@ | ||
apiVersion: networking.ironcore.dev/v1alpha1 | ||
kind: Network | ||
metadata: | ||
name: network-sample |
14 changes: 14 additions & 0 deletions
14
config/samples/e2e/bases/nonephemeral-machine/networkinterface.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,14 @@ | ||
apiVersion: networking.ironcore.dev/v1alpha1 | ||
kind: NetworkInterface | ||
metadata: | ||
name: networkinterface-sample | ||
spec: | ||
networkRef: | ||
name: network-sample | ||
ipFamilies: | ||
- IPv4 | ||
ips: | ||
- value: 10.0.0.1 # internal IP | ||
virtualIP: | ||
virtualIPRef: | ||
name: virtualip-sample |
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 @@ | ||
apiVersion: networking.ironcore.dev/v1alpha1 | ||
kind: VirtualIP | ||
metadata: | ||
name: virtualip-sample | ||
spec: | ||
type: Public | ||
ipFamily: IPv4 |
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,10 @@ | ||
apiVersion: storage.ironcore.dev/v1alpha1 | ||
kind: Volume | ||
metadata: | ||
name: volume-sample | ||
spec: | ||
volumeClassRef: | ||
name: volumeclass-sample | ||
image: gardenlinux:rootfs-image | ||
resources: | ||
storage: 10Gi |
53 changes: 53 additions & 0 deletions
53
config/samples/e2e/machine-with-non-ephemeral-resource/README.md
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,53 @@ | ||
# `Machine` non ephemeral resources | ||
|
||
This example deploys a `Machine` with `non-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` 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 | ||
|
||
``` | ||
apiVersion: compute.ironcore.dev/v1alpha1 | ||
kind: Machine | ||
metadata: | ||
name: machine-sample | ||
spec: | ||
machineClassRef: | ||
name: new-machineClass # The new name of the machine class reference | ||
machinePoolRef: | ||
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 | ||
|
||
``` | ||
apiVersion: storage.ironcore.dev/v1alpha1 | ||
kind: Volume | ||
metadata: | ||
name: volume-sample | ||
spec: | ||
volumeClassRef: | ||
name: new-volumeClass The new name of the volume class reference | ||
image: new-image:rootfs | ||
volumePoolRef: | ||
name: new-volumePool | ||
``` | ||
6. Update the `kustomization.yaml` with below content | ||
``` | ||
patches: | ||
- path: patch-machineclassref.yaml | ||
- path: patch-volume.yaml | ||
``` | ||
|
||
7. Run (`kubectl apply -k ./`) |
8 changes: 8 additions & 0 deletions
8
config/samples/e2e/machine-with-non-ephemeral-resource/kustomization.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,8 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: test | ||
|
||
resources: | ||
- ../bases/ignition | ||
- ../bases/nonephemeral-machine |
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