Skip to content

Commit

Permalink
ignore empty env value in golang env (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanposhiho authored Feb 28, 2024
1 parent 6716425 commit 3d1c629
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func (s *Service) ModifyPodResource(pod *v1.Pod, t *v1beta3.Tortoise) {
if !ok {
continue
}
if len(env.Value) == 0 {
// Probably it's defined through the configmap.
continue
}
oldNum, err := strconv.Atoi(env.Value)
if err != nil {
// invalid GOMAXPROCS, skip
Expand All @@ -137,6 +141,10 @@ func (s *Service) ModifyPodResource(pod *v1.Pod, t *v1beta3.Tortoise) {
continue
}
val := env.Value
if len(val) == 0 {
// Probably it's defined through the configmap.
continue
}
last := val[len(val)-1]
if last >= '0' && last <= '9' {
// OK
Expand Down

0 comments on commit 3d1c629

Please sign in to comment.