From 7692e551be57a51b1ff8f77bdf514e87903cc655 Mon Sep 17 00:00:00 2001 From: e-minguez Date: Mon, 25 Mar 2024 12:31:24 +0100 Subject: [PATCH] Requested changes from Atanas --- .../custom/files/basic-setup.sh | 60 ++----------------- .../custom/files/edge-stack-setup.service | 4 +- .../edge-stack-iso/custom/files/metal3.sh | 2 - .../custom/scripts/99_edge-setup.sh | 16 ++--- examples/edge-stack-iso/eib.yaml | 15 ++--- .../kubernetes/config/agent.yaml | 2 +- .../kubernetes/config/server.yaml | 2 +- 7 files changed, 19 insertions(+), 82 deletions(-) diff --git a/examples/edge-stack-iso/custom/files/basic-setup.sh b/examples/edge-stack-iso/custom/files/basic-setup.sh index 37ebdb8c..f2b3cac8 100755 --- a/examples/edge-stack-iso/custom/files/basic-setup.sh +++ b/examples/edge-stack-iso/custom/files/basic-setup.sh @@ -5,34 +5,10 @@ export K3SKUBECTL="/opt/bin/kubectl" export RKE2KUBECONFIG="/etc/rancher/rke2/rke2.yaml" export K3SKUBECONFIG="/etc/rancher/k3s/k3s.yaml" -export SUSECAFILE="/usr/share/pki/trust/anchors/SUSE_Trust_Root.crt.pem" -export SUSECACM="suse-internal-ca" -export SUSECACMNAMESPACE="kube-system" - -######################## -# METAL3 CHART DETAILS # -######################## -export METAL3_CHART_NAME="metal3" -export METAL3_CHART_VERSION="0.6.3" -export METAL3_CHART_VALUESFILE="metal3.yaml" -export METAL3_CHART_CREATENAMESPACE="True" -export METAL3_CHART_INSTALLATIONNAMESPACE="kube-system" +################## +# METAL3 DETAILS # +################## export METAL3_CHART_TARGETNAMESPACE="metal3-system" - -########################### -# METAL3 CHART REPOSITORY # -########################### -export METAL3_CHART_REPOSITORY_NAME="suse-edge" -export METAL3_CHART_REPOSITORY_URL="https://suse-edge.github.io/charts" -export METAL3_CHART_REPOSITORY_CAFILE="" -export METAL3_CHART_REPOSITORY_PLAINHTTP="False" -export METAL3_CHART_REPOSITORY_SKIPTLSVERIFY="False" -export METAL3_CHART_REPOSITORY_USERNAME="" -export METAL3_CHART_REPOSITORY_PASSWORD="" - -############### -# METAL3 CAPI # -############### export METAL3_CLUSTERCTLVERSION="1.6.2" export METAL3_CAPICOREVERSION="1.6.0" export METAL3_CAPIMETAL3VERSION="1.6.0" @@ -51,26 +27,9 @@ export METALLBNAMESPACE="metallb-system" ########### # RANCHER # ########### -export RANCHER_CHART_NAME="rancher" -export RANCHER_CHART_VERSION="2.8.2" -export RANCHER_CHART_VALUESFILE="rancher.yaml" -export RANCHER_CHART_CREATENAMESPACE="True" -export RANCHER_CHART_INSTALLATIONNAMESPACE="kube-system" export RANCHER_CHART_TARGETNAMESPACE="cattle-system" - export RANCHER_FINALPASSWORD="adminadminadmin" -############################ -# RANCHER CHART REPOSITORY # -############################ -export RANCHER_CHART_REPOSITORY_NAME="rancher-stable" -export RANCHER_CHART_REPOSITORY_URL="https://releases.rancher.com/server-charts/stable" -export RANCHER_CHART_REPOSITORY_CAFILE="" -export RANCHER_CHART_REPOSITORY_PLAINHTTP="False" -export RANCHER_CHART_REPOSITORY_SKIPTLSVERIFY="False" -export RANCHER_CHART_REPOSITORY_USERNAME="" -export RANCHER_CHART_REPOSITORY_PASSWORD="" - die(){ echo ${1} 1>&2 exit ${2} @@ -103,15 +62,4 @@ setup_kubetools(){ fi } -setup_suse_internal_ca(){ - # Check if the CA configmap is already available - if [ $(${KUBECTL} get configmap -n ${SUSECACMNAMESPACE} ${SUSECACM} -o name | wc -l) -lt 1 ]; then - if [ -f ${SUSECAFILE} ]; then - # Create the CA - ${KUBECTL} create cm ${SUSECACM} -n ${SUSECACMNAMESPACE} --from-file=ca.crt=${SUSECAFILE} - fi - fi -} - -setup_kubetools -setup_suse_internal_ca \ No newline at end of file +setup_kubetools \ No newline at end of file diff --git a/examples/edge-stack-iso/custom/files/edge-stack-setup.service b/examples/edge-stack-iso/custom/files/edge-stack-setup.service index 5852a100..fd78df36 100755 --- a/examples/edge-stack-iso/custom/files/edge-stack-setup.service +++ b/examples/edge-stack-iso/custom/files/edge-stack-setup.service @@ -3,7 +3,7 @@ Description=Setup Edge stack components Wants=network-online.target # It requires rke2 or k3s running, but it won't fail if those services are not present After=network.target network-online.target rke2-server.service k3s.service -# At least, the common.sh needs to be present +# At least, the basic-setup.sh one needs to be present ConditionPathExists=/opt/edge/bin/basic-setup.sh [Service] @@ -13,7 +13,7 @@ Type=forking TimeoutStartSec=1800 ExecStartPre=/bin/sh -c "echo 'Setting up Edge components...'" -# Scripts are executed in StartPre because it can be multiple ones +# Scripts are executed in StartPre because Start can only run a single on ExecStartPre=/opt/edge/bin/rancher.sh ExecStartPre=/opt/edge/bin/metal3.sh ExecStart=/bin/sh -c "echo 'Finished setting up Edge components'" diff --git a/examples/edge-stack-iso/custom/files/metal3.sh b/examples/edge-stack-iso/custom/files/metal3.sh index f961d6d7..83cccdbb 100755 --- a/examples/edge-stack-iso/custom/files/metal3.sh +++ b/examples/edge-stack-iso/custom/files/metal3.sh @@ -22,8 +22,6 @@ while ! ${KUBECTL} wait --for condition=ready -n ${METAL3_CHART_TARGETNAMESPACE} # Get the ironic IP IRONICIP=$(${KUBECTL} get cm -n ${METAL3_CHART_TARGETNAMESPACE} ironic-bmo -o jsonpath='{.data.IRONIC_IP}') -# This only works for metallb, we need to do the same for nodeport I guess - # Wait for metallb while ! ${KUBECTL} wait --for condition=ready -n ${METALLBNAMESPACE} $(${KUBECTL} get pods -n ${METALLBNAMESPACE} -l app.kubernetes.io/component=controller -o name) --timeout=10s; do sleep 2 ; done diff --git a/examples/edge-stack-iso/custom/scripts/99_edge-setup.sh b/examples/edge-stack-iso/custom/scripts/99_edge-setup.sh index 14f8508c..88ccd335 100755 --- a/examples/edge-stack-iso/custom/scripts/99_edge-setup.sh +++ b/examples/edge-stack-iso/custom/scripts/99_edge-setup.sh @@ -1,17 +1,11 @@ #!/bin/bash -# Copy the basic setup script from combustion to the final location +# Copy the scripts from combustion to the final location mkdir -p /opt/edge/bin/ -cp basic-setup.sh /opt/edge/bin/ -chmod a+x /opt/edge/bin/basic-setup.sh +for script in basic-setup.sh rancher.sh metal3.sh; do + cp ${script} /opt/edge/bin/ +done -# Same for rancher -cp rancher.sh /opt/edge/bin/ -chmod a+x /opt/edge/bin/rancher.sh -# Same for metal3 -cp metal3.sh /opt/edge/bin/ -chmod a+x /opt/edge/bin/metal3.sh - -# Copy the systemd unit file +# Copy the systemd unit file and enable it at boot cp edge-stack-setup.service /etc/systemd/system/edge-stack-setup.service systemctl enable edge-stack-setup.service \ No newline at end of file diff --git a/examples/edge-stack-iso/eib.yaml b/examples/edge-stack-iso/eib.yaml index f18263a0..e6f08958 100755 --- a/examples/edge-stack-iso/eib.yaml +++ b/examples/edge-stack-iso/eib.yaml @@ -1,9 +1,9 @@ apiVersion: 1.0 image: arch: x86_64 - baseImage: SLE-Micro.x86_64-5.5.0-Default-SelfInstall-Build8.2.8.install.iso + baseImage: SLE-Micro.x86_64-5.5.0-Default-SelfInstall.install.iso imageType: iso - outputImageName: 3xhosts-rke2-rancher-metal3.iso + outputImageName: 3xhosts-rke2-rancher-metal3-longhorn-neuvector.iso kubernetes: helm: charts: @@ -56,12 +56,12 @@ kubernetes: apiHost: 192.168.122.10.sslip.io apiVIP: 192.168.122.10 nodes: - - hostname: host1rke2 + - hostname: host1rke2.example.com initializer: true type: server - - hostname: host2rke2 + - hostname: host2rke2.example.com type: server - - hostname: host3rke2 + - hostname: host3rke2.example.com type: server version: v1.27.10+rke2r1 operatingSystem: @@ -69,11 +69,8 @@ operatingSystem: installDevice: /dev/vda unattended: true packages: - additionalRepos: - - url: http://download.suse.de/ibs/SUSE:/CA/SLE_15/ packageList: - jq - - ca-certificates-suse - qemu-guest-agent sccRegistrationCode: systemd: @@ -85,7 +82,7 @@ operatingSystem: enable: - qemu-guest-agent users: - - encryptedPassword: $6$pIaPu6MaCmDzvjcR$H36l7tV8tZqBaPpq35CLHCzT9AvJU8TTs/IW9RLsFIVYtVnc6VkwaaQh6wbi4McQyzpjHROrvT4TdRuyKe0xF/ + - encryptedPassword: sshKeys: - ssh-rsa username: root diff --git a/examples/edge-stack-iso/kubernetes/config/agent.yaml b/examples/edge-stack-iso/kubernetes/config/agent.yaml index 1f0c84db..46da8e04 100755 --- a/examples/edge-stack-iso/kubernetes/config/agent.yaml +++ b/examples/edge-stack-iso/kubernetes/config/agent.yaml @@ -1,6 +1,6 @@ cni: - multus - cilium -kubeconfigmode: '0644' +write-kubeconfig-mode: '0644' selinux: true token: foobar diff --git a/examples/edge-stack-iso/kubernetes/config/server.yaml b/examples/edge-stack-iso/kubernetes/config/server.yaml index 1f0c84db..46da8e04 100755 --- a/examples/edge-stack-iso/kubernetes/config/server.yaml +++ b/examples/edge-stack-iso/kubernetes/config/server.yaml @@ -1,6 +1,6 @@ cni: - multus - cilium -kubeconfigmode: '0644' +write-kubeconfig-mode: '0644' selinux: true token: foobar