Skip to content

Commit 243a898

Browse files
committed
Refactor conditional logic
1 parent a736dd6 commit 243a898

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

internal/controller/handler.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,14 @@ func (h *eventHandlerImpl) sendNginxConfig(ctx context.Context, logger logr.Logg
243243

244244
vm := []v1.VolumeMount{}
245245
if gw.EffectiveNginxProxy != nil &&
246-
gw.EffectiveNginxProxy.Kubernetes != nil &&
247-
gw.EffectiveNginxProxy.Kubernetes.Deployment != nil {
248-
vm = gw.EffectiveNginxProxy.Kubernetes.Deployment.Container.VolumeMounts
249-
}
246+
gw.EffectiveNginxProxy.Kubernetes != nil {
247+
if gw.EffectiveNginxProxy.Kubernetes.Deployment != nil {
248+
vm = gw.EffectiveNginxProxy.Kubernetes.Deployment.Container.VolumeMounts
249+
}
250250

251-
if gw.EffectiveNginxProxy != nil &&
252-
gw.EffectiveNginxProxy.Kubernetes != nil &&
253-
gw.EffectiveNginxProxy.Kubernetes.DaemonSet != nil {
254-
vm = gw.EffectiveNginxProxy.Kubernetes.DaemonSet.Container.VolumeMounts
251+
if gw.EffectiveNginxProxy.Kubernetes.DaemonSet != nil {
252+
vm = gw.EffectiveNginxProxy.Kubernetes.DaemonSet.Container.VolumeMounts
253+
}
255254
}
256255

257256
deployment.FileLock.Lock()

0 commit comments

Comments
 (0)