Modify trial names coming from the server
Use the last segment of the report trial URL instead of allowing Kube to generate the name.
@@ -18,6 +18,7 @@ package server
import (
"encoding/json"
+ "path"
"strconv"
redskyv1alpha1 "github.com/redskyops/k8s-experiment/pkg/apis/redsky/v1alpha1"
@@ -105,6 +106,11 @@ func ToCluster(exp *redskyv1alpha1.Experiment, ee *redskyapi.Experiment) {
func ToClusterTrial(trial *redskyv1alpha1.Trial, suggestion *redskyapi.TrialAssignments) {
trial.GetAnnotations()[redskyv1alpha1.AnnotationReportTrialURL] = suggestion.ReportTrial
+ // Try to make the cluster trial names match what is on the server
+ if trial.Name == "" {
+ trial.Name = trial.GenerateName + path.Base(suggestion.ReportTrial)
+ }
+
for _, a := range suggestion.Assignments {
if v, err := a.Value.Int64(); err == nil {
trial.Spec.Assignments = append(trial.Spec.Assignments, redskyv1alpha1.Assignment{
