Skip to content

Commit

Permalink
Separate status for KSM
Browse files Browse the repository at this point in the history
  • Loading branch information
paramite committed Sep 23, 2024
1 parent 68abf93 commit dda3b1e
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 83 deletions.
27 changes: 18 additions & 9 deletions api/v1beta1/ceilometer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ type CeilometerSpecCore struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec
// TLS - Parameters related to the TLS
TLS tls.SimpleService `json:"tls,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// KSMTLS - Parameters related to the TLS for kube-state-metrics
KSMTLS tls.SimpleService `json:"tls,omitempty"`
}

// CeilometerStatus defines the observed state of Ceilometer
Expand All @@ -138,6 +133,18 @@ type CeilometerStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// KSMStatus defines the observed state of kube-state-metrics
type KSMStatus struct {
// ReadyCount of ksm instances
ReadyCount int32 `json:"readyCount,omitempty"`

// Map of hashes to track e.g. job status
Hash map[string]string `json:"hash,omitempty"`

// Conditions
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

Expand All @@ -146,8 +153,9 @@ type Ceilometer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CeilometerSpec `json:"spec,omitempty"`
Status CeilometerStatus `json:"status,omitempty"`
Spec CeilometerSpec `json:"spec,omitempty"`
CeilometerStatus CeilometerStatus `json:"status,omitempty"`
KSMStatus KSMStatus `json:"ksmStatus,omitempty"`
}

//+kubebuilder:object:root=true
Expand All @@ -161,7 +169,8 @@ type CeilometerList struct {

// IsReady - returns true if Ceilometer is reconciled successfully
func (instance Ceilometer) IsReady() bool {
return instance.Status.Conditions.IsTrue(condition.ReadyCondition)
return instance.CeilometerStatus.Conditions.IsTrue(condition.ReadyCondition) &&
instance.KSMStatus.Conditions.IsTrue(condition.ReadyCondition)
}

func init() {
Expand All @@ -170,7 +179,7 @@ func init() {

// RbacConditionsSet - set the conditions for the rbac object
func (instance Ceilometer) RbacConditionsSet(c *condition.Condition) {
instance.Status.Conditions.Set(c)
instance.CeilometerStatus.Conditions.Set(c)
}

// RbacNamespace - return the namespace
Expand Down
22 changes: 11 additions & 11 deletions api/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const (

DashboardDefinitionReadyCondition condition.Type = "DashboardDefinitionReady"

// AvailabilityReadyCondition Status=True condition which indicates if the Availability is configured and operational
AvailabilityReadyCondition condition.Type = "AvailabilityReady"
// KSMReadyCondition Status=True condition which indicates if the KSM is configured and operational
KSMReadyCondition condition.Type = "KSMReady"
)

// Telemetry Reasons used by API objects.
Expand Down Expand Up @@ -194,17 +194,17 @@ const (
DashboardDefinitionFailedMessage = "Error occured when trying to install the dashboard definitions: %s"

//
// AvailabilityReady condition messages
// KSMReady condition messages
//
// AvailabilityReadyInitMessage
AvailabilityReadyInitMessage = "Availability not started"
// KSMReadyInitMessage
KSMReadyInitMessage = "KSM not started"

// AvailabilityReadyMessage
AvailabilityReadyMessage = "Availability completed"
// KSMReadyMessage
KSMReadyMessage = "KSM completed"

// AvailabilityReadyErrorMessage
AvailabilityReadyErrorMessage = "Availability error occured %s"
// KSMReadyErrorMessage
KSMReadyErrorMessage = "KSM error occured %s"

// AvailabilityReadyRunningMessage
AvailabilityReadyRunningMessage = "Availability in progress"
// KSMReadyRunningMessage
KSMReadyRunningMessage = "KSM in progress"
)
Loading

0 comments on commit dda3b1e

Please sign in to comment.