Skip to content

Commit

Permalink
Requested changes from Atanas
Browse files Browse the repository at this point in the history
  • Loading branch information
e-minguez committed Mar 25, 2024
1 parent 13862a1 commit 7692e55
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 82 deletions.
60 changes: 4 additions & 56 deletions examples/edge-stack-iso/custom/files/basic-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}
Expand Down Expand Up @@ -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
setup_kubetools
4 changes: 2 additions & 2 deletions examples/edge-stack-iso/custom/files/edge-stack-setup.service
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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'"
Expand Down
2 changes: 0 additions & 2 deletions examples/edge-stack-iso/custom/files/metal3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 5 additions & 11 deletions examples/edge-stack-iso/custom/scripts/99_edge-setup.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 6 additions & 9 deletions examples/edge-stack-iso/eib.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -56,24 +56,21 @@ 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:
isoConfiguration:
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: <REGISTRATION CODE>
systemd:
Expand All @@ -85,7 +82,7 @@ operatingSystem:
enable:
- qemu-guest-agent
users:
- encryptedPassword: $6$pIaPu6MaCmDzvjcR$H36l7tV8tZqBaPpq35CLHCzT9AvJU8TTs/IW9RLsFIVYtVnc6VkwaaQh6wbi4McQyzpjHROrvT4TdRuyKe0xF/
- encryptedPassword: <ENCRYPTED PASSWORD>
sshKeys:
- ssh-rsa <PUBLIC KEY>
username: root
2 changes: 1 addition & 1 deletion examples/edge-stack-iso/kubernetes/config/agent.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cni:
- multus
- cilium
kubeconfigmode: '0644'
write-kubeconfig-mode: '0644'
selinux: true
token: foobar
2 changes: 1 addition & 1 deletion examples/edge-stack-iso/kubernetes/config/server.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cni:
- multus
- cilium
kubeconfigmode: '0644'
write-kubeconfig-mode: '0644'
selinux: true
token: foobar

0 comments on commit 7692e55

Please sign in to comment.