Skip to content

Commit 8cf8a0c

Browse files
committed
Deprecate non-working KSMStatus
This patch moves status data about kube-state-metrics to CeilometerStatus, because currently KSMStatus does not update properly and if helper.PatchInstance is made to update KSMStatus then Ceilometer objects ends in never ending reconciliation loop.
1 parent c1e8bc2 commit 8cf8a0c

9 files changed

+211
-103
lines changed

api/bases/telemetry.openstack.org_ceilometers.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ spec:
4444
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
4545
type: string
4646
ksmStatus:
47-
description: KSMStatus defines the observed state of kube-state-metrics
47+
description: |-
48+
NOTE(mmagr): remove with API version increment
49+
Deprecated
4850
properties:
4951
conditions:
5052
description: Conditions
@@ -136,6 +138,10 @@ spec:
136138
type: object
137139
ipmiImage:
138140
type: string
141+
ksmEnabled:
142+
default: true
143+
description: Whether kube-state-metrics should be deployed
144+
type: boolean
139145
ksmImage:
140146
type: string
141147
ksmTls:
@@ -295,6 +301,15 @@ spec:
295301
type: string
296302
description: Map of hashes to track e.g. job status
297303
type: object
304+
ksmHash:
305+
additionalProperties:
306+
type: string
307+
description: Map of hashes to track e.g. job status
308+
type: object
309+
ksmReadyCount:
310+
description: ReadyCount of kube-state-metrics instances
311+
format: int32
312+
type: integer
298313
mysqldExporterExportedGaleras:
299314
description: List of galera CRs, which are being exported with mysqld_exporter
300315
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: 14 additions & 3 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,16 @@ 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 with API version increment
194+
// Deprecated
183195
type KSMStatus struct {
184196
// ReadyCount of ksm instances
185197
ReadyCount int32 `json:"readyCount,omitempty"`
@@ -223,8 +235,7 @@ type CeilometerList struct {
223235

224236
// IsReady - returns true if Ceilometer is reconciled successfully
225237
func (instance Ceilometer) IsReady() bool {
226-
return instance.CeilometerStatus.Conditions.IsTrue(condition.ReadyCondition) &&
227-
instance.KSMStatus.Conditions.IsTrue(condition.ReadyCondition)
238+
return instance.CeilometerStatus.Conditions.IsTrue(condition.ReadyCondition)
228239
}
229240

230241
func init() {

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: 12 additions & 0 deletions
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: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ spec:
4444
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
4545
type: string
4646
ksmStatus:
47-
description: KSMStatus defines the observed state of kube-state-metrics
47+
description: |-
48+
NOTE(mmagr): remove with API version increment
49+
Deprecated
4850
properties:
4951
conditions:
5052
description: Conditions
@@ -136,6 +138,10 @@ spec:
136138
type: object
137139
ipmiImage:
138140
type: string
141+
ksmEnabled:
142+
default: true
143+
description: Whether kube-state-metrics should be deployed
144+
type: boolean
139145
ksmImage:
140146
type: string
141147
ksmTls:
@@ -295,6 +301,15 @@ spec:
295301
type: string
296302
description: Map of hashes to track e.g. job status
297303
type: object
304+
ksmHash:
305+
additionalProperties:
306+
type: string
307+
description: Map of hashes to track e.g. job status
308+
type: object
309+
ksmReadyCount:
310+
description: ReadyCount of kube-state-metrics instances
311+
format: int32
312+
type: integer
298313
mysqldExporterExportedGaleras:
299314
description: List of galera CRs, which are being exported with mysqld_exporter
300315
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)