diff --git a/config/samples/e2e/bases/ignition/ignition-secret.yaml b/config/samples/e2e/bases/ignition/ignition-secret.yaml new file mode 100644 index 000000000..eb53bc20a --- /dev/null +++ b/config/samples/e2e/bases/ignition/ignition-secret.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +data: + ignition.yaml: eyJpZ25pdGlvbiI6eyJ2ZXJzaW9uIjoiMy4zLjAifSwicGFzc3dkIjp7InVzZXJzIjpbeyJncm91cHMiOlsid2hlZWwiXSwiaG9tZURpciI6Ii9ob21lL3lvdXItdXNlciIsIm5hbWUiOiJ5b3VyLXVzZXIiLCJwYXNzd29yZEhhc2giOiJ5b3VyLXB3LWhhc2giLCJzaGVsbCI6Ii9iaW4vYmFzaCJ9XX0sInN0b3JhZ2UiOnsiZGlyZWN0b3JpZXMiOlt7Imdyb3VwIjp7Im5hbWUiOiJ5b3VyLXVzZXIifSwicGF0aCI6Ii9ob21lL3lvdXItdXNlci8uc3NoIiwidXNlciI6eyJuYW1lIjoieW91ci11c2VyIn0sIm1vZGUiOjQ0OH1dLCJmaWxlcyI6W3sicGF0aCI6Ii9ldGMvc3lzdGVtZC9yZXNvbHZlZC5jb25mLmQvZG5zLmNvbmYiLCJjb250ZW50cyI6eyJjb21wcmVzc2lvbiI6IiIsInNvdXJjZSI6ImRhdGE6LCU1QlJlc29sdmUlNUQlMEFETlMlM0QxLjEuMS4xJTBBIn0sIm1vZGUiOjQyMH0seyJncm91cCI6eyJuYW1lIjoieW91ci11c2VyIn0sInBhdGgiOiIvaG9tZS95b3VyLXVzZXIvLnNzaC9hdXRob3JpemVkX2tleXMiLCJ1c2VyIjp7Im5hbWUiOiJ5b3VyLXVzZXIifSwiY29udGVudHMiOnsiY29tcHJlc3Npb24iOiIiLCJzb3VyY2UiOiJkYXRhOix5b3VyLXNzaC1rZXkifSwibW9kZSI6Mzg0fSx7InBhdGgiOiIvaW5zdGFsbC1uZ2lueC5zaCIsImNvbnRlbnRzIjp7ImNvbXByZXNzaW9uIjoiIiwic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INytwR1lDdGhMTjFZMHJOV0RHcHBsUHNyOG82c0dJMW5YZGVsMjgrak1abVAyekJpeFdwNUxuTHFhS093Njd5ektJNkQzdUVlcCtEYzc1LzUxMTc0UGpoNTkvNTI5ZlFVNWovRXZ3QUFBUC8vbFFMTVdpOEVBQUE9In0sIm1vZGUiOjQzOH1dfSwic3lzdGVtZCI6eyJ1bml0cyI6W3siZW5hYmxlZCI6dHJ1ZSwibmFtZSI6InNzaC5zZXJ2aWNlIn0seyJjb250ZW50cyI6IltVbml0XVxuRGVzY3JpcHRpb249SW5zdGFsbCBuZ2lueFxuW1NlcnZpY2VdXG5UeXBlPW9uZXNob3RcblJlbWFpbkFmdGVyRXhpdD15ZXNcbkV4ZWNTdGFydD0vaW5zdGFsbC1uZ2lueC5zaFxuW0luc3RhbGxdXG5XYW50ZWRCeT1tdWx0aS11c2VyLnRhcmdldFxuIiwiZW5hYmxlZCI6dHJ1ZSwibmFtZSI6Imluc3RhbGwtbmdpbnguc2VydmljZSJ9XX19Cg== +kind: Secret +metadata: + creationTimestamp: null + name: ignition diff --git a/config/samples/e2e/bases/ignition/ignition.yaml b/config/samples/e2e/bases/ignition/ignition.yaml new file mode 100644 index 000000000..d57218764 --- /dev/null +++ b/config/samples/e2e/bases/ignition/ignition.yaml @@ -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 diff --git a/config/samples/e2e/bases/ignition/index.html b/config/samples/e2e/bases/ignition/index.html new file mode 100644 index 000000000..d81182c71 --- /dev/null +++ b/config/samples/e2e/bases/ignition/index.html @@ -0,0 +1,31 @@ + +Hello Gardener Community! + + + + + + +
+
+
+ +

IronCore

