Skip to content

Commit

Permalink
fixes job creation for long node names #21
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Pfennig <[email protected]>
  • Loading branch information
0xE282B0 committed Jun 12, 2023
1 parent a7a1eb7 commit 369ee9b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controllers/provisioner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package controllers

import (
"context"
"math"
"os"

"github.com/rs/zerolog/log"
Expand Down Expand Up @@ -139,10 +140,12 @@ func (r *ProvisionerReconciler) Reconcile(ctx context.Context, req ctrl.Request)
func (r *ProvisionerReconciler) deployJob(n *corev1.Node, req ctrl.Request) *batchv1.Job {

priv := true
name := req.Name + "-provision-kwasm"
nameMax := int(math.Min(float64(len(name)), 63))

dep := &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Name: req.Name + "-provision-kwasm",
Name: name[:nameMax],
Namespace: os.Getenv("CONTROLLER_NAMESPACE"),
Labels: map[string]string{"kwasm.sh/job": "true"},
},
Expand Down

0 comments on commit 369ee9b

Please sign in to comment.