@@ -457,17 +457,21 @@ func (s *Service) checkDiffAndPrepareUpdate(existingCluster *containerpb.Cluster
457457 }
458458
459459 // LoggingService
460- if existingCluster .GetLoggingService () != s .scope .GCPManagedControlPlane .Spec .LoggingService .String () {
461- needUpdate = true
462- clusterUpdate .DesiredLoggingService = s .scope .GCPManagedControlPlane .Spec .LoggingService .String ()
463- log .V (2 ).Info ("LoggingService config update required" , "current" , existingCluster .GetLoggingService (), "desired" , s .scope .GCPManagedControlPlane .Spec .LoggingService .String ())
460+ if specLoggingService := s .scope .GCPManagedControlPlane .Spec .LoggingService ; specLoggingService != nil {
461+ if existingCluster .GetLoggingService () != specLoggingService .String () {
462+ needUpdate = true
463+ clusterUpdate .DesiredLoggingService = specLoggingService .String ()
464+ log .V (2 ).Info ("LoggingService config update required" , "current" , existingCluster .GetLoggingService (), "desired" , specLoggingService .String ())
465+ }
464466 }
465467
466468 // MonitoringService
467- if existingCluster .GetMonitoringService () != s .scope .GCPManagedControlPlane .Spec .MonitoringService .String () {
468- needUpdate = true
469- clusterUpdate .DesiredLoggingService = s .scope .GCPManagedControlPlane .Spec .MonitoringService .String ()
470- log .V (2 ).Info ("MonitoringService config update required" , "current" , existingCluster .GetMonitoringService (), "desired" , s .scope .GCPManagedControlPlane .Spec .MonitoringService .String ())
469+ if specMonitoringService := s .scope .GCPManagedControlPlane .Spec .MonitoringService ; specMonitoringService != nil {
470+ if existingCluster .GetMonitoringService () != specMonitoringService .String () {
471+ needUpdate = true
472+ clusterUpdate .DesiredLoggingService = specMonitoringService .String ()
473+ log .V (2 ).Info ("MonitoringService config update required" , "current" , existingCluster .GetMonitoringService (), "desired" , specMonitoringService .String ())
474+ }
471475 }
472476
473477 // DesiredMasterAuthorizedNetworksConfig
0 commit comments