Skip to content

Commit 8eacad0

Browse files
committed
make apache httpd naming consistent
1 parent 9c54d04 commit 8eacad0

File tree

7 files changed

+36
-36
lines changed

7 files changed

+36
-36
lines changed

internal/config/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type Config struct {
4444
collectorConfigMapEntry string
4545
createRBACPermissions bool
4646
enableMultiInstrumentation bool
47-
enableApacheHTTPInstrumentation bool
47+
enableApacheHttpdInstrumentation bool
4848
autoInstrumentationDotNetImage string
4949
autoInstrumentationGoImage string
5050
autoInstrumentationApacheHttpdImage string
@@ -78,7 +78,7 @@ func New(opts ...Option) Config {
7878
collectorConfigMapEntry: o.collectorConfigMapEntry,
7979
createRBACPermissions: o.createRBACPermissions,
8080
enableMultiInstrumentation: o.enableMultiInstrumentation,
81-
enableApacheHTTPInstrumentation: o.enableApacheHTTPInstrumentation,
81+
enableApacheHttpdInstrumentation: o.enableApacheHttpdInstrumentation,
8282
targetAllocatorImage: o.targetAllocatorImage,
8383
operatorOpAMPBridgeImage: o.operatorOpAMPBridgeImage,
8484
targetAllocatorConfigMapEntry: o.targetAllocatorConfigMapEntry,
@@ -118,8 +118,8 @@ func (c *Config) EnableMultiInstrumentation() bool {
118118
return c.enableMultiInstrumentation
119119
}
120120

121-
func (c *Config) EnableApacheHTTPAutoInstrumentation() bool {
122-
return c.enableApacheHTTPInstrumentation
121+
func (c *Config) EnableApacheHttpdAutoInstrumentation() bool {
122+
return c.enableApacheHttpdInstrumentation
123123
}
124124

125125
// CollectorConfigMapEntry represents the configuration file name for the collector. Immutable.

internal/config/options.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type options struct {
4343
collectorConfigMapEntry string
4444
createRBACPermissions bool
4545
enableMultiInstrumentation bool
46-
enableApacheHTTPInstrumentation bool
46+
enableApacheHttpdInstrumentation bool
4747
targetAllocatorConfigMapEntry string
4848
operatorOpAMPBridgeConfigMapEntry string
4949
targetAllocatorImage string
@@ -87,9 +87,9 @@ func WithEnableMultiInstrumentation(s bool) Option {
8787
o.enableMultiInstrumentation = s
8888
}
8989
}
90-
func WithEnableApacheHTTPInstrumentation(s bool) Option {
90+
func WithEnableApacheHttpdInstrumentation(s bool) Option {
9191
return func(o *options) {
92-
o.enableApacheHTTPInstrumentation = s
92+
o.enableApacheHttpdInstrumentation = s
9393
}
9494
}
9595
func WithTargetAllocatorConfigMapEntry(s string) Option {

main.go

+23-23
Original file line numberDiff line numberDiff line change
@@ -100,26 +100,26 @@ func main() {
100100

101101
// add flags related to this operator
102102
var (
103-
metricsAddr string
104-
probeAddr string
105-
pprofAddr string
106-
enableLeaderElection bool
107-
createRBACPermissions bool
108-
enableMultiInstrumentation bool
109-
enableApacheHTTPInstrumentation 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
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
123123
)
124124

125125
pflag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
@@ -130,7 +130,7 @@ func main() {
130130
"Enabling this will ensure there is only one active controller manager.")
131131
pflag.BoolVar(&createRBACPermissions, "create-rbac-permissions", false, "Automatically create RBAC permissions needed by the processors")
132132
pflag.BoolVar(&enableMultiInstrumentation, "enable-multi-instrumentation", false, "Controls whether the operator supports multi instrumentation")
133-
pflag.BoolVar(&enableApacheHTTPInstrumentation, constants.FlagApacheHttpd, true, "controls whether the operator supports Apache HTTPD auto-instrumentation")
133+
pflag.BoolVar(&enableApacheHttpdInstrumentation, constants.FlagApacheHttpd, true, "controls whether the operator supports Apache HTTPD auto-instrumentation")
134134
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.")
135135
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.")
136136
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.")
@@ -169,7 +169,7 @@ func main() {
169169
"go-os", runtime.GOOS,
170170
"labels-filter", labelsFilter,
171171
"enable-multi-instrumentation", enableMultiInstrumentation,
172-
"enable-apache-http-instrumentation", enableApacheHTTPInstrumentation,
172+
"enable-apache-http-instrumentation", enableApacheHttpdInstrumentation,
173173
)
174174

175175
restConfig := ctrl.GetConfigOrDie()
@@ -187,7 +187,7 @@ func main() {
187187
config.WithCollectorImage(collectorImage),
188188
config.WithCreateRBACPermissions(createRBACPermissions),
189189
config.WithEnableMultiInstrumentation(enableMultiInstrumentation),
190-
config.WithEnableApacheHTTPInstrumentation(enableApacheHTTPInstrumentation),
190+
config.WithEnableApacheHttpdInstrumentation(enableApacheHttpdInstrumentation),
191191
config.WithTargetAllocatorImage(targetAllocatorImage),
192192
config.WithOperatorOpAMPBridgeImage(operatorOpAMPBridgeImage),
193193
config.WithAutoInstrumentationJavaImage(autoInstrumentationJava),

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 pm.config.EnableApacheHTTPAutoInstrumentation() || 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-2
Original file line numberDiff line numberDiff line change
@@ -2751,7 +2751,7 @@ func TestMutatePod(t *testing.T) {
27512751
},
27522752
},
27532753
},
2754-
config: config.New(config.WithEnableApacheHTTPInstrumentation(true)),
2754+
config: config.New(config.WithEnableApacheHttpdInstrumentation(true)),
27552755
},
27562756
{
27572757
name: "apache httpd injection feature gate disabled",
@@ -2826,7 +2826,7 @@ func TestMutatePod(t *testing.T) {
28262826
},
28272827
},
28282828
},
2829-
config: config.New(config.WithEnableApacheHTTPInstrumentation(false)),
2829+
config: config.New(config.WithEnableApacheHttpdInstrumentation(false)),
28302830
},
28312831

28322832
{

pkg/instrumentation/upgrade/upgrade.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type InstrumentationUpgrade struct {
6262

6363
func NewInstrumentationUpgrade(client client.Client, logger logr.Logger, recorder record.EventRecorder, cfg config.Config) *InstrumentationUpgrade {
6464
defaultAnnotationToConfig := map[string]autoInstConfig{
65-
constants.AnnotationDefaultAutoInstrumentationApacheHttpd: autoInstConfig{constants.FlagApacheHttpd, cfg.EnableApacheHTTPAutoInstrumentation()},
65+
constants.AnnotationDefaultAutoInstrumentationApacheHttpd: autoInstConfig{constants.FlagApacheHttpd, cfg.EnableApacheHttpdAutoInstrumentation()},
6666
}
6767

6868
return &InstrumentationUpgrade{

pkg/instrumentation/upgrade/upgrade_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func TestUpgrade(t *testing.T) {
7878
config.WithAutoInstrumentationGoImage("go:1"),
7979
config.WithAutoInstrumentationApacheHttpdImage("apache-httpd:1"),
8080
config.WithAutoInstrumentationNginxImage("nginx:1"),
81-
config.WithEnableApacheHTTPInstrumentation(true),
81+
config.WithEnableApacheHttpdInstrumentation(true),
8282
),
8383
).Default(context.Background(), inst)
8484
assert.Nil(t, err)
@@ -100,7 +100,7 @@ func TestUpgrade(t *testing.T) {
100100
config.WithAutoInstrumentationGoImage("go:2"),
101101
config.WithAutoInstrumentationApacheHttpdImage("apache-httpd:2"),
102102
config.WithAutoInstrumentationNginxImage("nginx:2"),
103-
config.WithEnableApacheHTTPInstrumentation(true),
103+
config.WithEnableApacheHttpdInstrumentation(true),
104104
)
105105
up := NewInstrumentationUpgrade(k8sClient, ctrl.Log.WithName("instrumentation-upgrade"), &record.FakeRecorder{}, cfg)
106106

0 commit comments

Comments
 (0)