From 74bcb0bcbf7eb46f37e5292f29dee3c8e936d9e1 Mon Sep 17 00:00:00 2001 From: Sebastian Krieger Date: Mon, 25 Oct 2021 08:35:40 +0200 Subject: [PATCH] Add implementation for arm64 --- ...ermlog_linux.go => termlog_linux_amd64.go} | 0 .../terminationlog/termlog_linux_arm64.go | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+) rename maintenance/terminationlog/{termlog_linux.go => termlog_linux_amd64.go} (100%) create mode 100644 maintenance/terminationlog/termlog_linux_arm64.go diff --git a/maintenance/terminationlog/termlog_linux.go b/maintenance/terminationlog/termlog_linux_amd64.go similarity index 100% rename from maintenance/terminationlog/termlog_linux.go rename to maintenance/terminationlog/termlog_linux_amd64.go diff --git a/maintenance/terminationlog/termlog_linux_arm64.go b/maintenance/terminationlog/termlog_linux_arm64.go new file mode 100644 index 000000000..2273f9d76 --- /dev/null +++ b/maintenance/terminationlog/termlog_linux_arm64.go @@ -0,0 +1,27 @@ +// Package terminationlog helps to fill the kubernetes termination log. +// From the doc: +// Termination messages provide a way for containers to write information +// about fatal events to a location where it can be easily retrieved and +// surfaced by tools like dashboards and monitoring software. In most +// cases, information that you put in a termination message should also +// be written to the general Kubernetes logs. +package terminationlog + +import ( + "os" + "syscall" +) + +// termLog default location of kubernetes termination log +const termLog = "/dev/termination-log" + +func init() { + file, err := os.OpenFile(termLog, os.O_RDWR, 0666) + + if err == nil { + logFile = file + + // redirect stderr to the termLog + syscall.Dup3(int(logFile.Fd()), 2, 0) // nolint: errcheck + } +}