Skip to content
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

Enabling collector to mount multiple configMaps #1989

Merged
merged 19 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed lints
Signed-off-by: Yuri Sa <yurimsa@gmail.com>
  • Loading branch information
yuriolisa committed Aug 4, 2023
commit 427cb4d24312db3f3ad946cb988077c05d1553fc
16 changes: 16 additions & 0 deletions .chloggen/add-more-configmaps.yaml
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: 'enhancement'

# 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: Allow the collector CRD to specify a list of configmaps to mount

# One or more tracking issues related to the change
issues: [1819]

# (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:
2 changes: 1 addition & 1 deletion internal/manifests/collector/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func Volumes(cfg config.Config, otelcol v1alpha1.OpenTelemetryCollector) []corev
if len(otelcol.Spec.ConfigMaps) > 0 {
for _, cfgMap := range otelcol.Spec.ConfigMaps {
yuriolisa marked this conversation as resolved.
Show resolved Hide resolved
volumes = append(volumes, corev1.Volume{
Name: "configmap_"+cfgMap,
Name: "configmap_" + cfgMap,
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Expand Down
8 changes: 4 additions & 4 deletions internal/manifests/collector/volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func TestVolumeWithMoreConfigMaps(t *testing.T) {
// prepare
otelcol := v1alpha1.OpenTelemetryCollector{
Spec: v1alpha1.OpenTelemetryCollectorSpec{
ConfigMaps: []string{"configmap-test"},
},
}
ConfigMaps: []string{"configmap-test"},
},
}
cfg := config.New()

// test
Expand All @@ -79,4 +79,4 @@ func TestVolumeWithMoreConfigMaps(t *testing.T) {

// check if the volume with the configmap prefix is mounted after defining the config map.
assert.Equal(t, "configmap_configmap-test", volumes[1].Name)
}
}