Documentation
¶
Index ¶
- Constants
- type Condition
- type ConditionReason
- type ConditionType
- type Error
- type Service
- func (s *Service) ClearStatus(name string)
- func (s *Service) DeleteStatus(name string)
- func (s *Service) GetStatus(name string) Status
- func (s *Service) HandleError(name string, cond ConditionType, err error)
- func (s *Service) Queue() workqueue.TypedRateLimitingInterface[string]
- func (s *Service) SetConditionFalse(name string, condition ConditionType, reason, message string)
- func (s *Service) SetConditionTrue(name string, condition ConditionType)
- func (s *Service) Shutdown()
- func (s *Service) UpdateHealth(name string, event health.Event)
- func (s *Service) UpdateSettings(name string, settings addonutils.Values)
- func (s *Service) UpdateTracking(name string, report progrep.ProgressReport)
- func (s *Service) UpdateVersion(name string, version string)
- type Status
- type Tracking
Constants ¶
const ( // ConditionRequirementsMet indicates package requirements validation passed ConditionRequirementsMet ConditionType = "RequirementsMet" // ConditionReadyOnFilesystem indicates package was successfully mounted and accessible ConditionReadyOnFilesystem ConditionType = "ReadyOnFilesystem" // ConditionLoaded indicates package is loaded in runtime ConditionLoaded ConditionType = "Loaded" // ConditionHooksProcessed indicates all package hooks executed successfully ConditionHooksProcessed ConditionType = "HooksProcessed" // ConditionManifestsApplied indicates Helm release was successfully applied ConditionManifestsApplied ConditionType = "ManifestsApplied" // ConditionScaled checks the cluster resources are ready ConditionScaled ConditionType = "Scaled" // ConditionConfigured checks the settings passed openAPI validation ConditionConfigured ConditionType = "Configured" // ConditionPending indicates that the package wait converge ConditionPending ConditionType = "Pending" // ConditionReasonApplyingManifests indicates that nelm is applying manifests to the cluster ConditionReasonApplyingManifests ConditionReason = "ApplyingManifests" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct {
Type ConditionType `json:"type"`
Status metav1.ConditionStatus `json:"status"` // true = condition met, false = condition failed
Reason ConditionReason `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
}
Condition represents a single status condition for a package
type ConditionReason ¶
type ConditionReason string
type ConditionType ¶
type ConditionType string
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error wraps an error with associated status conditions Used to propagate both error details and status updates through the call stack
func NewError ¶ added in v1.76.1
func NewError(reason ConditionReason, err error) *Error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service tracks package statuses and notifies listeners of changes
func NewService ¶
func NewService() *Service
func (*Service) ClearStatus ¶ added in v1.76.1
ClearStatus creates a new status or resets conditions. If a health event was buffered by UpdateHealth before this name was registered, it is applied here and the buffer entry is dropped.
func (*Service) DeleteStatus ¶ added in v1.76.1
DeleteStatus removes a package status from tracking Should be called when a package is deleted to prevent memory leaks
func (*Service) GetStatus ¶
GetStatus retrieves a copy of the current status for a package by name ("namespace.name") Returns a copy to prevent race conditions with concurrent modifications
func (*Service) HandleError ¶
func (s *Service) HandleError(name string, cond ConditionType, err error)
HandleError processes an error and extracts status conditions from it Notifies listeners if any conditions changed
func (*Service) Queue ¶ added in v1.76.1
func (s *Service) Queue() workqueue.TypedRateLimitingInterface[string]
Queue returns the notification queue. Consumers pull changed package names via Get/Done and requeue transient failures via AddRateLimited.
func (*Service) SetConditionFalse ¶ added in v1.76.0
func (s *Service) SetConditionFalse(name string, condition ConditionType, reason, message string)
SetConditionFalse marks a condition as successful and notifies listeners if changed
func (*Service) SetConditionTrue ¶
func (s *Service) SetConditionTrue(name string, condition ConditionType)
SetConditionTrue marks a condition as successful and notifies listeners if changed
func (*Service) Shutdown ¶ added in v1.76.1
func (s *Service) Shutdown()
Shutdown stops the notification queue; the consumer loop exits on the next Get.
func (*Service) UpdateHealth ¶ added in v1.76.1
UpdateHealth applies a workload-health transition to ConditionScaled. State mapping to K8s condition status:
StateScaled → True, Reason="Scaled" StateReconciling, StateDegraded → False, Reason=State, Message=workload detail StateUnknown → Unknown, Reason="" (no workloads to observe)
If the package is not yet tracked by the service, the event is buffered and applied by the next ClearStatus call for the same name. This closes the startup race in which the health monitor observes workloads before the package is registered.
func (*Service) UpdateSettings ¶ added in v1.76.0
func (s *Service) UpdateSettings(name string, settings addonutils.Values)
UpdateSettings stores the effective settings of a package. Does not notify — the caller pairs this with SetConditionTrue which notifies.
func (*Service) UpdateTracking ¶ added in v1.76.0
func (s *Service) UpdateTracking(name string, report progrep.ProgressReport)
UpdateTracking updates the nelm progress report for a package and notifies listeners. If the package is not tracked by the service, the update is silently ignored.
func (*Service) UpdateVersion ¶ added in v1.76.1
UpdateVersion sets the current version of package
type Status ¶
type Status struct {
Version string `json:"version"`
Conditions []Condition `json:"conditions"`
Tracking Tracking `json:"tracking"`
Settings addonutils.Values `json:"settings,omitempty"`
}
Status represents the current state of a package
func (*Status) IsConditionTrue ¶ added in v1.76.1
func (s *Status) IsConditionTrue(condType ConditionType) bool
IsConditionTrue returns true if the condition status is True