Skip to content

Commit

Permalink
exec target command, but still pipe it to tee
Browse files Browse the repository at this point in the history
  • Loading branch information
justinsb committed Jan 17, 2018
1 parent 59440bb commit b23372c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion nodeup/pkg/model/kube_apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ func (b *KubeAPIServerBuilder) buildPod() (*v1.Pod, error) {
Image: b.Cluster.Spec.KubeAPIServer.Image,
Command: []string{
"/bin/sh", "-c",
"/usr/local/bin/kube-apiserver " + strings.Join(sortedStrings(flags), " ") + " 2>&1 | /bin/tee -a /var/log/kube-apiserver.log",
"exec &> >(/usr/bin/tee -a /var/log/kube-apiserver.log); " + // Redirect to tee, but still exec real command
"exec /usr/local/bin/kube-apiserver " + strings.Join(sortedStrings(flags), " ")
},
Env: getProxyEnvVars(b.Cluster.Spec.EgressProxy),
LivenessProbe: &v1.Probe{
Expand Down
3 changes: 2 additions & 1 deletion nodeup/pkg/model/kube_controller_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ func (b *KubeControllerManagerBuilder) buildPod() (*v1.Pod, error) {
Image: b.Cluster.Spec.KubeControllerManager.Image,
Command: []string{
"/bin/sh", "-c",
"/usr/local/bin/kube-controller-manager " + strings.Join(sortedStrings(flags), " ") + " 2>&1 | /bin/tee -a /var/log/kube-controller-manager.log",
"exec &> >(/usr/bin/tee -a /var/log/kube-controller-manager.log); " + // Redirect to tee, but still exec real command
"exec /usr/local/bin/kube-controller-manager " + strings.Join(sortedStrings(flags), " "),
},
Env: getProxyEnvVars(b.Cluster.Spec.EgressProxy),
LivenessProbe: &v1.Probe{
Expand Down
3 changes: 2 additions & 1 deletion nodeup/pkg/model/kube_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ func (b *KubeProxyBuilder) buildPod() (*v1.Pod, error) {
Image: image,
Command: []string{
"/bin/sh", "-c",
"/usr/local/bin/kube-proxy " + strings.Join(sortedStrings(flags), " ") + " 2>&1 | /usr/bin/tee -a /var/log/kube-proxy.log",
"exec &> >(/usr/bin/tee -a /var/log/kube-proxy.log); " + // Redirect to tee, but still exec real command
"exec /usr/local/bin/kube-proxy " + strings.Join(sortedStrings(flags), " "),
},
Resources: v1.ResourceRequirements{
Requests: v1.ResourceList{
Expand Down
3 changes: 2 additions & 1 deletion nodeup/pkg/model/kube_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ func (b *KubeSchedulerBuilder) buildPod() (*v1.Pod, error) {
Image: c.Image,
Command: []string{
"/bin/sh", "-c",
"/usr/local/bin/kube-scheduler " + strings.Join(sortedStrings(flags), " ") + " 2>&1 | /bin/tee -a /var/log/kube-scheduler.log",
"exec &> >(/usr/bin/tee -a /var/log/kube-scheduler.log); " + // Redirect to tee, but still exec real command
"exec /usr/local/bin/kube-scheduler " + strings.Join(sortedStrings(flags), " "),
},
Env: getProxyEnvVars(b.Cluster.Spec.EgressProxy),
LivenessProbe: &v1.Probe{
Expand Down
4 changes: 3 additions & 1 deletion protokube/pkg/protokube/etcd_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ func BuildEtcdManifest(c *EtcdCluster) *v1.Pod {
},
},
Command: []string{
"/bin/sh", "-c", "/usr/local/bin/etcd 2>&1 | /bin/tee -a /var/log/etcd.log",
"/bin/sh", "-c",
"exec &> >(/usr/bin/tee -a /var/log/etcd.log); " + // Redirect to tee, but still exec real command
"exec /usr/local/bin/etcd",
},
}
// build the environment variables for etcd service
Expand Down

0 comments on commit b23372c

Please sign in to comment.