Skip to content

Commit

Permalink
fix ordering for container list merge to prefer incoming spec
Browse files Browse the repository at this point in the history
  • Loading branch information
nfoucha committed Nov 15, 2024
1 parent 179a385 commit 66db052
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/resources/nifi/nifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ func (r *Reconciler) reconcileNifiPod(log zap.Logger, desiredPod *corev1.Pod) (e
}
// If there are extra initContainers from webhook injections we need to add them
if len(currentPod.Spec.InitContainers) > len(desiredPod.Spec.InitContainers) {
desiredPod.Spec.InitContainers = append(currentPod.Spec.InitContainers, desiredPod.Spec.InitContainers...)
desiredPod.Spec.InitContainers = append(desiredPod.Spec.InitContainers, currentPod.Spec.InitContainers...)
uniqueContainers := []corev1.Container{}
keys := make(map[string]bool)
for _, c := range desiredPod.Spec.InitContainers {
Expand All @@ -695,7 +695,7 @@ func (r *Reconciler) reconcileNifiPod(log zap.Logger, desiredPod *corev1.Pod) (e
}
// If there are extra containers from webhook injections we need to add them
if len(currentPod.Spec.Containers) > len(desiredPod.Spec.Containers) {
desiredPod.Spec.Containers = append(currentPod.Spec.Containers, desiredPod.Spec.Containers...)
desiredPod.Spec.Containers = append(desiredPod.Spec.Containers, currentPod.Spec.Containers...)
uniqueContainers := []corev1.Container{}
keys := make(map[string]bool)
for _, c := range desiredPod.Spec.Containers {
Expand Down

0 comments on commit 66db052

Please sign in to comment.