Skip to content

Commit

Permalink
Remove sanitization
Browse files Browse the repository at this point in the history
  • Loading branch information
ndbaker1 committed Jul 15, 2024
1 parent a53d6f8 commit 28755c7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
7 changes: 1 addition & 6 deletions nodeadm/internal/kubelet/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kubelet

import (
"fmt"
"regexp"
"strings"

"github.com/awslabs/amazon-eks-ami/nodeadm/internal/api"
Expand Down Expand Up @@ -31,11 +30,7 @@ func (k *kubelet) writeKubeletEnvironment(cfg *api.NodeConfig) error {
// write additional environment variables
var kubeletEnvironment []string
for eKey, eValue := range k.environment {
kubeletEnvironment = append(kubeletEnvironment, fmt.Sprintf(`%s=%s`, sanitize(eKey), sanitize(eValue)))
kubeletEnvironment = append(kubeletEnvironment, fmt.Sprintf(`%s=%s`, eKey, eValue))
}
return util.WriteFileWithDir(kubeletEnvironmentFilePath, []byte(strings.Join(kubeletEnvironment, "\n")), kubeletConfigPerm)
}

func sanitize(s string) string {
return regexp.MustCompile("[\n\r]").ReplaceAllString(s, " ")
}
3 changes: 0 additions & 3 deletions nodeadm/test/e2e/cases/kubelet-flags/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ spec:
- --v=5
- --node-labels=foo=bar,foo2=baz
- --register-with-taints=foo=bar:NoSchedule
- |
--foo
--bar
2 changes: 1 addition & 1 deletion nodeadm/test/e2e/cases/kubelet-flags/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ wait::dbus-ready

nodeadm init --skip run --config-source file://config.yaml

assert::file-contains /etc/eks/kubelet/environment '--v=5 --node-labels=foo=bar,foo2=baz --register-with-taints=foo=bar:NoSchedule --foo --bar $'
assert::file-contains /etc/eks/kubelet/environment '--v=5 --node-labels=foo=bar,foo2=baz --register-with-taints=foo=bar:NoSchedule$'
assert::file-contains /etc/eks/kubelet/environment '--hostname-override=i-1234567890abcdef0'

0 comments on commit 28755c7

Please sign in to comment.