Skip to content

Add health check for flink.apache.org/FlinkSessionJob #26523

@oli2v

Description

@oli2v

Summary

Add a Lua script which maps a FlinkSessionJob's state to a ArgoCD health status.

Motivation

There is no current health check for FlinkSessionJob.

Proposal

local health_status = {}
local healthy_states = {
  ["RUNNING"] = true,
  ["CANCELED"] = true,
  ["FINISHED"] = true,
  ["SUSPENDED"] = true
}

  if obj.status ~= nil and obj.status.jobStatus ~= nil then
    if obj.status.jobStatus.state == nil and obj.status.error ~= nil then
	health_status.status = "Degraded"
	health_status.message = "FlinkSessionJob reconciliation failed: " .. obj.status.error
      return health_status
    end
    if healthy_states[obj.status.jobStatus.state] then
	health_status.status = "Healthy"
	health_status.message = "FlinkSessionJob is successfully " .. obj.status.jobStatus.state
	return health_status
    end
    if obj.status.jobStatus.state == "CREATED" or obj.status.jobStatus.state == "RECONCILING" then
      health_status.status = "Progressing"
      health_status.message = "FlinkSessionJob is reconciling"
      return health_status
    end
    if obj.status.jobStatus.state == "FAILED" then
      health_status.status = "Degraded"
      health_status.message = "FlinkSessionJob failed: " .. obj.status.error
      return health_status
    end
  end
  health_status.status = "Unknown"
  health_status.message = "Unknown FlinkSessionJob state"
  return health_status

Metadata

Metadata

Assignees

No one assigned

    Labels

    component:health-checkIssue related to built-in Health Check customizationsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions