From a9e6e966977c1fc2a5226062ea1d2fd0033ee8c0 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 23 Jan 2024 05:01:23 -0500 Subject: [PATCH] feat: implement scheduler-k3s:report --- plugins/scheduler-k3s/functions.go | 6 +- plugins/scheduler-k3s/report.go | 94 +++++++++++++++++++++++++++++- 2 files changed, 95 insertions(+), 5 deletions(-) diff --git a/plugins/scheduler-k3s/functions.go b/plugins/scheduler-k3s/functions.go index 1406a430b..075fc2a34 100644 --- a/plugins/scheduler-k3s/functions.go +++ b/plugins/scheduler-k3s/functions.go @@ -295,14 +295,14 @@ func getLetsencryptServer(appName string) string { return common.PropertyGetDefault("scheduler-k3s", appName, "letsencrypt-server", "") } -func getGlobalLetsencryptServer(appName string) string { - return common.PropertyGetDefault("scheduler-k3s", appName, "letsencrypt-server", "prod") +func getGlobalLetsencryptServer() string { + return common.PropertyGetDefault("scheduler-k3s", "--global", "letsencrypt-server", "prod") } func getComputedLetsencryptServer(appName string) string { letsencryptServer := getLetsencryptServer(appName) if letsencryptServer == "" { - letsencryptServer = getGlobalLetsencryptServer(appName) + letsencryptServer = getGlobalLetsencryptServer() } return letsencryptServer diff --git a/plugins/scheduler-k3s/report.go b/plugins/scheduler-k3s/report.go index 601918c52..1974114fa 100644 --- a/plugins/scheduler-k3s/report.go +++ b/plugins/scheduler-k3s/report.go @@ -10,8 +10,26 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { return err } - // todo: add all fields - flags := map[string]common.ReportFunc{} + flags := map[string]common.ReportFunc{ + "--scheduler-k3s-computed-deploy-timeout": reportComputedDeployTimeout, + "--scheduler-k3s-deploy-timeout": reportDeployTimeout, + "--scheduler-k3s-global-deploy-timeout": reportGlobalDeployTimeout, + "--scheduler-k3s-computed-image-pull-secrets": reportComputedImagePullSecrets, + "--scheduler-k3s-image-pull-secrets": reportImagePullSecrets, + "--scheduler-k3s-global-image-pull-secrets": reportGlobalImagePullSecrets, + "--scheduler-k3s-computed-letsencrypt-server": reportComputedLetsencryptServer, + "--scheduler-k3s-letsencrypt-server": reportLetsencryptServer, + "--scheduler-k3s-global-letsencrypt-server": reportGlobalLetsencryptServer, + "--scheduler-k3s-global-letsencrypt-email-prod": reportGlobalLetsencryptEmailProd, + "--scheduler-k3s-global-letsencrypt-email-stag": reportGlobalLetsencryptEmailStag, + "--scheduler-k3s-computed-namespace": reportComputedNamespace, + "--scheduler-k3s-namespace": reportNamespace, + "--scheduler-k3s-global-namespace": reportGlobalNamespace, + "--scheduler-k3s-global-network-interface": reportGlobalNetworkInterface, + "--scheduler-k3s-computed-rollback-on-failure": reportComputedRollbackOnFailure, + "--scheduler-k3s-rollback-on-failure": reportRollbackOnFailure, + "--scheduler-k3s-global-rollback-on-failure": reportGlobalRollbackOnFailure, + } flagKeys := []string{} for flagKey := range flags { @@ -23,3 +41,75 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { infoFlags := common.CollectReport(appName, infoFlag, flags) return common.ReportSingleApp("scheduler-k3s", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter) } + +func reportComputedDeployTimeout(appName string) string { + return getComputedDeployTimeout(appName) +} + +func reportDeployTimeout(appName string) string { + return getDeployTimeout(appName) +} + +func reportGlobalDeployTimeout(appName string) string { + return getGlobalDeployTimeout() +} + +func reportComputedImagePullSecrets(appName string) string { + return getComputedImagePullSecrets(appName) +} + +func reportImagePullSecrets(appName string) string { + return getImagePullSecrets(appName) +} + +func reportGlobalImagePullSecrets(appName string) string { + return getGlobalImagePullSecrets() +} + +func reportComputedLetsencryptServer(appName string) string { + return getComputedLetsencryptServer(appName) +} + +func reportLetsencryptServer(appName string) string { + return getLetsencryptServer(appName) +} + +func reportGlobalLetsencryptServer(appName string) string { + return getGlobalLetsencryptServer() +} + +func reportGlobalLetsencryptEmailProd(appName string) string { + return getGlobalLetsencryptEmailProd() +} + +func reportGlobalLetsencryptEmailStag(appName string) string { + return getGlobalLetsencryptEmailStag() +} + +func reportComputedNamespace(appName string) string { + return getComputedNamespace(appName) +} + +func reportNamespace(appName string) string { + return getNamespace(appName) +} + +func reportGlobalNamespace(appName string) string { + return getGlobalNamespace() +} + +func reportGlobalNetworkInterface(appName string) string { + return getGlobalNetworkInterface() +} + +func reportComputedRollbackOnFailure(appName string) string { + return getComputedRollbackOnFailure(appName) +} + +func reportRollbackOnFailure(appName string) string { + return getRollbackOnFailure(appName) +} + +func reportGlobalRollbackOnFailure(appName string) string { + return getGlobalRollbackOnFailure() +}