Skip to content

refactor: consolidate redundant spireEnabled checks - #365

Merged
pdettori merged 1 commit into
mainfrom
refactor/consolidate-spire-volume-mounts
May 20, 2026
Merged

refactor: consolidate redundant spireEnabled checks#365
pdettori merged 1 commit into
mainfrom
refactor/consolidate-spire-volume-mounts

Conversation

@Alan-Cha

Copy link
Copy Markdown
Member

Summary

Consolidates two consecutive if spireEnabled blocks in BuildEnvoyProxyContainerWithSpireOption into a single conditional block.

Changes

  • Merged lines 111-117 and 119-128 in container_builder.go
  • Both volume mounts (svid-output and spiffe-helper-config) now added in a single append call
  • Preserved the comment explaining why spiffe-helper-config is needed

Testing

  • ✅ All existing tests pass
  • No functional changes, purely refactoring for readability

Before

if spireEnabled {
    volumeMounts = append(volumeMounts, corev1.VolumeMount{...})
}

if spireEnabled {
    volumeMounts = append(volumeMounts, corev1.VolumeMount{...})
}

After

if spireEnabled {
    volumeMounts = append(volumeMounts,
        corev1.VolumeMount{...},
        corev1.VolumeMount{...},
    )
}

Assisted-By: Claude Code

…yContainer

The BuildEnvoyProxyContainerWithSpireOption method had two consecutive
if spireEnabled blocks that each appended volume mounts. This consolidates
them into a single conditional block for better readability and
maintainability while preserving the same functional behavior.

Signed-off-by: Alan Cha <Alan.cha1@ibm.com>
@pdettori
pdettori merged commit 498974d into main May 20, 2026
16 checks passed
@pdettori
pdettori deleted the refactor/consolidate-spire-volume-mounts branch May 20, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants