Skip to content

Commit

Permalink
Fix duplicate mount path for /etc/pki/ca-trust/extracted/pem (#1121)
Browse files Browse the repository at this point in the history
Signed-off-by: Gary Brown <[email protected]>
  • Loading branch information
objectiser authored Jul 7, 2020
1 parent 02c0ad4 commit 55f0191
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/config/ca/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ func Update(jaeger *v1.Jaeger, commonSpec *v1.JaegerCommonSpec) {
ReadOnly: true,
}

commonSpec.Volumes = append(commonSpec.Volumes, volume)
commonSpec.VolumeMounts = append(commonSpec.VolumeMounts, volumeMount)
commonSpec.Volumes = util.RemoveDuplicatedVolumes(append(commonSpec.Volumes, volume))
commonSpec.VolumeMounts = util.RemoveDuplicatedVolumeMounts(append(commonSpec.VolumeMounts, volumeMount))
}

func deployTrustedCA(jaeger *v1.Jaeger) bool {
Expand Down
6 changes: 3 additions & 3 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func RemoveDuplicatedVolumes(volumes []corev1.Volume) []corev1.Volume {
return results
}

// removeDuplicatedVolumeMounts returns a unique list based on the item names. Only the first item is kept.
func removeDuplicatedVolumeMounts(volumeMounts []corev1.VolumeMount) []corev1.VolumeMount {
// RemoveDuplicatedVolumeMounts returns a unique list based on the item names. Only the first item is kept.
func RemoveDuplicatedVolumeMounts(volumeMounts []corev1.VolumeMount) []corev1.VolumeMount {
var results []corev1.VolumeMount
existing := map[string]bool{}

Expand Down Expand Up @@ -115,7 +115,7 @@ func Merge(commonSpecs []v1.JaegerCommonSpec) *v1.JaegerCommonSpec {
return &v1.JaegerCommonSpec{
Annotations: annotations,
Labels: labels,
VolumeMounts: removeDuplicatedVolumeMounts(volumeMounts),
VolumeMounts: RemoveDuplicatedVolumeMounts(volumeMounts),
Volumes: RemoveDuplicatedVolumes(volumes),
Resources: *resources,
Affinity: affinity,
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestRemoveDuplicatedVolumeMounts(t *testing.T) {
ReadOnly: true,
}}

assert.Len(t, removeDuplicatedVolumeMounts(volumeMounts), 2)
assert.Len(t, RemoveDuplicatedVolumeMounts(volumeMounts), 2)
assert.Equal(t, "data1", volumeMounts[0].Name)
assert.Equal(t, false, volumeMounts[0].ReadOnly)
assert.Equal(t, "data2", volumeMounts[1].Name)
Expand Down

0 comments on commit 55f0191

Please sign in to comment.