create func to parse deadline from env var
@@ -107,3 +107,16 @@ func getKuberhealthyURL() (string, error) {
return reportingURL, nil
}
+
+// GetDeadline fetches the KH_CHECK_RUN_DEADLINE environment variable and returns it.
+// Checks are given up to the deadline to complete their check runs.
+func GetDeadline() (string, error) {
+ unixDeadline := os.Getenv(external.KHDeadline)
+
+ if len(unixDeadline) < 1 {
+ writeLog("ERROR: kuberhealthy check deadline from environment variable", external.KHDeadline, "was blank")
+ return "", fmt.Errorf("fetched %s environment variable but it was blank", external.KHDeadline)
+ }
+
+ return unixDeadline, nil
+}
