Skip to content

Commit

Permalink
feat: enable privileged mode for container
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Rosiek <[email protected]>
  • Loading branch information
Dominik Rosiek authored and sumo-drosiek committed Sep 8, 2022
1 parent 2de3424 commit 13248b6
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 13 deletions.
5 changes: 5 additions & 0 deletions operator/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ func (e PodExtender) extendPod(ctx context.Context, pod *corev1.Pod) error {
},
},
})

privileged := true

container := corev1.Container{
Image: e.TailingSidecarImage,
Expand All @@ -208,6 +210,9 @@ func (e PodExtender) extendPod(ctx context.Context, pod *corev1.Pod) error {
MountPath: hostPathMountPath,
},
},
SecurityContext: &corev1.SecurityContext{
Privileged: &privileged,
},
}
containers = append(containers, container)
sidecarsCount++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar1"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down
10 changes: 8 additions & 2 deletions operator/handler/testdata/patch_with_2_tailing_sidecars.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar0"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down Expand Up @@ -54,7 +57,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar1"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down
15 changes: 12 additions & 3 deletions operator/handler/testdata/patch_with_3_named_tailing_sidecars.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar0"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down Expand Up @@ -54,7 +57,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar1"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down Expand Up @@ -83,7 +89,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar2"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down
15 changes: 12 additions & 3 deletions operator/handler/testdata/patch_with_3_tailing_sidecars.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar0"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down Expand Up @@ -87,7 +90,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar1"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down Expand Up @@ -116,7 +122,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar2"
}
]
],
"securityContext": {
"privileged": true
}
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar0"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down Expand Up @@ -98,7 +101,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar1"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down Expand Up @@ -127,7 +133,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar2"
}
]
],
"securityContext": {
"privileged": true
}
}
},
{
Expand Down Expand Up @@ -156,7 +165,10 @@
"mountPath": "/tailing-sidecar/var",
"name": "volume-sidecar3"
}
]
],
"securityContext": {
"privileged": true
}
}
}
]

0 comments on commit 13248b6

Please sign in to comment.