Skip to content

Commit 3534d94

Browse files
authored
Only mounting and using secret when TA is deployed
1 parent 3d254a4 commit 3534d94

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

internal/manifests/collector/configmap.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func ConfigMap(params manifests.Params) (*corev1.ConfigMap, error) {
4545

4646
replaceCfgOpts := []ta.TAOption{}
4747

48-
if params.Config.CertManagerAvailability() == certmanager.Available && featuregate.EnableTargetAllocatorMTLS.IsEnabled() {
48+
if params.otelcol.Spec.TargetAllocator.Enabled && params.Config.CertManagerAvailability() == certmanager.Available && featuregate.EnableTargetAllocatorMTLS.IsEnabled() {
4949
replaceCfgOpts = append(replaceCfgOpts, ta.WithTLSConfig(
5050
filepath.Join(constants.TACollectorTLSDirPath, constants.TACollectorCAFileName),
5151
filepath.Join(constants.TACollectorTLSDirPath, constants.TACollectorTLSCertFileName),

internal/manifests/collector/container.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func Container(cfg config.Config, logger logr.Logger, otelcol v1beta1.OpenTeleme
8585
})
8686
}
8787

88-
if cfg.CertManagerAvailability() == certmanager.Available && featuregate.EnableTargetAllocatorMTLS.IsEnabled() {
88+
if otelcol.Spec.TargetAllocator.Enabled && cfg.CertManagerAvailability() == certmanager.Available && featuregate.EnableTargetAllocatorMTLS.IsEnabled() {
8989
volumeMounts = append(volumeMounts,
9090
corev1.VolumeMount{
9191
Name: naming.TAClientCertificate(otelcol.Name),

internal/manifests/collector/volume.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func Volumes(cfg config.Config, otelcol v1beta1.OpenTelemetryCollector) []corev1
4343
},
4444
}}
4545

46-
if cfg.CertManagerAvailability() == certmanager.Available && featuregate.EnableTargetAllocatorMTLS.IsEnabled() {
46+
if otelcol.Spec.TargetAllocator.Enabled && cfg.CertManagerAvailability() == certmanager.Available && featuregate.EnableTargetAllocatorMTLS.IsEnabled() {
4747
volumes = append(volumes, corev1.Volume{
4848
Name: naming.TAClientCertificate(otelcol.Name),
4949
VolumeSource: corev1.VolumeSource{

0 commit comments

Comments
 (0)