Skip to content

Commit dcf3579

Browse files
committed
Merge remote-tracking branch 'upstream/main' into include-node-ip-in-env-vars
2 parents d6d2245 + aeb19a7 commit dcf3579

33 files changed

+263
-310
lines changed
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. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: collector
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Fix the RBAC resources creation when the processor was only enabled"
9+
10+
# One or more tracking issues related to the change
11+
issues: [2788]
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:
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: breaking
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: operator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: change nginx instrumentation feature gate operator.autoinstrumentation.nginx into command line flag --enable-nginx-instrumentation
9+
10+
# One or more tracking issues related to the change
11+
issues: [2582, 2676]
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:

.chloggen/js-build-remove-dev.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: enhancement
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: auto-instrumentation
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Remove NodeJS autoinstrumentation dev dependencies to reduce image size"
9+
10+
# One or more tracking issues related to the change
11+
issues: [2802]
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:
+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: breaking
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: target allocator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Promote `operator.collector.rewritetargetallocator` feature flag to stable
9+
10+
# One or more tracking issues related to the change
11+
issues: [2796]
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:
+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: enhancement
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, 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: Remove env var prefix validation
9+
10+
# One or more tracking issues related to the change
11+
issues: [2768]
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:

apis/v1alpha1/instrumentation_webhook.go

-40
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ import (
3131
"github.com/open-telemetry/opentelemetry-operator/pkg/constants"
3232
)
3333

34-
const (
35-
envPrefix = "OTEL_"
36-
envSplunkPrefix = "SPLUNK_"
37-
)
38-
3934
var (
4035
_ admission.CustomValidator = &InstrumentationWebhook{}
4136
_ admission.CustomDefaulter = &InstrumentationWebhook{}
@@ -245,44 +240,9 @@ func (w InstrumentationWebhook) validate(r *Instrumentation) (admission.Warnings
245240
default:
246241
return warnings, fmt.Errorf("spec.sampler.type is not valid: %s", r.Spec.Sampler.Type)
247242
}
248-
249-
// validate env vars
250-
if err := w.validateEnv(r.Spec.Env); err != nil {
251-
return warnings, err
252-
}
253-
if err := w.validateEnv(r.Spec.Java.Env); err != nil {
254-
return warnings, err
255-
}
256-
if err := w.validateEnv(r.Spec.NodeJS.Env); err != nil {
257-
return warnings, err
258-
}
259-
if err := w.validateEnv(r.Spec.Python.Env); err != nil {
260-
return warnings, err
261-
}
262-
if err := w.validateEnv(r.Spec.DotNet.Env); err != nil {
263-
return warnings, err
264-
}
265-
if err := w.validateEnv(r.Spec.Go.Env); err != nil {
266-
return warnings, err
267-
}
268-
if err := w.validateEnv(r.Spec.ApacheHttpd.Env); err != nil {
269-
return warnings, err
270-
}
271-
if err := w.validateEnv(r.Spec.Nginx.Env); err != nil {
272-
return warnings, err
273-
}
274243
return warnings, nil
275244
}
276245

