@@ -447,17 +447,21 @@ func (s *Service) checkDiffAndPrepareUpdate(existingCluster *containerpb.Cluster
447447 }
448448
449449 // LoggingService
450- if existingCluster .GetLoggingService () != s .scope .GCPManagedControlPlane .Spec .LoggingService .String () {
451- needUpdate = true
452- clusterUpdate .DesiredLoggingService = s .scope .GCPManagedControlPlane .Spec .LoggingService .String ()
453- log .V (2 ).Info ("LoggingService config update required" , "current" , existingCluster .GetLoggingService (), "desired" , s .scope .GCPManagedControlPlane .Spec .LoggingService .String ())
450+ if specLoggingService := s .scope .GCPManagedControlPlane .Spec .LoggingService ; specLoggingService != nil {
451+ if existingCluster .GetLoggingService () != specLoggingService .String () {
452+ needUpdate = true
453+ clusterUpdate .DesiredLoggingService = specLoggingService .String ()
454+ log .V (2 ).Info ("LoggingService config update required" , "current" , existingCluster .GetLoggingService (), "desired" , specLoggingService .String ())
455+ }
454456 }
455457
456458 // MonitoringService
457- if existingCluster .GetMonitoringService () != s .scope .GCPManagedControlPlane .Spec .MonitoringService .String () {
458- needUpdate = true
459- clusterUpdate .DesiredLoggingService = s .scope .GCPManagedControlPlane .Spec .MonitoringService .String ()
460- log .V (2 ).Info ("MonitoringService config update required" , "current" , existingCluster .GetMonitoringService (), "desired" , s .scope .GCPManagedControlPlane .Spec .MonitoringService .String ())
459+ if specMonitoringService := s .scope .GCPManagedControlPlane .Spec .MonitoringService ; specMonitoringService != nil {
460+ if existingCluster .GetMonitoringService () != specMonitoringService .String () {
461+ needUpdate = true
462+ clusterUpdate .DesiredLoggingService = specMonitoringService .String ()
463+ log .V (2 ).Info ("MonitoringService config update required" , "current" , existingCluster .GetMonitoringService (), "desired" , specMonitoringService .String ())
464+ }
461465 }
462466
463467 // DesiredMasterAuthorizedNetworksConfig
0 commit comments