Skip to content

Commit

Permalink
Use structured log for cluster desired state (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas authored Oct 19, 2022
1 parent 70fde59 commit d60e6a0
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions controllers/flinkcluster/flinkcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,48 +183,49 @@ func (handler *FlinkClusterHandler) reconcile(ctx context.Context,

*desired = *getDesiredClusterState(observed)
if desired.ConfigMap != nil {
log.Info("Desired state", "ConfigMap", *desired.ConfigMap)
log = log.WithValues("ConfigMap", *desired.ConfigMap)
} else {
log.Info("Desired state", "ConfigMap", "nil")
log = log.WithValues("ConfigMap", "nil")
}
if desired.PodDisruptionBudget != nil {
log.Info("Desired state", "PodDisruptionBudget", *desired.PodDisruptionBudget)
log = log.WithValues("PodDisruptionBudget", *desired.PodDisruptionBudget)
} else {
log.Info("Desired state", "PodDisruptionBudget", "nil")
log = log.WithValues("PodDisruptionBudget", "nil")
}
if desired.TmService != nil {
log.Info("Desired state", "TaskManager Service", *desired.TmService)
log = log.WithValues("TaskManager Service", *desired.TmService)
} else {
log.Info("Desired state", "TaskManager Service", "nil")
log = log.WithValues("TaskManager Service", "nil")
}
if desired.JmStatefulSet != nil {
log.Info("Desired state", "JobManager StatefulSet", *desired.JmStatefulSet)
log = log.WithValues("JobManager StatefulSet", *desired.JmStatefulSet)
} else {
log.Info("Desired state", "JobManager StatefulSet", "nil")
log = log.WithValues("JobManager StatefulSet", "nil")
}
if desired.JmService != nil {
log.Info("Desired state", "JobManager service", *desired.JmService)
log = log.WithValues("JobManager service", *desired.JmService)
} else {
log.Info("Desired state", "JobManager service", "nil")
log = log.WithValues("JobManager service", "nil")
}
if desired.JmIngress != nil {
log.Info("Desired state", "JobManager ingress", *desired.JmIngress)
log = log.WithValues("JobManager ingress", *desired.JmIngress)
} else {
log.Info("Desired state", "JobManager ingress", "nil")
log = log.WithValues("JobManager ingress", "nil")
}
if desired.TmStatefulSet != nil {
log.Info("Desired state", "TaskManager StatefulSet", *desired.TmStatefulSet)
log = log.WithValues("TaskManager StatefulSet", *desired.TmStatefulSet)
} else if desired.TmDeployment != nil {
log.Info("Desired state", "TaskManager Deployment", *desired.TmDeployment)
log = log.WithValues("TaskManager Deployment", *desired.TmDeployment)
} else {
log.Info("Desired state", "TaskManager", "nil")
log = log.WithValues("TaskManager", "nil")
}

if desired.Job != nil {
log.Info("Desired state", "Job", *desired.Job)
log = log.WithValues("Job", *desired.Job)
} else {
log.Info("Desired state", "Job", "nil")
log = log.WithValues("Job", "nil")
}
log.Info("Desired state")

log.Info("---------- 4. Take actions ----------")

Expand Down

0 comments on commit d60e6a0

Please sign in to comment.