Skip to content

Commit 0d52887

Browse files
committed
feat: add CSE integration for node-exporter service startup
1 parent 8d201b5 commit 0d52887

File tree

65 files changed

+259
-233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+259
-233
lines changed

parts/linux/cloud-init/artifacts/cse_config.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,25 @@ EOF
792792
systemctlEnableAndStart mig-partition 300
793793
}
794794

795+
configureNodeExporter() {
796+
echo "Configuring Node Exporter"
797+
# Check for skip file to determine if node-exporter was installed on this VHD
798+
if [ ! -f /etc/node-exporter.d/skip_vhd_node_exporter ]; then
799+
echo "Node Exporter assets not found on this VHD (missing /etc/node-exporter.d/skip_vhd_node_exporter); skipping configuration."
800+
return 0
801+
fi
802+
803+
if ! systemctlEnableAndStart node-exporter 30; then
804+
echo "Failed to start node-exporter service"
805+
return $ERR_NODE_EXPORTER_START_FAIL
806+
fi
807+
if ! systemctlEnableAndStart node-exporter-restart.path 30; then
808+
echo "Failed to start node-exporter-restart.path"
809+
return $ERR_NODE_EXPORTER_START_FAIL
810+
fi
811+
echo "Node Exporter started successfully"
812+
}
813+
795814
ensureSysctl() {
796815
SYSCTL_CONFIG_FILE=/etc/sysctl.d/999-sysctl-aks.conf
797816
mkdir -p "$(dirname "${SYSCTL_CONFIG_FILE}")"

parts/linux/cloud-init/artifacts/cse_helpers.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ ERR_KUBECTL_INSTALL_FAIL=122 # Error installing kubectl
7575
# Error code 124 is returned when a `timeout` command times out, and --preserve-status is not specified: https://man7.org/linux/man-pages/man1/timeout.1.html
7676
ERR_VHD_BUILD_ERROR=125 # Reserved for VHD CI exit conditions
7777

78+
ERR_NODE_EXPORTER_START_FAIL=128 # Error starting or enabling node-exporter service
79+
7880
ERR_SWAP_CREATE_FAIL=130 # Error allocating swap file
7981
ERR_SWAP_CREATE_INSUFFICIENT_DISK_SPACE=131 # Error insufficient disk space for swap file creation
8082

parts/linux/cloud-init/artifacts/cse_main.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ function nodePrep {
461461

462462
logs_to_events "AKS.CSE.ensureKubelet" ensureKubelet
463463

464+
logs_to_events "AKS.CSE.configureNodeExporter" configureNodeExporter
465+
464466
if $REBOOTREQUIRED; then
465467
echo 'reboot required, rebooting node in 1 minute'
466468
/bin/bash -c "shutdown -r 1 &"

parts/linux/cloud-init/artifacts/manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
"versions": []
2323
}
2424
}
25+
#EOF

pkg/agent/testdata/AKSUbuntu2204+China/CustomData

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

pkg/agent/testdata/AKSUbuntu2204+Containerd+CDI/CustomData

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

pkg/agent/testdata/AKSUbuntu2204+Containerd+DevicePlugin/CustomData

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

pkg/agent/testdata/AKSUbuntu2204+Containerd+MIG+ArtifactStreaming/CustomData

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

pkg/agent/testdata/AKSUbuntu2204+Containerd+MIG/CustomData

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

pkg/agent/testdata/AKSUbuntu2204+CustomCloud+USNat/CustomData

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)