277-
func (w InstrumentationWebhook) validateEnv(envs []corev1.EnvVar) error {
278-
for _, env := range envs {
279-
if !strings.HasPrefix(env.Name, envPrefix) && !strings.HasPrefix(env.Name, envSplunkPrefix) {
280-
return fmt.Errorf("env name should start with \"OTEL_\" or \"SPLUNK_\": %s", env.Name)
281-
}
282-
}
283-
return nil
284-
}
285-
286246
func validateJaegerRemoteSamplerArgument(argument string) error {
287247
parts := strings.Split(argument, ",")
288248

autoinstrumentation/java/version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.0
1+
2.2.0

autoinstrumentation/nodejs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"clean": "rimraf build/*",
77
"prepare": "npm run compile",
88
"compile": "tsc -p .",
9-
"postcompile": "copyfiles -f 'build/src/**' build/workspace/ && copyfiles 'node_modules/**' build/workspace/"
9+
"postcompile": "copyfiles -f 'build/src/**' build/workspace/ && copyfiles 'node_modules/**' package.json build/workspace/ && npm -C build/workspace prune --omit=dev --no-package-lock"
1010
},
1111
"devDependencies": {
1212
"copyfiles": "^2.4.1",

bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ metadata:
9999
categories: Logging & Tracing,Monitoring
100100
certified: "false"
101101
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
102-
createdAt: "2024-03-11T13:32:19Z"
102+
createdAt: "2024-03-25T08:38:05Z"
103103
description: Provides the OpenTelemetry components, including the Collector
104104
operators.operatorframework.io/builder: operator-sdk-v1.29.0
105105
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
@@ -487,7 +487,8 @@ spec:
487487
- --enable-leader-election
488488
- --zap-log-level=info
489489
- --zap-time-encoding=rfc3339nano
490-
- --feature-gates=+operator.autoinstrumentation.go,+operator.autoinstrumentation.nginx
490+
- --feature-gates=+operator.autoinstrumentation.go
491+
- --enable-nginx-instrumentation=true
491492
image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.96.0
492493
livenessProbe:
493494
httpGet:

config/manager/manager.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ spec:
3232
- "--enable-leader-election"
3333
- "--zap-log-level=info"
3434
- "--zap-time-encoding=rfc3339nano"
35-
- "--feature-gates=+operator.autoinstrumentation.go,+operator.autoinstrumentation.nginx"
35+
- "--feature-gates=+operator.autoinstrumentation.go"
36+
- "--enable-nginx-instrumentation=true"
3637
image: controller
3738
name: manager
3839
livenessProbe:

controllers/suite_test.go

+7-20
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"k8s.io/apimachinery/pkg/runtime"
3737
"k8s.io/apimachinery/pkg/types"
3838
"k8s.io/apimachinery/pkg/util/intstr"
39+
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
3940
"k8s.io/apimachinery/pkg/util/uuid"
4041
"k8s.io/apimachinery/pkg/util/wait"
4142
"k8s.io/client-go/kubernetes"
@@ -109,26 +110,12 @@ func TestMain(m *testing.M) {
109110
fmt.Printf("failed to start testEnv: %v", err)
110111
os.Exit(1)
111112
}
112-
if err = monitoringv1.AddToScheme(testScheme); err != nil {
113-
fmt.Printf("failed to register scheme: %v", err)
114-
os.Exit(1)
115-
}
116-
if err = networkingv1.AddToScheme(testScheme); err != nil {
117-
fmt.Printf("failed to register scheme: %v", err)
118-
os.Exit(1)
119-
}
120-
if err = routev1.AddToScheme(testScheme); err != nil {
121-
fmt.Printf("failed to register scheme: %v", err)
122-
os.Exit(1)
123-
}
124-
if err = v1alpha1.AddToScheme(testScheme); err != nil {
125-
fmt.Printf("failed to register scheme: %v", err)
126-
os.Exit(1)
127-
}
128-
if err = v1beta1.AddToScheme(testScheme); err != nil {
129-
fmt.Printf("failed to register scheme: %v", err)
130-
os.Exit(1)
131-
}
113+
114+
utilruntime.Must(monitoringv1.AddToScheme(testScheme))
115+
utilruntime.Must(networkingv1.AddToScheme(testScheme))
116+
utilruntime.Must(routev1.AddToScheme(testScheme))
117+
utilruntime.Must(v1alpha1.AddToScheme(testScheme))
118+
utilruntime.Must(v1beta1.AddToScheme(testScheme))
132119

133120
testEnv = &envtest.Environment{
134121
CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require (
2424
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.71.2
2525
github.com/prometheus-operator/prometheus-operator/pkg/client v0.71.2
2626
github.com/prometheus/client_golang v1.19.0
27-
github.com/prometheus/common v0.50.0
27+
github.com/prometheus/common v0.51.1
2828
github.com/prometheus/prometheus v0.50.1
2929
github.com/shirou/gopsutil v3.21.11+incompatible
3030
github.com/spf13/pflag v1.0.5
@@ -76,7 +76,7 @@ require (
7676
github.com/dennwc/varint v1.0.0 // indirect
7777
github.com/digitalocean/godo v1.108.0 // indirect
7878
github.com/distribution/reference v0.5.0 // indirect
79-
github.com/docker/docker v25.0.0+incompatible // indirect
79+
github.com/docker/docker v25.0.5+incompatible // indirect
8080
github.com/docker/go-connections v0.4.0 // indirect
8181
github.com/docker/go-units v0.5.0 // indirect
8282
github.com/edsrzf/mmap-go v1.1.0 // indirect

go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK
132132
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
133133
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
134134
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
135-
github.com/docker/docker v25.0.0+incompatible h1:g9b6wZTblhMgzOT2tspESstfw6ySZ9kdm94BLDKaZac=
136-
github.com/docker/docker v25.0.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
135+
github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE=
136+
github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
137137
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
138138
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
139139
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
@@ -576,8 +576,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b
576576
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
577577
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
578578
github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
579-
github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ=
580-
github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ=
579+
github.com/prometheus/common v0.51.1 h1:eIjN50Bwglz6a/c3hAgSMcofL3nD+nFQkV6Dd4DsQCw=
580+
github.com/prometheus/common v0.51.1/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q=
581581
github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4=
582582
github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI=
583583
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=

internal/config/main.go

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type Config struct {
4646
enableMultiInstrumentation bool
4747
enableApacheHttpdInstrumentation bool
4848
enableDotNetInstrumentation bool
49+
enableNginxInstrumentation bool
4950
enablePythonInstrumentation bool
5051
autoInstrumentationDotNetImage string
5152
autoInstrumentationGoImage string
@@ -83,6 +84,7 @@ func New(opts ...Option) Config {
8384
enableMultiInstrumentation: o.enableMultiInstrumentation,
8485
enableApacheHttpdInstrumentation: o.enableApacheHttpdInstrumentation,
8586
enableDotNetInstrumentation: o.enableDotNetInstrumentation,
87+
enableNginxInstrumentation: o.enableNginxInstrumentation,
8688
enablePythonInstrumentation: o.enablePythonInstrumentation,
8789
targetAllocatorImage: o.targetAllocatorImage,
8890
operatorOpAMPBridgeImage: o.operatorOpAMPBridgeImage,
@@ -134,6 +136,11 @@ func (c *Config) EnableDotNetAutoInstrumentation() bool {
134136
return c.enableDotNetInstrumentation
135137
}
136138

139+
// EnableNginxAutoInstrumentation is true when the operator supports nginx auto instrumentation.
140+
func (c *Config) EnableNginxAutoInstrumentation() bool {
141+
return c.enableNginxInstrumentation
142+
}
143+
137144
// EnablePythonAutoInstrumentation is true when the operator supports dotnet auto instrumentation.
138145
func (c *Config) EnablePythonAutoInstrumentation() bool {
139146
return c.enablePythonInstrumentation

internal/config/options.go

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type options struct {
4545
enableMultiInstrumentation bool
4646
enableApacheHttpdInstrumentation bool
4747
enableDotNetInstrumentation bool
48+
enableNginxInstrumentation bool
4849
enablePythonInstrumentation bool
4950
targetAllocatorConfigMapEntry string
5051
operatorOpAMPBridgeConfigMapEntry string
@@ -100,6 +101,11 @@ func WithEnableDotNetInstrumentation(s bool) Option {
100101
o.enableDotNetInstrumentation = s
101102
}
102103
}
104+
func WithEnableNginxInstrumentation(s bool) Option {
105+
return func(o *options) {
106+
o.enableNginxInstrumentation = s
107+
}
108+
}
103109
func WithEnablePythonInstrumentation(s bool) Option {
104110
return func(o *options) {
105111
o.enablePythonInstrumentation = s

internal/manifests/collector/adapters/config_to_ports.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func ConfigToComponentPorts(logger logr.Logger, cType ComponentType, config map[
100100
}
101101

102102
if err != nil {
103-
logger.V(2).Info("no parser found for '%s'", cmptName)
103+
logger.V(2).Info("no parser found for", "component", cmptName)
104104
continue
105105
}
106106

internal/manifests/collector/adapters/config_to_rbac.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func ConfigToRBAC(logger logr.Logger, config map[interface{}]interface{}) []rbac
5252
processorName := key.(string)
5353
processorParser, err := processor.For(logger, processorName, processorCfg)
5454
if err != nil {
55-
logger.V(2).Info("no parser found for '%s'", processorName)
55+
logger.V(2).Info("no parser found for", "processor", processorName)
5656
continue
5757
}
5858

0 commit comments

Comments
 (0)