-
Notifications
You must be signed in to change notification settings - Fork 486
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
Nginx Instrumentation crd #1853
Changes from 7 commits
76de07f
fde952d
5838ebe
f82b33d
85c0245
89a357e
18b51fc
5d80642
78e228d
dd9d75a
2f25cdd
ac5d26b
f4ba188
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: new_component | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) | ||
component: operator | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Instrumentation crd for Nginx auto-instrumentation. | ||
|
||
# One or more tracking issues related to the change | ||
issues: [1853] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ const ( | |
AnnotationDefaultAutoInstrumentationDotNet = "instrumentation.opentelemetry.io/default-auto-instrumentation-dotnet-image" | ||
AnnotationDefaultAutoInstrumentationGo = "instrumentation.opentelemetry.io/default-auto-instrumentation-go-image" | ||
AnnotationDefaultAutoInstrumentationApacheHttpd = "instrumentation.opentelemetry.io/default-auto-instrumentation-apache-httpd-image" | ||
AnnotationDefaultAutoInstrumentationNginx = "instrumentation.opentelemetry.io/default-auto-instrumentation-nginx-image" | ||
envPrefix = "OTEL_" | ||
envSplunkPrefix = "SPLUNK_" | ||
) | ||
|
@@ -170,6 +171,26 @@ func (r *Instrumentation) Default() { | |
if r.Spec.ApacheHttpd.ConfigPath == "" { | ||
r.Spec.ApacheHttpd.ConfigPath = "/usr/local/apache2/conf" | ||
} | ||
if r.Spec.Nginx.Image == "" { | ||
if val, ok := r.Annotations[AnnotationDefaultAutoInstrumentationNginx]; ok { | ||
r.Spec.Nginx.Image = val | ||
} | ||
} | ||
if r.Spec.Nginx.Resources.Limits == nil { | ||
r.Spec.Nginx.Resources.Limits = corev1.ResourceList{ | ||
corev1.ResourceCPU: resource.MustParse("500m"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should extract these to a constant and reuse for others. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
corev1.ResourceMemory: resource.MustParse("128Mi"), | ||
} | ||
} | ||
if r.Spec.Nginx.Resources.Requests == nil { | ||
r.Spec.Nginx.Resources.Requests = corev1.ResourceList{ | ||
corev1.ResourceCPU: resource.MustParse("1m"), | ||
corev1.ResourceMemory: resource.MustParse("128Mi"), | ||
} | ||
} | ||
if r.Spec.Nginx.ConfigFile == "" { | ||
r.Spec.Nginx.ConfigFile = "/etc/nginx/nginx.conf" | ||
} | ||
} | ||
|
||
// +kubebuilder:webhook:verbs=create;update,path=/validate-opentelemetry-io-v1alpha1-instrumentation,mutating=false,failurePolicy=fail,groups=opentelemetry.io,resources=instrumentations,versions=v1alpha1,name=vinstrumentationcreateupdate.kb.io,sideEffects=none,admissionReviewVersions=v1 | ||
|
@@ -275,6 +296,9 @@ func (r *Instrumentation) validate() error { | |
if err := r.validateEnv(r.Spec.ApacheHttpd.Env); err != nil { | ||
return err | ||
} | ||
if err := r.validateEnv(r.Spec.Nginx.Env); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 there already image for nginx instrumentation?
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.
ah it's here #1852
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.
Here's the Nginx Otel module: https://github.com/open-telemetry/opentelemetry-cpp-contrib/blob/main/instrumentation/nginx
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.
For Nginx autoinstrumentation, default image with the instrumentation libraries is the same as for Apache Httpd - autoinstrumentation-apache-httpd