Skip to content

Commit

Permalink
Fix invalid Kubernetes pod names (flyteorg#325)
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Lin <[email protected]>
  • Loading branch information
mayitbeegh authored Oct 21, 2021
1 parent bd32547 commit 486632d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"strings"
"time"

"k8s.io/apimachinery/pkg/util/validation"

"sigs.k8s.io/controller-runtime/pkg/client"

"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -115,6 +117,10 @@ func (e *PluginManager) AddObjectMetadata(taskCtx pluginsCore.TaskExecutionMetad
f := append(o.GetFinalizers(), finalizer)
o.SetFinalizers(f)
}

if errs := validation.IsDNS1123Subdomain(o.GetName()); len(errs) > 0 {
o.SetName(utils.ConvertToDNS1123SubdomainCompatibleString(o.GetName()))
}
}

func (e *PluginManager) GetProperties() pluginsCore.PluginProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ func TestPluginManager_CustomKubeClient(t *testing.T) {
}

func TestPluginManager_AddObjectMetadata(t *testing.T) {
genName := "genName"
genName := "gen-name"
ns := "ns"
or := v12.OwnerReference{}
l := map[string]string{"l1": "lv1"}
Expand Down

0 comments on commit 486632d

Please sign in to comment.