Minimize code + docker + monitord naming

This commit is contained in:
mr
2024-08-19 11:43:40 +02:00
parent 99bdc1b784
commit feca395039
22 changed files with 150 additions and 751 deletions

View File

@@ -5,35 +5,34 @@ import (
)
type ArgoWatch struct {
Name string
Namespace string
Status string
Name string
Namespace string
Status string
Conditions
Created string
Started string
Duration string
Progress string
Created string
Started string
Duration string
Progress string
}
type Conditions struct{
PodRunning bool
Completed bool
type Conditions struct {
PodRunning bool
Completed bool
}
func (a *ArgoWatch) Equals(arg ArgoWatch) bool {
return a.Status == arg.Status && a.Progress == arg.Progress && a.Conditions.PodRunning == arg.Conditions.PodRunning && a.Conditions.Completed == arg.Conditions.Completed
}
// Take the slice of string that make up one round of stderr outputs from the --watch option in argo submit
// Take the slice of string that make up one round of stderr outputs from the --watch option in argo submit
func NewArgoLogs(inputs []string) *ArgoWatch {
var workflow ArgoWatch
for _, input := range inputs {
line := strings.TrimSpace(input)
if line == "" {
continue
}
switch {
case strings.HasPrefix(line, "Name:"):
workflow.Name = parseValue(line)
@@ -70,4 +69,4 @@ func parseValue(line string) string {
func parseBoolValue(line string) bool {
value := parseValue(line)
return value == "True"
}
}