Finished to implement admiralty onto the final argo yaml file and restructured file creation

This commit is contained in:
pb
2025-04-02 11:40:14 +02:00
parent 73e1747c91
commit 08ade1af66
5 changed files with 125 additions and 54 deletions

View File

@@ -58,6 +58,7 @@ type Dag struct {
type TemplateMetadata struct {
Labels map[string]string `yaml:"labels,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty"`
}
type Secret struct {
@@ -139,3 +140,13 @@ func (template *Template) ReplacePerEnv(arg string, envs []models.Param) string
}
return arg
}
// Add the metadata that allow Admiralty to pick up an Argo Workflow that needs to be reparted
// The value of "clustername" is the peerId, which must be replaced by the node name's for this specific execution
func (t *Template) AddAdmiraltyAnnotations(peerId string){
if t.Metadata.Annotations == nil {
t.Metadata.Annotations = make(map[string]string)
}
t.Metadata.Annotations["multicluster.admiralty.io/elect"] = ""
t.Metadata.Annotations["multicluster.admiralty.io/clustername"] = peerId
}