Skip to content

Commit

Permalink
Merge pull request #561 from paramite/ksmstatus
Browse files Browse the repository at this point in the history
Refactor Ceilometer services' status objects
  • Loading branch information
paramite authored Jan 17, 2025
2 parents 1bc386e + f714e48 commit cc10815
Show file tree
Hide file tree
Showing 11 changed files with 293 additions and 186 deletions.
14 changes: 14 additions & 0 deletions api/bases/telemetry.openstack.org_ceilometers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ spec:
type: string
ksmStatus:
description: KSMStatus defines the observed state of kube-state-metrics
[DEPRECATED, Status is used instead]
properties:
conditions:
description: Conditions
Expand Down Expand Up @@ -136,6 +137,10 @@ spec:
type: object
ipmiImage:
type: string
ksmEnabled:
default: true
description: Whether kube-state-metrics should be deployed
type: boolean
ksmImage:
type: string
ksmTls:
Expand Down Expand Up @@ -295,6 +300,15 @@ spec:
type: string
description: Map of hashes to track e.g. job status
type: object
ksmHash:
additionalProperties:
type: string
description: Map of hashes to track e.g. job status
type: object
ksmReadyCount:
description: ReadyCount of kube-state-metrics instances
format: int32
type: integer
mysqldExporterExportedGaleras:
description: List of galera CRs, which are being exported with mysqld_exporter
items:
Expand Down
4 changes: 4 additions & 0 deletions api/bases/telemetry.openstack.org_telemetries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ spec:
type: boolean
ipmiImage:
type: string
ksmEnabled:
default: true
description: Whether kube-state-metrics should be deployed
type: boolean
ksmImage:
type: string
ksmTls:
Expand Down
26 changes: 19 additions & 7 deletions api/v1beta1/ceilometer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ type CeilometerSpecCore struct {
// NetworkAttachmentDefinitions list of network attachment definitions the service pod gets attached to
NetworkAttachmentDefinitions []string `json:"networkAttachmentDefinitions,omitempty"`

// Whether kube-state-metrics should be deployed
// +kubebuilder:validation:optional
// +kubebuilder:default=true
KSMEnabled *bool `json:"ksmEnabled,omitempty"`

// Whether mysqld_exporter should be deployed
// +kubebuilder:validation:optional
MysqldExporterEnabled *bool `json:"mysqldExporterEnabled,omitempty"`
Expand Down Expand Up @@ -177,9 +182,17 @@ type CeilometerStatus struct {
// List of galera CRs, which are being exported with mysqld_exporter
// +listType=atomic
MysqldExporterExportedGaleras []string `json:"mysqldExporterExportedGaleras,omitempty"`

// ReadyCount of kube-state-metrics instances
KSMReadyCount int32 `json:"ksmReadyCount,omitempty"`

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

// KSMStatus defines the observed state of kube-state-metrics
// NOTE(mmagr): remove KSMStatus with API version increment

// KSMStatus defines the observed state of kube-state-metrics [DEPRECATED, Status is used instead]
type KSMStatus struct {
// ReadyCount of ksm instances
ReadyCount int32 `json:"readyCount,omitempty"`
Expand Down Expand Up @@ -207,9 +220,9 @@ type Ceilometer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

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

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

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

func init() {
Expand All @@ -233,7 +245,7 @@ func init() {

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

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

DashboardDefinitionReadyCondition condition.Type = "DashboardDefinitionReady"

// KSMReadyCondition Status=True condition which indicates if the KSM is configured and operational
KSMReadyCondition condition.Type = "KSMReady"
// KSMTLSInputReadyCondition Status=True condition when required TLS sources are ready for KSM
KSMTLSInputReadyCondition condition.Type = "KSMTLSInputReady"

// KSMDeploymentReadyCondition Status=True condition when KSM statefulset created ok
KSMDeploymentReadyCondition condition.Type = "KSMDeploymentReady"

// KSMServiceConfigReadyCondition Status=True Condition which indicates that all service config got rendered ok
KSMServiceConfigReadyCondition condition.Type = "KSMServiceConfigReady"

// KSMCreateServiceReadyCondition Status=True condition when k8s service for the KSM created ok
KSMCreateServiceReadyCondition condition.Type = "KSMCreateServiceReady"

// MysqldExporter conditions
MysqldExporterDBReadyCondition condition.Type = "MysqldExporterDBReady"
Expand Down Expand Up @@ -207,17 +216,8 @@ const (
//
// KSMReady condition messages
//
// KSMReadyInitMessage
KSMReadyInitMessage = "KSM not started"

// KSMReadyMessage
KSMReadyMessage = "KSM completed"

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

// KSMReadyRunningMessage
KSMReadyRunningMessage = "KSM in progress"
// KSMDisabledMessage
KSMDisabledMessage = "kube-state-metrics is disabled"

//
// mysqld_exporter condition messages
Expand Down
14 changes: 13 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions config/crd/bases/telemetry.openstack.org_ceilometers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ spec:
type: string
ksmStatus:
description: KSMStatus defines the observed state of kube-state-metrics
[DEPRECATED, Status is used instead]
properties:
conditions:
description: Conditions
Expand Down Expand Up @@ -136,6 +137,10 @@ spec:
type: object
ipmiImage:
type: string
ksmEnabled:
default: true
description: Whether kube-state-metrics should be deployed
type: boolean
ksmImage:
type: string
ksmTls:
Expand Down Expand Up @@ -295,6 +300,15 @@ spec:
type: string
description: Map of hashes to track e.g. job status
type: object
ksmHash:
additionalProperties:
type: string
description: Map of hashes to track e.g. job status
type: object
ksmReadyCount:
description: ReadyCount of kube-state-metrics instances
format: int32
type: integer
mysqldExporterExportedGaleras:
description: List of galera CRs, which are being exported with mysqld_exporter
items:
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/telemetry.openstack.org_telemetries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ spec:
type: boolean
ipmiImage:
type: string
ksmEnabled:
default: true
description: Whether kube-state-metrics should be deployed
type: boolean
ksmImage:
type: string
ksmTls:
Expand Down
Loading

0 comments on commit cc10815

Please sign in to comment.