Skip to content

Commit cc10815

Browse files
authored
Merge pull request #561 from paramite/ksmstatus
Refactor Ceilometer services' status objects
2 parents 1bc386e + f714e48 commit cc10815

11 files changed

+293
-186
lines changed

api/bases/telemetry.openstack.org_ceilometers.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ spec:
4545
type: string
4646
ksmStatus:
4747
description: KSMStatus defines the observed state of kube-state-metrics
48+
[DEPRECATED, Status is used instead]
4849
properties:
4950
conditions:
5051
description: Conditions
@@ -136,6 +137,10 @@ spec:
136137
type: object
137138
ipmiImage:
138139
type: string
140+
ksmEnabled:
141+
default: true
142+
description: Whether kube-state-metrics should be deployed
143+
type: boolean
139144
ksmImage:
140145
type: string
141146
ksmTls:
@@ -295,6 +300,15 @@ spec:
295300
type: string
296301
description: Map of hashes to track e.g. job status
297302
type: object
303+
ksmHash:
304+
additionalProperties:
305+
type: string
306+
description: Map of hashes to track e.g. job status
307+
type: object
308+
ksmReadyCount:
309+
description: ReadyCount of kube-state-metrics instances
310+
format: int32
311+
type: integer
298312
mysqldExporterExportedGaleras:
299313
description: List of galera CRs, which are being exported with mysqld_exporter
300314
items:

api/bases/telemetry.openstack.org_telemetries.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ spec:
433433
type: boolean
434434
ipmiImage:
435435
type: string
436+
ksmEnabled:
437+
default: true
438+
description: Whether kube-state-metrics should be deployed
439+
type: boolean
436440
ksmImage:
437441
type: string
438442
ksmTls:

api/v1beta1/ceilometer_types.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ type CeilometerSpecCore struct {
113113
// NetworkAttachmentDefinitions list of network attachment definitions the service pod gets attached to
114114
NetworkAttachmentDefinitions []string `json:"networkAttachmentDefinitions,omitempty"`
115115

116+
// Whether kube-state-metrics should be deployed
117+
// +kubebuilder:validation:optional
118+
// +kubebuilder:default=true
119+
KSMEnabled *bool `json:"ksmEnabled,omitempty"`
120+
116121
// Whether mysqld_exporter should be deployed
117122
// +kubebuilder:validation:optional
118123
MysqldExporterEnabled *bool `json:"mysqldExporterEnabled,omitempty"`
@@ -177,9 +182,17 @@ type CeilometerStatus struct {
177182
// List of galera CRs, which are being exported with mysqld_exporter
178183
// +listType=atomic
179184
MysqldExporterExportedGaleras []string `json:"mysqldExporterExportedGaleras,omitempty"`
185+
186+
// ReadyCount of kube-state-metrics instances
187+
KSMReadyCount int32 `json:"ksmReadyCount,omitempty"`
188+
189+
// Map of hashes to track e.g. job status
190+
KSMHash map[string]string `json:"ksmHash,omitempty"`
180191
}
181192

182-
// KSMStatus defines the observed state of kube-state-metrics
193+
// NOTE(mmagr): remove KSMStatus with API version increment
194+
195+
// KSMStatus defines the observed state of kube-state-metrics [DEPRECATED, Status is used instead]
183196
type KSMStatus struct {
184197
// ReadyCount of ksm instances
185198
ReadyCount int32 `json:"readyCount,omitempty"`
@@ -207,9 +220,9 @@ type Ceilometer struct {
207220
metav1.TypeMeta `json:",inline"`
208221
metav1.ObjectMeta `json:"metadata,omitempty"`
209222

210-
Spec CeilometerSpec `json:"spec,omitempty"`
211-
CeilometerStatus CeilometerStatus `json:"status,omitempty"`
212-
KSMStatus KSMStatus `json:"ksmStatus,omitempty"`
223+
Spec CeilometerSpec `json:"spec,omitempty"`
224+
Status CeilometerStatus `json:"status,omitempty"`
225+
KSMStatus KSMStatus `json:"ksmStatus,omitempty"`
213226
}
214227

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

224237
// IsReady - returns true if Ceilometer is reconciled successfully
225238
func (instance Ceilometer) IsReady() bool {
226-
return instance.CeilometerStatus.Conditions.IsTrue(condition.ReadyCondition) &&
227-
instance.KSMStatus.Conditions.IsTrue(condition.ReadyCondition)
239+
return instance.Status.Conditions.IsTrue(condition.ReadyCondition)
228240
}
229241

230242
func init() {
@@ -233,7 +245,7 @@ func init() {
233245

234246
// RbacConditionsSet - set the conditions for the rbac object
235247
func (instance Ceilometer) RbacConditionsSet(c *condition.Condition) {
236-
instance.CeilometerStatus.Conditions.Set(c)
248+
instance.Status.Conditions.Set(c)
237249
}
238250

239251
// RbacNamespace - return the namespace

api/v1beta1/conditions.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,17 @@ const (
5656

5757
DashboardDefinitionReadyCondition condition.Type = "DashboardDefinitionReady"
5858

59-
// KSMReadyCondition Status=True condition which indicates if the KSM is configured and operational
60-
KSMReadyCondition condition.Type = "KSMReady"
59+
// KSMTLSInputReadyCondition Status=True condition when required TLS sources are ready for KSM
60+
KSMTLSInputReadyCondition condition.Type = "KSMTLSInputReady"
61+
62+
// KSMDeploymentReadyCondition Status=True condition when KSM statefulset created ok
63+
KSMDeploymentReadyCondition condition.Type = "KSMDeploymentReady"
64+
65+
// KSMServiceConfigReadyCondition Status=True Condition which indicates that all service config got rendered ok
66+
KSMServiceConfigReadyCondition condition.Type = "KSMServiceConfigReady"
67+
68+
// KSMCreateServiceReadyCondition Status=True condition when k8s service for the KSM created ok
69+
KSMCreateServiceReadyCondition condition.Type = "KSMCreateServiceReady"
6170

6271
// MysqldExporter conditions
6372
MysqldExporterDBReadyCondition condition.Type = "MysqldExporterDBReady"
@@ -207,17 +216,8 @@ const (
207216
//
208217
// KSMReady condition messages
209218
//
210-
// KSMReadyInitMessage
211-
KSMReadyInitMessage = "KSM not started"
212-
213-
// KSMReadyMessage
214-
KSMReadyMessage = "KSM completed"
215-
216-
// KSMReadyErrorMessage
217-
KSMReadyErrorMessage = "KSM error occured %s"
218-
219-
// KSMReadyRunningMessage
220-
KSMReadyRunningMessage = "KSM in progress"
219+
// KSMDisabledMessage
220+
KSMDisabledMessage = "kube-state-metrics is disabled"
221221

222222
//
223223
// mysqld_exporter condition messages

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/telemetry.openstack.org_ceilometers.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ spec:
4545
type: string
4646
ksmStatus:
4747
description: KSMStatus defines the observed state of kube-state-metrics
48+
[DEPRECATED, Status is used instead]
4849
properties:
4950
conditions:
5051
description: Conditions
@@ -136,6 +137,10 @@ spec:
136137
type: object
137138
ipmiImage:
138139
type: string
140+
ksmEnabled:
141+
default: true
142+
description: Whether kube-state-metrics should be deployed
143+
type: boolean
139144
ksmImage:
140145
type: string
141146
ksmTls:
@@ -295,6 +300,15 @@ spec:
295300
type: string
296301
description: Map of hashes to track e.g. job status
297302
type: object
303+
ksmHash:
304+
additionalProperties:
305+
type: string
306+
description: Map of hashes to track e.g. job status
307+
type: object
308+
ksmReadyCount:
309+
description: ReadyCount of kube-state-metrics instances
310+
format: int32
311+
type: integer
298312
mysqldExporterExportedGaleras:
299313
description: List of galera CRs, which are being exported with mysqld_exporter
300314
items:

config/crd/bases/telemetry.openstack.org_telemetries.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ spec:
433433
type: boolean
434434
ipmiImage:
435435
type: string
436+
ksmEnabled:
437+
default: true
438+
description: Whether kube-state-metrics should be deployed
439+
type: boolean
436440
ksmImage:
437441
type: string
438442
ksmTls:

0 commit comments

Comments
 (0)