+
+ IronCore Logo + IroneCore Project +
+
+
+ + + \ No newline at end of file diff --git a/config/samples/e2e/bases/ignition/install-nginx.sh b/config/samples/e2e/bases/ignition/install-nginx.sh new file mode 100644 index 000000000..7409b74d7 --- /dev/null +++ b/config/samples/e2e/bases/ignition/install-nginx.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +apt-get update +apt-get -yq install nginx \ No newline at end of file diff --git a/config/samples/e2e/bases/ignition/kustomization.yaml b/config/samples/e2e/bases/ignition/kustomization.yaml new file mode 100644 index 000000000..ec65b5061 --- /dev/null +++ b/config/samples/e2e/bases/ignition/kustomization.yaml @@ -0,0 +1,2 @@ +resources: +- ignition-secret.yaml \ No newline at end of file diff --git a/config/samples/e2e/bases/ignition/regenerate-ignition.sh b/config/samples/e2e/bases/ignition/regenerate-ignition.sh new file mode 100644 index 000000000..d25e070dd --- /dev/null +++ b/config/samples/e2e/bases/ignition/regenerate-ignition.sh @@ -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 \ No newline at end of file diff --git a/config/samples/e2e/bases/nonephemeral-machine/kustomization.yaml b/config/samples/e2e/bases/nonephemeral-machine/kustomization.yaml new file mode 100644 index 000000000..c29633cc9 --- /dev/null +++ b/config/samples/e2e/bases/nonephemeral-machine/kustomization.yaml @@ -0,0 +1,6 @@ +resources: +- network.yaml +- virtualIP.yaml +- networkinterface.yaml +- volume.yaml +- machine.yaml \ No newline at end of file diff --git a/config/samples/e2e/bases/nonephemeral-machine/machine.yaml b/config/samples/e2e/bases/nonephemeral-machine/machine.yaml new file mode 100644 index 000000000..1c5af42e8 --- /dev/null +++ b/config/samples/e2e/bases/nonephemeral-machine/machine.yaml @@ -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 + + diff --git a/config/samples/e2e/bases/nonephemeral-machine/network.yaml b/config/samples/e2e/bases/nonephemeral-machine/network.yaml new file mode 100644 index 000000000..99268931d --- /dev/null +++ b/config/samples/e2e/bases/nonephemeral-machine/network.yaml @@ -0,0 +1,4 @@ +apiVersion: networking.ironcore.dev/v1alpha1 +kind: Network +metadata: + name: network-sample diff --git a/config/samples/e2e/bases/nonephemeral-machine/networkinterface.yaml b/config/samples/e2e/bases/nonephemeral-machine/networkinterface.yaml new file mode 100644 index 000000000..5effdd2e4 --- /dev/null +++ b/config/samples/e2e/bases/nonephemeral-machine/networkinterface.yaml @@ -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 \ No newline at end of file diff --git a/config/samples/e2e/bases/nonephemeral-machine/virtualIP.yaml b/config/samples/e2e/bases/nonephemeral-machine/virtualIP.yaml new file mode 100644 index 000000000..372eb81cc --- /dev/null +++ b/config/samples/e2e/bases/nonephemeral-machine/virtualIP.yaml @@ -0,0 +1,7 @@ +apiVersion: networking.ironcore.dev/v1alpha1 +kind: VirtualIP +metadata: + name: virtualip-sample +spec: + type: Public + ipFamily: IPv4 diff --git a/config/samples/e2e/bases/nonephemeral-machine/volume.yaml b/config/samples/e2e/bases/nonephemeral-machine/volume.yaml new file mode 100644 index 000000000..fc08d2dcc --- /dev/null +++ b/config/samples/e2e/bases/nonephemeral-machine/volume.yaml @@ -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 diff --git a/config/samples/e2e/machine-with-non-ephemeral-resource/README.md b/config/samples/e2e/machine-with-non-ephemeral-resource/README.md new file mode 100644 index 000000000..a2b8e3f66 --- /dev/null +++ b/config/samples/e2e/machine-with-non-ephemeral-resource/README.md @@ -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 ./`) \ No newline at end of file diff --git a/config/samples/e2e/machine-with-non-ephemeral-resource/kustomization.yaml b/config/samples/e2e/machine-with-non-ephemeral-resource/kustomization.yaml new file mode 100644 index 000000000..629742fe7 --- /dev/null +++ b/config/samples/e2e/machine-with-non-ephemeral-resource/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: test + +resources: +- ../bases/ignition +- ../bases/nonephemeral-machine diff --git a/internal/app/app_suite_test.go b/internal/app/app_suite_test.go index d7735a287..07349b0f7 100644 --- a/internal/app/app_suite_test.go +++ b/internal/app/app_suite_test.go @@ -32,7 +32,7 @@ import ( const ( pollingInterval = 50 * time.Millisecond - eventuallyTimeout = 5 * time.Second + eventuallyTimeout = 3 * time.Second consistentlyDuration = 1 * time.Second apiServiceTimeout = 5 * time.Minute )