Skip to content

Commit

Permalink
Add namespace validation
Browse files Browse the repository at this point in the history
  • Loading branch information
peaaceChoi committed Nov 14, 2023
1 parent d8f8012 commit 2066892
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/leaderelection/leader_election.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"os"
"strings"

"k8s.io/apimachinery/pkg/util/uuid"
coordinationv1client "k8s.io/client-go/kubernetes/typed/coordination/v1"
Expand Down Expand Up @@ -123,5 +124,5 @@ func getInClusterNamespace() (string, error) {
if err != nil {
return "", fmt.Errorf("error reading namespace file: %w", err)
}
return string(namespace), nil
return strings.TrimSuffix(string(namespace), "\n"), nil
}

0 comments on commit 2066892

Please sign in to comment.