Skip to content

Commit 8dfa2ba

Browse files
iblancasaswiatekm
andauthored
Not preserve the ownership of the files copied in the autoinstrumentation (open-telemetry#2695)
* Not preserve the ownership of the files copied in the autoinstrumentation. Closes open-telemetry#2655 Signed-off-by: Israel Blancas <[email protected]> * Update .chloggen/fix-2655.yaml Co-authored-by: Mikołaj Świątek <[email protected]> --------- Signed-off-by: Israel Blancas <[email protected]> Co-authored-by: Mikołaj Świątek <[email protected]>
1 parent cf1886f commit 8dfa2ba

9 files changed

+46
-30
lines changed

.chloggen/fix-2655.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: bug_fix
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
5+
component: instrumentation
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Don't preserve ownership of files copied from the autoinstrumenation image. This avoids issues when instrumenting workloads running as non-root"
9+
10+
# One or more tracking issues related to the change
11+
issues: [2655]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:

pkg/instrumentation/dotnet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func injectDotNetSDK(dotNetSpec v1alpha1.DotNet, pod corev1.Pod, index int, runt
127127
pod.Spec.InitContainers = append(pod.Spec.InitContainers, corev1.Container{
128128
Name: dotnetInitContainerName,
129129
Image: dotNetSpec.Image,
130-
Command: []string{"cp", "-a", "/autoinstrumentation/.", dotnetInstrMountPath},
130+
Command: []string{"cp", "-r", "/autoinstrumentation/.", dotnetInstrMountPath},
131131
Resources: dotNetSpec.Resources,
132132
VolumeMounts: []corev1.VolumeMount{{
133133
Name: dotnetVolumeName,

pkg/instrumentation/dotnet_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestInjectDotNetSDK(t *testing.T) {
6060
{
6161
Name: "opentelemetry-auto-instrumentation-dotnet",
6262
Image: "foo/bar:1",
63-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-dotnet"},
63+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-dotnet"},
6464
VolumeMounts: []corev1.VolumeMount{{
6565
Name: "opentelemetry-auto-instrumentation-dotnet",
6666
MountPath: "/otel-auto-instrumentation-dotnet",
@@ -165,7 +165,7 @@ func TestInjectDotNetSDK(t *testing.T) {
165165
{
166166
Name: "opentelemetry-auto-instrumentation-dotnet",
167167
Image: "foo/bar:1",
168-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-dotnet"},
168+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-dotnet"},
169169
VolumeMounts: []corev1.VolumeMount{{
170170
Name: "opentelemetry-auto-instrumentation-dotnet",
171171
MountPath: "/otel-auto-instrumentation-dotnet",
@@ -394,7 +394,7 @@ func TestInjectDotNetSDK(t *testing.T) {
394394
{
395395
Name: dotnetInitContainerName,
396396
Image: "foo/bar:1",
397-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-dotnet"},
397+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-dotnet"},
398398
VolumeMounts: []corev1.VolumeMount{{
399399
Name: dotnetVolumeName,
400400
MountPath: "/otel-auto-instrumentation-dotnet",
@@ -473,7 +473,7 @@ func TestInjectDotNetSDK(t *testing.T) {
473473
{
474474
Name: dotnetInitContainerName,
475475
Image: "foo/bar:1",
476-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-dotnet"},
476+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-dotnet"},
477477
VolumeMounts: []corev1.VolumeMount{{
478478
Name: dotnetVolumeName,
479479
MountPath: "/otel-auto-instrumentation-dotnet",

pkg/instrumentation/nodejs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func injectNodeJSSDK(nodeJSSpec v1alpha1.NodeJS, pod corev1.Pod, index int) (cor
7373
pod.Spec.InitContainers = append(pod.Spec.InitContainers, corev1.Container{
7474
Name: nodejsInitContainerName,
7575
Image: nodeJSSpec.Image,
76-
Command: []string{"cp", "-a", "/autoinstrumentation/.", nodejsInstrMountPath},
76+
Command: []string{"cp", "-r", "/autoinstrumentation/.", nodejsInstrMountPath},
7777
Resources: nodeJSSpec.Resources,
7878
VolumeMounts: []corev1.VolumeMount{{
7979
Name: nodejsVolumeName,

pkg/instrumentation/nodejs_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func TestInjectNodeJSSDK(t *testing.T) {
5858
{
5959
Name: "opentelemetry-auto-instrumentation-nodejs",
6060
Image: "foo/bar:1",
61-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-nodejs"},
61+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-nodejs"},
6262
VolumeMounts: []corev1.VolumeMount{{
6363
Name: "opentelemetry-auto-instrumentation-nodejs",
6464
MountPath: "/otel-auto-instrumentation-nodejs",
@@ -118,7 +118,7 @@ func TestInjectNodeJSSDK(t *testing.T) {
118118
{
119119
Name: "opentelemetry-auto-instrumentation-nodejs",
120120
Image: "foo/bar:1",
121-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-nodejs"},
121+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-nodejs"},
122122
VolumeMounts: []corev1.VolumeMount{{
123123
Name: "opentelemetry-auto-instrumentation-nodejs",
124124
MountPath: "/otel-auto-instrumentation-nodejs",

pkg/instrumentation/podmutator_test.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ func TestMutatePod(t *testing.T) {
677677
{
678678
Name: nodejsInitContainerName,
679679
Image: "otel/nodejs:1",
680-
Command: []string{"cp", "-a", "/autoinstrumentation/.", nodejsInstrMountPath},
680+
Command: []string{"cp", "-r", "/autoinstrumentation/.", nodejsInstrMountPath},
681681
VolumeMounts: []corev1.VolumeMount{{
682682
Name: nodejsVolumeName,
683683
MountPath: nodejsInstrMountPath,
@@ -849,7 +849,7 @@ func TestMutatePod(t *testing.T) {
849849
{
850850
Name: nodejsInitContainerName,
851851
Image: "otel/nodejs:1",
852-
Command: []string{"cp", "-a", "/autoinstrumentation/.", nodejsInstrMountPath},
852+
Command: []string{"cp", "-r", "/autoinstrumentation/.", nodejsInstrMountPath},
853853
VolumeMounts: []corev1.VolumeMount{{
854854
Name: nodejsVolumeName,
855855
MountPath: nodejsInstrMountPath,
@@ -1176,7 +1176,7 @@ func TestMutatePod(t *testing.T) {
11761176
{
11771177
Name: pythonInitContainerName,
11781178
Image: "otel/python:1",
1179-
Command: []string{"cp", "-a", "/autoinstrumentation/.", pythonInstrMountPath},
1179+
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
11801180
VolumeMounts: []corev1.VolumeMount{{
11811181
Name: pythonVolumeName,
11821182
MountPath: pythonInstrMountPath,
@@ -1364,7 +1364,7 @@ func TestMutatePod(t *testing.T) {
13641364
{
13651365
Name: pythonInitContainerName,
13661366
Image: "otel/python:1",
1367-
Command: []string{"cp", "-a", "/autoinstrumentation/.", pythonInstrMountPath},
1367+
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
13681368
VolumeMounts: []corev1.VolumeMount{{
13691369
Name: pythonVolumeName,
13701370
MountPath: pythonInstrMountPath,
@@ -1713,7 +1713,7 @@ func TestMutatePod(t *testing.T) {
17131713
{
17141714
Name: dotnetInitContainerName,
17151715
Image: "otel/dotnet:1",
1716-
Command: []string{"cp", "-a", "/autoinstrumentation/.", dotnetInstrMountPath},
1716+
Command: []string{"cp", "-r", "/autoinstrumentation/.", dotnetInstrMountPath},
17171717
VolumeMounts: []corev1.VolumeMount{{
17181718
Name: dotnetVolumeName,
17191719
MountPath: dotnetInstrMountPath,
@@ -1893,7 +1893,7 @@ func TestMutatePod(t *testing.T) {
18931893
{
18941894
Name: dotnetInitContainerName,
18951895
Image: "otel/dotnet:1",
1896-
Command: []string{"cp", "-a", "/autoinstrumentation/.", dotnetInstrMountPath},
1896+
Command: []string{"cp", "-r", "/autoinstrumentation/.", dotnetInstrMountPath},
18971897
VolumeMounts: []corev1.VolumeMount{{
18981898
Name: dotnetVolumeName,
18991899
MountPath: dotnetInstrMountPath,
@@ -2082,7 +2082,7 @@ func TestMutatePod(t *testing.T) {
20822082
{
20832083
Name: dotnetInitContainerName,
20842084
Image: "otel/dotnet:1",
2085-
Command: []string{"cp", "-a", "/autoinstrumentation/.", dotnetInstrMountPath},
2085+
Command: []string{"cp", "-r", "/autoinstrumentation/.", dotnetInstrMountPath},
20862086
VolumeMounts: []corev1.VolumeMount{{
20872087
Name: dotnetVolumeName,
20882088
MountPath: dotnetInstrMountPath,
@@ -3357,7 +3357,7 @@ func TestMutatePod(t *testing.T) {
33573357
{
33583358
Name: nodejsInitContainerName,
33593359
Image: "otel/nodejs:1",
3360-
Command: []string{"cp", "-a", "/autoinstrumentation/.", nodejsInstrMountPath},
3360+
Command: []string{"cp", "-r", "/autoinstrumentation/.", nodejsInstrMountPath},
33613361
VolumeMounts: []corev1.VolumeMount{{
33623362
Name: nodejsVolumeName,
33633363
MountPath: nodejsInstrMountPath,
@@ -3366,7 +3366,7 @@ func TestMutatePod(t *testing.T) {
33663366
{
33673367
Name: pythonInitContainerName,
33683368
Image: "otel/python:1",
3369-
Command: []string{"cp", "-a", "/autoinstrumentation/.", pythonInstrMountPath},
3369+
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
33703370
VolumeMounts: []corev1.VolumeMount{{
33713371
Name: pythonVolumeName,
33723372
MountPath: pythonInstrMountPath,
@@ -3375,7 +3375,7 @@ func TestMutatePod(t *testing.T) {
33753375
{
33763376
Name: dotnetInitContainerName,
33773377
Image: "otel/dotnet:1",
3378-
Command: []string{"cp", "-a", "/autoinstrumentation/.", dotnetInstrMountPath},
3378+
Command: []string{"cp", "-r", "/autoinstrumentation/.", dotnetInstrMountPath},
33793379
VolumeMounts: []corev1.VolumeMount{{
33803380
Name: dotnetVolumeName,
33813381
MountPath: dotnetInstrMountPath,
@@ -4012,7 +4012,7 @@ func TestMutatePod(t *testing.T) {
40124012
{
40134013
Name: nodejsInitContainerName,
40144014
Image: "otel/nodejs:1",
4015-
Command: []string{"cp", "-a", "/autoinstrumentation/.", nodejsInstrMountPath},
4015+
Command: []string{"cp", "-r", "/autoinstrumentation/.", nodejsInstrMountPath},
40164016
VolumeMounts: []corev1.VolumeMount{{
40174017
Name: nodejsVolumeName,
40184018
MountPath: nodejsInstrMountPath,
@@ -4021,7 +4021,7 @@ func TestMutatePod(t *testing.T) {
40214021
{
40224022
Name: pythonInitContainerName,
40234023
Image: "otel/python:1",
4024-
Command: []string{"cp", "-a", "/autoinstrumentation/.", pythonInstrMountPath},
4024+
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
40254025
VolumeMounts: []corev1.VolumeMount{{
40264026
Name: pythonVolumeName,
40274027
MountPath: pythonInstrMountPath,
@@ -4030,7 +4030,7 @@ func TestMutatePod(t *testing.T) {
40304030
{
40314031
Name: dotnetInitContainerName,
40324032
Image: "otel/dotnet:1",
4033-
Command: []string{"cp", "-a", "/autoinstrumentation/.", dotnetInstrMountPath},
4033+
Command: []string{"cp", "-r", "/autoinstrumentation/.", dotnetInstrMountPath},
40344034
VolumeMounts: []corev1.VolumeMount{{
40354035
Name: dotnetVolumeName,
40364036
MountPath: dotnetInstrMountPath,
@@ -4898,7 +4898,7 @@ func TestMutatePod(t *testing.T) {
48984898
{
48994899
Name: dotnetInitContainerName,
49004900
Image: "otel/dotnet:1",
4901-
Command: []string{"cp", "-a", "/autoinstrumentation/.", dotnetInstrMountPath},
4901+
Command: []string{"cp", "-r", "/autoinstrumentation/.", dotnetInstrMountPath},
49024902
VolumeMounts: []corev1.VolumeMount{{
49034903
Name: dotnetVolumeName,
49044904
MountPath: dotnetInstrMountPath,

pkg/instrumentation/python.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func injectPythonSDK(pythonSpec v1alpha1.Python, pod corev1.Pod, index int) (cor
116116
pod.Spec.InitContainers = append(pod.Spec.InitContainers, corev1.Container{
117117
Name: pythonInitContainerName,
118118
Image: pythonSpec.Image,
119-
Command: []string{"cp", "-a", "/autoinstrumentation/.", pythonInstrMountPath},
119+
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
120120
Resources: pythonSpec.Resources,
121121
VolumeMounts: []corev1.VolumeMount{{
122122
Name: pythonVolumeName,

pkg/instrumentation/python_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func TestInjectPythonSDK(t *testing.T) {
5858
{
5959
Name: "opentelemetry-auto-instrumentation-python",
6060
Image: "foo/bar:1",
61-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
61+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
6262
VolumeMounts: []corev1.VolumeMount{{
6363
Name: "opentelemetry-auto-instrumentation-python",
6464
MountPath: "/otel-auto-instrumentation-python",
@@ -134,7 +134,7 @@ func TestInjectPythonSDK(t *testing.T) {
134134
{
135135
Name: "opentelemetry-auto-instrumentation-python",
136136
Image: "foo/bar:1",
137-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
137+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
138138
VolumeMounts: []corev1.VolumeMount{{
139139
Name: "opentelemetry-auto-instrumentation-python",
140140
MountPath: "/otel-auto-instrumentation-python",
@@ -211,7 +211,7 @@ func TestInjectPythonSDK(t *testing.T) {
211211
{
212212
Name: "opentelemetry-auto-instrumentation-python",
213213
Image: "foo/bar:1",
214-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
214+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
215215
VolumeMounts: []corev1.VolumeMount{{
216216
Name: "opentelemetry-auto-instrumentation-python",
217217
MountPath: "/otel-auto-instrumentation-python",
@@ -287,7 +287,7 @@ func TestInjectPythonSDK(t *testing.T) {
287287
{
288288
Name: "opentelemetry-auto-instrumentation-python",
289289
Image: "foo/bar:1",
290-
Command: []string{"cp", "-a", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
290+
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
291291
VolumeMounts: []corev1.VolumeMount{{
292292
Name: "opentelemetry-auto-instrumentation-python",
293293
MountPath: "/otel-auto-instrumentation-python",

pkg/instrumentation/sdk_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ func TestInjectNodeJS(t *testing.T) {
641641
{
642642
Name: nodejsInitContainerName,
643643
Image: "img:1",
644-
Command: []string{"cp", "-a", "/autoinstrumentation/.", nodejsInstrMountPath},
644+
Command: []string{"cp", "-r", "/autoinstrumentation/.", nodejsInstrMountPath},
645645
VolumeMounts: []corev1.VolumeMount{{
646646
Name: nodejsVolumeName,
647647
MountPath: nodejsInstrMountPath,
@@ -746,7 +746,7 @@ func TestInjectPython(t *testing.T) {
746746
{
747747
Name: pythonInitContainerName,
748748
Image: "img:1",
749-
Command: []string{"cp", "-a", "/autoinstrumentation/.", pythonInstrMountPath},
749+
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
750750
VolumeMounts: []corev1.VolumeMount{{
751751
Name: pythonVolumeName,
752752
MountPath: pythonInstrMountPath,
@@ -865,7 +865,7 @@ func TestInjectDotNet(t *testing.T) {
865865
{
866866
Name: dotnetInitContainerName,
867867
Image: "img:1",
868-
Command: []string{"cp", "-a", "/autoinstrumentation/.", dotnetInstrMountPath},
868+
Command: []string{"cp", "-r", "/autoinstrumentation/.", dotnetInstrMountPath},
869869
VolumeMounts: []corev1.VolumeMount{{
870870
Name: dotnetVolumeName,
871871
MountPath: dotnetInstrMountPath,

0 commit comments

Comments
 (0)