Skip to content

Commit

Permalink
feat(restart): Make user optional
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <bob@vibioh.fr>
  • Loading branch information
ViBiOh committed Aug 9, 2023
1 parent be325d3 commit d830af5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cmd/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"strings"
Expand Down Expand Up @@ -63,17 +62,16 @@ var restartCmd = &cobra.Command{
resourceType := args[0]
resourceName := args[1]

if len(user) == 0 {
return errors.New("--user is required")
}

ctx, cancel := context.WithCancel(cmd.Context())
defer cancel()

var patch restartPatch
patch.Spec.Template.Metadata.Annotations = map[string]string{
"kmux.vibioh.fr/restartedAt": time.Now().Format(time.RFC3339),
"kmux.vibioh.fr/restartedBy": user,
}

if len(user) != 0 {
patch.Spec.Template.Metadata.Annotations["kmux.vibioh.fr/restartedBy"] = user
}

payload, err := json.Marshal(patch)
Expand Down

0 comments on commit d830af5

Please sign in to comment.