-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: APM config via configmap #185
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # internal/apm/helper.go
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #185 +/- ##
==========================================
+ Coverage 60.54% 60.88% +0.33%
==========================================
Files 36 36
Lines 2945 2973 +28
==========================================
+ Hits 1783 1810 +27
Misses 1015 1015
- Partials 147 148 +1 ☔ View full report in Codecov by Sentry. |
…igmap' into dbudziwojski/apm-config-via-configmap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to move some of this logic to something that can be reused in each injector (dotnet, java, nodejs, ..); php may have to be a special case.
internal/apm/java.go
Outdated
@@ -88,6 +89,35 @@ func (i *JavaInjector) Inject(ctx context.Context, inst v1beta1.Instrumentation, | |||
container.Env[idx].Value = container.Env[idx].Value + javaJVMArgument | |||
} | |||
|
|||
if inst.Spec.AgentConfigMap != "" { | |||
pod.Spec.Volumes = append(pod.Spec.Volumes, corev1.Volume{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check the existence of the same pod your volume your injecting to ensure the volume doesn't get injected multiple times. Being called multiple times should be idempotent.
Each "mutater" has the potential to be called more than once, as different mutators may make changes, which can cause previously called mutators to be called again (no prefined order)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
internal/apm/java.go
Outdated
}, | ||
}) | ||
|
||
container.VolumeMounts = append(container.VolumeMounts, corev1.VolumeMount{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
Value: apmConfigPath, | ||
}) | ||
} else { | ||
container.Env[apmIdx].Value = apmConfigPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the intention to overwrite the value if it's already configured on the container?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. I suppose that if a customer has already provided a file we should not override their choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean this else block need to be prunned?
…igmap' into dbudziwojski/apm-config-via-configmap
Agreed. This is something we can look into once we begin supporting the other agents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Type of change
Checklist: