Skip to content

Commit cb10bf1

Browse files
changexdTylerHelmuthjaronoff97
authored
Change apache http instrumentation into command line (#2652)
* add multiIntrumentation to command line * add multiinstrumentation to config and add test * change github workflow for multi-instrumentation * rename command * remove unwanted comments * add chlog * modify chlog * add missing description in config for multi-instrumentation * add example * finish upgrade httpd * remove all usage of apache-http gate * set default apache http instrumentation to true * edit chlog * remove unused featuregates * replace instrumentationupgrade initialization * callout featuregate removal * change apache-http constant * make apache httpd naming consistent * correct name in chlog * correct name in logging setup * Update .chloggen/apache-http-instrumentation-command-flag.yaml Co-authored-by: Tyler Helmuth <[email protected]> * Update apache-http-instrumentation-command-flag.yaml --------- Co-authored-by: Tyler Helmuth <[email protected]> Co-authored-by: Jacob Aronoff <[email protected]>
1 parent f28a844 commit cb10bf1

File tree

10 files changed

+130
-88
lines changed

10 files changed

+130
-88
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: 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: remove featuregate `EnableApacheHTTPAutoInstrumentationSupport`. Use command line flag `--enable-apache-httpd-instrumentation` instead
9+
10+
# One or more tracking issues related to the change
11+
issues: [2582, 2670]
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:

internal/config/main.go

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type Config struct {
4444
collectorConfigMapEntry string
4545
createRBACPermissions bool
4646
enableMultiInstrumentation bool
47+
enableApacheHttpdInstrumentation bool
4748
autoInstrumentationDotNetImage string
4849
autoInstrumentationGoImage string
4950
autoInstrumentationApacheHttpdImage string
@@ -77,6 +78,7 @@ func New(opts ...Option) Config {
7778
collectorConfigMapEntry: o.collectorConfigMapEntry,
7879
createRBACPermissions: o.createRBACPermissions,
7980
enableMultiInstrumentation: o.enableMultiInstrumentation,
81+
enableApacheHttpdInstrumentation: o.enableApacheHttpdInstrumentation,
8082
targetAllocatorImage: o.targetAllocatorImage,
8183
operatorOpAMPBridgeImage: o.operatorOpAMPBridgeImage,
8284
targetAllocatorConfigMapEntry: o.targetAllocatorConfigMapEntry,
@@ -116,6 +118,10 @@ func (c *Config) EnableMultiInstrumentation() bool {
116118
return c.enableMultiInstrumentation
117119
}
118120

121+
func (c *Config) EnableApacheHttpdAutoInstrumentation() bool {
122+
return c.enableApacheHttpdInstrumentation
123+
}
124+
119125
// CollectorConfigMapEntry represents the configuration file name for the collector. Immutable.
120126
func (c *Config) CollectorConfigMapEntry() string {
121127
return c.collectorConfigMapEntry

internal/config/options.go

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type options struct {
4343
collectorConfigMapEntry string
4444
createRBACPermissions bool
4545
enableMultiInstrumentation bool
46+
enableApacheHttpdInstrumentation bool
4647
targetAllocatorConfigMapEntry string
4748
operatorOpAMPBridgeConfigMapEntry string
4849
targetAllocatorImage string
@@ -86,6 +87,11 @@ func WithEnableMultiInstrumentation(s bool) Option {
8687
o.enableMultiInstrumentation = s
8788
}
8889
}
90+
func WithEnableApacheHttpdInstrumentation(s bool) Option {
91+
return func(o *options) {
92+
o.enableApacheHttpdInstrumentation = s
93+
}
94+
}
8995
func WithTargetAllocatorConfigMapEntry(s string) Option {
9096
return func(o *options) {
9197
o.targetAllocatorConfigMapEntry = s

main.go

+30-31
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import (
5252
"github.com/open-telemetry/opentelemetry-operator/internal/version"
5353
"github.com/open-telemetry/opentelemetry-operator/internal/webhook/podmutation"
5454
collectorupgrade "github.com/open-telemetry/opentelemetry-operator/pkg/collector/upgrade"
55+
"github.com/open-telemetry/opentelemetry-operator/pkg/constants"
5556
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
5657
"github.com/open-telemetry/opentelemetry-operator/pkg/instrumentation"
5758
instrumentationupgrade "github.com/open-telemetry/opentelemetry-operator/pkg/instrumentation/upgrade"
@@ -99,25 +100,26 @@ func main() {
99100

100101
// add flags related to this operator
101102
var (
102-
metricsAddr string
103-
probeAddr string
104-
pprofAddr string
105-
enableLeaderElection bool
106-
createRBACPermissions bool
107-
enableMultiInstrumentation bool
108-
collectorImage string
109-
targetAllocatorImage string
110-
operatorOpAMPBridgeImage string
111-
autoInstrumentationJava string
112-
autoInstrumentationNodeJS string
113-
autoInstrumentationPython string
114-
autoInstrumentationDotNet string
115-
autoInstrumentationApacheHttpd string
116-
autoInstrumentationNginx string
117-
autoInstrumentationGo string
118-
labelsFilter []string
119-
webhookPort int
120-
tlsOpt tlsConfig
103+
metricsAddr string
104+
probeAddr string
105+
pprofAddr string
106+
enableLeaderElection bool
107+
createRBACPermissions bool
108+
enableMultiInstrumentation bool
109+
enableApacheHttpdInstrumentation bool
110+
collectorImage string
111+
targetAllocatorImage string
112+
operatorOpAMPBridgeImage string
113+
autoInstrumentationJava string
114+
autoInstrumentationNodeJS string
115+
autoInstrumentationPython string
116+
autoInstrumentationDotNet string
117+
autoInstrumentationApacheHttpd string
118+
autoInstrumentationNginx string
119+
autoInstrumentationGo string
120+
labelsFilter []string
121+
webhookPort int
122+
tlsOpt tlsConfig
121123
)
122124

123125
pflag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
@@ -128,6 +130,7 @@ func main() {
128130
"Enabling this will ensure there is only one active controller manager.")
129131
pflag.BoolVar(&createRBACPermissions, "create-rbac-permissions", false, "Automatically create RBAC permissions needed by the processors")
130132
pflag.BoolVar(&enableMultiInstrumentation, "enable-multi-instrumentation", false, "Controls whether the operator supports multi instrumentation")
133+
pflag.BoolVar(&enableApacheHttpdInstrumentation, constants.FlagApacheHttpd, true, "controls whether the operator supports Apache HTTPD auto-instrumentation")
131134
stringFlagOrEnv(&collectorImage, "collector-image", "RELATED_IMAGE_COLLECTOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:%s", v.OpenTelemetryCollector), "The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource.")
132135
stringFlagOrEnv(&targetAllocatorImage, "target-allocator-image", "RELATED_IMAGE_TARGET_ALLOCATOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/target-allocator:%s", v.TargetAllocator), "The default OpenTelemetry target allocator image. This image is used when no image is specified in the CustomResource.")
133136
stringFlagOrEnv(&operatorOpAMPBridgeImage, "operator-opamp-bridge-image", "RELATED_IMAGE_OPERATOR_OPAMP_BRIDGE", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/operator-opamp-bridge:%s", v.OperatorOpAMPBridge), "The default OpenTelemetry Operator OpAMP Bridge image. This image is used when no image is specified in the CustomResource.")
@@ -166,6 +169,7 @@ func main() {
166169
"go-os", runtime.GOOS,
167170
"labels-filter", labelsFilter,
168171
"enable-multi-instrumentation", enableMultiInstrumentation,
172+
"enable-apache-httpd-instrumentation", enableApacheHttpdInstrumentation,
169173
)
170174

171175
restConfig := ctrl.GetConfigOrDie()
@@ -183,6 +187,7 @@ func main() {
183187
config.WithCollectorImage(collectorImage),
184188
config.WithCreateRBACPermissions(createRBACPermissions),
185189
config.WithEnableMultiInstrumentation(enableMultiInstrumentation),
190+
config.WithEnableApacheHttpdInstrumentation(enableApacheHttpdInstrumentation),
186191
config.WithTargetAllocatorImage(targetAllocatorImage),
187192
config.WithOperatorOpAMPBridgeImage(operatorOpAMPBridgeImage),
188193
config.WithAutoInstrumentationJavaImage(autoInstrumentationJava),
@@ -342,18 +347,12 @@ func addDependencies(_ context.Context, mgr ctrl.Manager, cfg config.Config, v v
342347

343348
// adds the upgrade mechanism to be executed once the manager is ready
344349
err = mgr.Add(manager.RunnableFunc(func(c context.Context) error {
345-
u := &instrumentationupgrade.InstrumentationUpgrade{
346-
Logger: ctrl.Log.WithName("instrumentation-upgrade"),
347-
DefaultAutoInstJava: cfg.AutoInstrumentationJavaImage(),
348-
DefaultAutoInstNodeJS: cfg.AutoInstrumentationNodeJSImage(),
349-
DefaultAutoInstPython: cfg.AutoInstrumentationPythonImage(),
350-
DefaultAutoInstDotNet: cfg.AutoInstrumentationDotNetImage(),
351-
DefaultAutoInstGo: cfg.AutoInstrumentationDotNetImage(),
352-
DefaultAutoInstApacheHttpd: cfg.AutoInstrumentationApacheHttpdImage(),
353-
DefaultAutoInstNginx: cfg.AutoInstrumentationNginxImage(),
354-
Client: mgr.GetClient(),
355-
Recorder: mgr.GetEventRecorderFor("opentelemetry-operator"),
356-
}
350+
u := instrumentationupgrade.NewInstrumentationUpgrade(
351+
mgr.GetClient(),
352+
ctrl.Log.WithName("instrumentation-upgrade"),
353+
mgr.GetEventRecorderFor("opentelemetry-operator"),
354+
cfg,
355+
)
357356
return u.ManagedInstances(c)
358357
}))
359358
if err != nil {

pkg/constants/env.go

+2
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ const (
3434
EnvPodName = "OTEL_RESOURCE_ATTRIBUTES_POD_NAME"
3535
EnvPodUID = "OTEL_RESOURCE_ATTRIBUTES_POD_UID"
3636
EnvNodeName = "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME"
37+
38+
FlagApacheHttpd = "enable-apache-httpd-instrumentation"
3739
)

pkg/featuregate/featuregate.go

-13
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,12 @@ var (
5555
featuregate.WithRegisterDescription("controls whether the operator supports Golang auto-instrumentation"),
5656
featuregate.WithRegisterFromVersion("v0.77.0"),
5757
)
58-
EnableApacheHTTPAutoInstrumentationSupport = featuregate.GlobalRegistry().MustRegister(
59-
"operator.autoinstrumentation.apache-httpd",
60-
featuregate.StageBeta,
61-
featuregate.WithRegisterDescription("controls whether the operator supports Apache HTTPD auto-instrumentation"),
62-
featuregate.WithRegisterFromVersion("v0.80.0"),
63-
)
6458
EnableNginxAutoInstrumentationSupport = featuregate.GlobalRegistry().MustRegister(
6559
"operator.autoinstrumentation.nginx",
6660
featuregate.StageAlpha,
6761
featuregate.WithRegisterDescription("controls whether the operator supports Nginx auto-instrumentation"),
6862
featuregate.WithRegisterFromVersion("v0.86.0"),
6963
)
70-
71-
EnableMultiInstrumentationSupport = featuregate.GlobalRegistry().MustRegister(
72-
"operator.autoinstrumentation.multi-instrumentation",
73-
featuregate.StageAlpha,
74-
featuregate.WithRegisterFromVersion("0.86.0"),
75-
featuregate.WithRegisterDescription("controls whether the operator supports multi instrumentation"))
76-
7764
// EnableTargetAllocatorRewrite is the feature gate that controls whether the collector's configuration should
7865
// automatically be rewritten when the target allocator is enabled.
7966
EnableTargetAllocatorRewrite = featuregate.GlobalRegistry().MustRegister(

pkg/instrumentation/podmutator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func (pm *instPodMutator) Mutate(ctx context.Context, ns corev1.Namespace, pod c
290290
logger.Error(err, "failed to select an OpenTelemetry Instrumentation instance for this pod")
291291
return pod, err
292292
}
293-
if featuregate.EnableApacheHTTPAutoInstrumentationSupport.IsEnabled() || inst == nil {
293+
if pm.config.EnableApacheHttpdAutoInstrumentation() || inst == nil {
294294
insts.ApacheHttpd.Instrumentation = inst
295295
} else {
296296
logger.Error(nil, "support for Apache HTTPD auto instrumentation is not enabled")

pkg/instrumentation/podmutator_test.go

+2-14
Original file line numberDiff line numberDiff line change
@@ -2751,13 +2751,7 @@ func TestMutatePod(t *testing.T) {
27512751
},
27522752
},
27532753
},
2754-
setFeatureGates: func(t *testing.T) {
2755-
originalVal := featuregate.EnableApacheHTTPAutoInstrumentationSupport.IsEnabled()
2756-
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableApacheHTTPAutoInstrumentationSupport.ID(), true))
2757-
t.Cleanup(func() {
2758-
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableApacheHTTPAutoInstrumentationSupport.ID(), originalVal))
2759-
})
2760-
},
2754+
config: config.New(config.WithEnableApacheHttpdInstrumentation(true)),
27612755
},
27622756
{
27632757
name: "apache httpd injection feature gate disabled",
@@ -2832,13 +2826,7 @@ func TestMutatePod(t *testing.T) {
28322826
},
28332827
},
28342828
},
2835-
setFeatureGates: func(t *testing.T) {
2836-
originalVal := featuregate.EnableApacheHTTPAutoInstrumentationSupport.IsEnabled()
2837-
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableApacheHTTPAutoInstrumentationSupport.ID(), false))
2838-
t.Cleanup(func() {
2839-
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableApacheHTTPAutoInstrumentationSupport.ID(), originalVal))
2840-
})
2841-
},
2829+
config: config.New(config.WithEnableApacheHttpdInstrumentation(false)),
28422830
},
28432831

28442832
{

pkg/instrumentation/upgrade/upgrade.go

+52-12
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,27 @@ import (
2525
"sigs.k8s.io/controller-runtime/pkg/client"
2626

2727
"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
28+
"github.com/open-telemetry/opentelemetry-operator/internal/config"
2829
"github.com/open-telemetry/opentelemetry-operator/pkg/constants"
2930
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
3031
)
3132

3233
var (
3334
defaultAnnotationToGate = map[string]*featuregate2.Gate{
34-
constants.AnnotationDefaultAutoInstrumentationJava: featuregate.EnableJavaAutoInstrumentationSupport,
35-
constants.AnnotationDefaultAutoInstrumentationNodeJS: featuregate.EnableNodeJSAutoInstrumentationSupport,
36-
constants.AnnotationDefaultAutoInstrumentationPython: featuregate.EnablePythonAutoInstrumentationSupport,
37-
constants.AnnotationDefaultAutoInstrumentationDotNet: featuregate.EnableDotnetAutoInstrumentationSupport,
38-
constants.AnnotationDefaultAutoInstrumentationGo: featuregate.EnableGoAutoInstrumentationSupport,
39-
constants.AnnotationDefaultAutoInstrumentationApacheHttpd: featuregate.EnableApacheHTTPAutoInstrumentationSupport,
40-
constants.AnnotationDefaultAutoInstrumentationNginx: featuregate.EnableNginxAutoInstrumentationSupport,
35+
constants.AnnotationDefaultAutoInstrumentationJava: featuregate.EnableJavaAutoInstrumentationSupport,
36+
constants.AnnotationDefaultAutoInstrumentationNodeJS: featuregate.EnableNodeJSAutoInstrumentationSupport,
37+
constants.AnnotationDefaultAutoInstrumentationPython: featuregate.EnablePythonAutoInstrumentationSupport,
38+
constants.AnnotationDefaultAutoInstrumentationDotNet: featuregate.EnableDotnetAutoInstrumentationSupport,
39+
constants.AnnotationDefaultAutoInstrumentationGo: featuregate.EnableGoAutoInstrumentationSupport,
40+
constants.AnnotationDefaultAutoInstrumentationNginx: featuregate.EnableNginxAutoInstrumentationSupport,
4141
}
4242
)
4343

44+
type autoInstConfig struct {
45+
id string
46+
enabled bool
47+
}
48+
4449
type InstrumentationUpgrade struct {
4550
Client client.Client
4651
Logger logr.Logger
@@ -52,6 +57,28 @@ type InstrumentationUpgrade struct {
5257
DefaultAutoInstApacheHttpd string
5358
DefaultAutoInstNginx string
5459
DefaultAutoInstGo string
60+
defaultAnnotationToConfig map[string]autoInstConfig
61+
}
62+
63+
func NewInstrumentationUpgrade(client client.Client, logger logr.Logger, recorder record.EventRecorder, cfg config.Config) *InstrumentationUpgrade {
64+
defaultAnnotationToConfig := map[string]autoInstConfig{
65+
constants.AnnotationDefaultAutoInstrumentationApacheHttpd: autoInstConfig{constants.FlagApacheHttpd, cfg.EnableApacheHttpdAutoInstrumentation()},
66+
}
67+
68+
return &InstrumentationUpgrade{
69+
Client: client,
70+
Logger: logger,
71+
DefaultAutoInstJava: cfg.AutoInstrumentationJavaImage(),
72+
DefaultAutoInstNodeJS: cfg.AutoInstrumentationNodeJSImage(),
73+
DefaultAutoInstPython: cfg.AutoInstrumentationPythonImage(),
74+
DefaultAutoInstDotNet: cfg.AutoInstrumentationDotNetImage(),
75+
DefaultAutoInstGo: cfg.AutoInstrumentationGoImage(),
76+
DefaultAutoInstApacheHttpd: cfg.AutoInstrumentationApacheHttpdImage(),
77+
DefaultAutoInstNginx: cfg.AutoInstrumentationNginxImage(),
78+
Recorder: recorder,
79+
defaultAnnotationToConfig: defaultAnnotationToConfig,
80+
}
81+
5582
}
5683

5784
// +kubebuilder:rbac:groups=opentelemetry.io,resources=instrumentations,verbs=get;list;watch;update;patch
@@ -90,6 +117,24 @@ func (u *InstrumentationUpgrade) ManagedInstances(ctx context.Context) error {
90117

91118
func (u *InstrumentationUpgrade) upgrade(_ context.Context, inst v1alpha1.Instrumentation) *v1alpha1.Instrumentation {
92119
upgraded := inst.DeepCopy()
120+
for annotation, config := range u.defaultAnnotationToConfig {
121+
autoInst := upgraded.Annotations[annotation]
122+
if autoInst != "" {
123+
if config.enabled {
124+
switch annotation {
125+
case constants.AnnotationDefaultAutoInstrumentationApacheHttpd:
126+
if inst.Spec.ApacheHttpd.Image == autoInst {
127+
upgraded.Spec.ApacheHttpd.Image = u.DefaultAutoInstApacheHttpd
128+
upgraded.Annotations[annotation] = u.DefaultAutoInstApacheHttpd
129+
}
130+
}
131+
} else {
132+
u.Logger.Error(nil, "autoinstrumentation not enabled for this language", "flag", config.id)
133+
u.Recorder.Event(upgraded, "Warning", "InstrumentationUpgradeRejected", fmt.Sprintf("support for is not enabled for %s", config.id))
134+
}
135+
}
136+
}
137+
93138
for annotation, gate := range defaultAnnotationToGate {
94139
autoInst := upgraded.Annotations[annotation]
95140
if autoInst != "" {
@@ -120,11 +165,6 @@ func (u *InstrumentationUpgrade) upgrade(_ context.Context, inst v1alpha1.Instru
120165
upgraded.Spec.Go.Image = u.DefaultAutoInstGo
121166
upgraded.Annotations[annotation] = u.DefaultAutoInstGo
122167
}
123-
case constants.AnnotationDefaultAutoInstrumentationApacheHttpd:
124-
if inst.Spec.ApacheHttpd.Image == autoInst {
125-
upgraded.Spec.ApacheHttpd.Image = u.DefaultAutoInstApacheHttpd
126-
upgraded.Annotations[annotation] = u.DefaultAutoInstApacheHttpd
127-
}
128168
case constants.AnnotationDefaultAutoInstrumentationNginx:
129169
if inst.Spec.Nginx.Image == autoInst {
130170
upgraded.Spec.Nginx.Image = u.DefaultAutoInstNginx

pkg/instrumentation/upgrade/upgrade_test.go

+15-17
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
corev1 "k8s.io/api/core/v1"
2727
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2828
"k8s.io/apimachinery/pkg/types"
29+
"k8s.io/client-go/tools/record"
30+
ctrl "sigs.k8s.io/controller-runtime"
2931

3032
"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
3133
"github.com/open-telemetry/opentelemetry-operator/internal/config"
@@ -40,12 +42,6 @@ func TestUpgrade(t *testing.T) {
4042
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableGoAutoInstrumentationSupport.ID(), originalVal))
4143
})
4244

43-
originalVal = featuregate.EnableApacheHTTPAutoInstrumentationSupport.IsEnabled()
44-
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableApacheHTTPAutoInstrumentationSupport.ID(), true))
45-
t.Cleanup(func() {
46-
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableApacheHTTPAutoInstrumentationSupport.ID(), originalVal))
47-
})
48-
4945
originalVal = featuregate.EnableNginxAutoInstrumentationSupport.IsEnabled()
5046
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableNginxAutoInstrumentationSupport.ID(), true))
5147
t.Cleanup(func() {
@@ -82,6 +78,7 @@ func TestUpgrade(t *testing.T) {
8278
config.WithAutoInstrumentationGoImage("go:1"),
8379
config.WithAutoInstrumentationApacheHttpdImage("apache-httpd:1"),
8480
config.WithAutoInstrumentationNginxImage("nginx:1"),
81+
config.WithEnableApacheHttpdInstrumentation(true),
8582
),
8683
).Default(context.Background(), inst)
8784
assert.Nil(t, err)
@@ -95,17 +92,18 @@ func TestUpgrade(t *testing.T) {
9592
err = k8sClient.Create(context.Background(), inst)
9693
require.NoError(t, err)
9794

98-
up := &InstrumentationUpgrade{
99-
Logger: logr.Discard(),
100-
DefaultAutoInstJava: "java:2",
101-
DefaultAutoInstNodeJS: "nodejs:2",
102-
DefaultAutoInstPython: "python:2",
103-
DefaultAutoInstDotNet: "dotnet:2",
104-
DefaultAutoInstGo: "go:2",
105-
DefaultAutoInstApacheHttpd: "apache-httpd:2",
106-
DefaultAutoInstNginx: "nginx:2",
107-
Client: k8sClient,
108-
}
95+
cfg := config.New(
96+
config.WithAutoInstrumentationJavaImage("java:2"),
97+
config.WithAutoInstrumentationNodeJSImage("nodejs:2"),
98+
config.WithAutoInstrumentationPythonImage("python:2"),
99+
config.WithAutoInstrumentationDotNetImage("dotnet:2"),
100+
config.WithAutoInstrumentationGoImage("go:2"),
101+
config.WithAutoInstrumentationApacheHttpdImage("apache-httpd:2"),
102+
config.WithAutoInstrumentationNginxImage("nginx:2"),
103+
config.WithEnableApacheHttpdInstrumentation(true),
104+
)
105+
up := NewInstrumentationUpgrade(k8sClient, ctrl.Log.WithName("instrumentation-upgrade"), &record.FakeRecorder{}, cfg)
106+
109107
err = up.ManagedInstances(context.Background())
110108
require.NoError(t, err)
111109

0 commit comments

Comments
 (0)