Skip to content

Commit 5fc45e1

Browse files
Merge pull request #551 from vyzigold/mysqld_exporter_squashed
[OSPRH-11073] Add mysqld_exporter
2 parents 09a19a6 + 282ffde commit 5fc45e1

File tree

19 files changed

+1246
-25
lines changed

19 files changed

+1246
-25
lines changed

api/bases/telemetry.openstack.org_ceilometers.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,31 @@ spec:
149149
description: SecretName - holding the cert, key for the service
150150
type: string
151151
type: object
152+
mysqldExporterDatabaseAccountPrefix:
153+
default: mysqld-exporter
154+
description: MysqldExporterDatabaseAccountPrefix - Database account
155+
prefix for the mysqld-exporter. A mariadbaccount CR named "<mysqldExporterDatabaseAccountPrefix>-<galera
156+
CR name>" for each galera instance needs to be either created by
157+
the user or if it's missing, it'll be created by the telemetry-operator
158+
automatically.
159+
type: string
160+
mysqldExporterEnabled:
161+
description: Whether mysqld_exporter should be deployed
162+
type: boolean
163+
mysqldExporterImage:
164+
type: string
165+
mysqldExporterTLS:
166+
description: MysqldExporterTLS - Parameters related to the TLS for
167+
mysqld_exporter
168+
properties:
169+
caBundleSecretName:
170+
description: CaBundleSecretName - holding the CA certs in a pre-created
171+
bundle file
172+
type: string
173+
secretName:
174+
description: SecretName - holding the cert, key for the service
175+
type: string
176+
type: object
152177
networkAttachmentDefinitions:
153178
description: NetworkAttachmentDefinitions list of network attachment
154179
definitions the service pod gets attached to
@@ -270,6 +295,21 @@ spec:
270295
type: string
271296
description: Map of hashes to track e.g. job status
272297
type: object
298+
mysqldExporterExportedGaleras:
299+
description: List of galera CRs, which are being exported with mysqld_exporter
300+
items:
301+
type: string
302+
type: array
303+
x-kubernetes-list-type: atomic
304+
mysqldExporterHash:
305+
additionalProperties:
306+
type: string
307+
description: Map of hashes to track e.g. job status
308+
type: object
309+
mysqldExporterReadyCount:
310+
description: ReadyCount of mysqld_exporter instances
311+
format: int32
312+
type: integer
273313
networks:
274314
description: Networks in addtion to the cluster network, the service
275315
is attached to

api/bases/telemetry.openstack.org_telemetries.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,31 @@ spec:
446446
description: SecretName - holding the cert, key for the service
447447
type: string
448448
type: object
449+
mysqldExporterDatabaseAccountPrefix:
450+
default: mysqld-exporter
451+
description: MysqldExporterDatabaseAccountPrefix - Database account
452+
prefix for the mysqld-exporter. A mariadbaccount CR named "<mysqldExporterDatabaseAccountPrefix>-<galera
453+
CR name>" for each galera instance needs to be either created
454+
by the user or if it's missing, it'll be created by the telemetry-operator
455+
automatically.
456+
type: string
457+
mysqldExporterEnabled:
458+
description: Whether mysqld_exporter should be deployed
459+
type: boolean
460+
mysqldExporterImage:
461+
type: string
462+
mysqldExporterTLS:
463+
description: MysqldExporterTLS - Parameters related to the TLS
464+
for mysqld_exporter
465+
properties:
466+
caBundleSecretName:
467+
description: CaBundleSecretName - holding the CA certs in
468+
a pre-created bundle file
469+
type: string
470+
secretName:
471+
description: SecretName - holding the cert, key for the service
472+
type: string
473+
type: object
449474
networkAttachmentDefinitions:
450475
description: NetworkAttachmentDefinitions list of network attachment
451476
definitions the service pod gets attached to

api/v1beta1/ceilometer_types.go

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const (
4040
CeilometerProxyContainerImage = "quay.io/podified-antelope-centos9/openstack-aodh-api:current-podified"
4141
// KubeStateMetricsImage - default fall-back image for KSM
4242
KubeStateMetricsImage = "registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.10.0"
43+
// MysqldExporterImage - default fall-back image for mysqld_exporter
44+
MysqldExporterContainerImage = "quay.io/prometheus/mysqld-exporter:v0.16.0"
4345
)
4446

4547
// CeilometerSpec defines the desired state of Ceilometer
@@ -66,6 +68,9 @@ type CeilometerSpec struct {
6668

6769
// +kubebuilder:validation:Optional
6870
KSMImage string `json:"ksmImage"`
71+
72+
// +kubebuilder:validation:Optional
73+
MysqldExporterImage string `json:"mysqldExporterImage"`
6974
}
7075

7176
// CeilometerSpecCore defines the desired state of Ceilometer. This version is used by the OpenStackControlplane (no image parameters)
@@ -108,6 +113,18 @@ type CeilometerSpecCore struct {
108113
// NetworkAttachmentDefinitions list of network attachment definitions the service pod gets attached to
109114
NetworkAttachmentDefinitions []string `json:"networkAttachmentDefinitions,omitempty"`
110115

116+
// Whether mysqld_exporter should be deployed
117+
// +kubebuilder:validation:optional
118+
MysqldExporterEnabled *bool `json:"mysqldExporterEnabled,omitempty"`
119+
120+
// MysqldExporterDatabaseAccountPrefix - Database account prefix for the mysqld-exporter.
121+
// A mariadbaccount CR named "<mysqldExporterDatabaseAccountPrefix>-<galera CR name>" for each
122+
// galera instance needs to be either created by the user or if it's missing, it'll be
123+
// created by the telemetry-operator automatically.
124+
// +kubebuilder:validation:optional
125+
// +kubebuilder:default=mysqld-exporter
126+
MysqldExporterDatabaseAccountPrefix string `json:"mysqldExporterDatabaseAccountPrefix,omitempty"`
127+
111128
// +kubebuilder:validation:Optional
112129
// +operator-sdk:csv:customresourcedefinitions:type=spec
113130
// TLS - Parameters related to the TLS
@@ -118,6 +135,11 @@ type CeilometerSpecCore struct {
118135
// KSMTLS - Parameters related to the TLS for kube-state-metrics
119136
KSMTLS tls.SimpleService `json:"ksmTls,omitempty"`
120137

138+
// +kubebuilder:validation:Optional
139+
// +operator-sdk:csv:customresourcedefinitions:type=spec
140+
// MysqldExporterTLS - Parameters related to the TLS for mysqld_exporter
141+
MysqldExporterTLS tls.SimpleService `json:"mysqldExporterTLS,omitempty"`
142+
121143
// +kubebuilder:validation:Optional
122144
// NodeSelector to target subset of worker nodes running this service
123145
NodeSelector *map[string]string `json:"nodeSelector,omitempty"`
@@ -145,6 +167,16 @@ type CeilometerStatus struct {
145167
// then the controller has not processed the latest changes injected by
146168
// the openstack-operator in the top-level CR (e.g. the ContainerImage)
147169
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
170+
171+
// ReadyCount of mysqld_exporter instances
172+
MysqldExporterReadyCount int32 `json:"mysqldExporterReadyCount,omitempty"`
173+
174+
// Map of hashes to track e.g. job status
175+
MysqldExporterHash map[string]string `json:"mysqldExporterHash,omitempty"`
176+
177+
// List of galera CRs, which are being exported with mysqld_exporter
178+
// +listType=atomic
179+
MysqldExporterExportedGaleras []string `json:"mysqldExporterExportedGaleras,omitempty"`
148180
}
149181

150182
// KSMStatus defines the observed state of kube-state-metrics
@@ -218,13 +250,14 @@ func (instance Ceilometer) RbacResourceName() string {
218250
func SetupDefaultsCeilometer() {
219251
// Acquire environmental defaults and initialize Telemetry defaults with them
220252
ceilometerDefaults := CeilometerDefaults{
221-
CentralContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_CENTRAL_IMAGE_URL_DEFAULT", CeilometerCentralContainerImage),
222-
SgCoreContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_SGCORE_IMAGE_URL_DEFAULT", CeilometerSgCoreContainerImage),
223-
NotificationContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_NOTIFICATION_IMAGE_URL_DEFAULT", CeilometerNotificationContainerImage),
224-
ComputeContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_COMPUTE_IMAGE_URL_DEFAULT", CeilometerComputeContainerImage),
225-
IpmiContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_IPMI_IMAGE_URL_DEFAULT", CeilometerIpmiContainerImage),
226-
ProxyContainerImageURL: util.GetEnvVar("RELATED_IMAGE_APACHE_IMAGE_URL_DEFAULT", CeilometerProxyContainerImage),
227-
KSMContainerImageURL: util.GetEnvVar("RELATED_IMAGE_KSM_IMAGE_URL_DEFAULT", KubeStateMetricsImage),
253+
CentralContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_CENTRAL_IMAGE_URL_DEFAULT", CeilometerCentralContainerImage),
254+
SgCoreContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_SGCORE_IMAGE_URL_DEFAULT", CeilometerSgCoreContainerImage),
255+
NotificationContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_NOTIFICATION_IMAGE_URL_DEFAULT", CeilometerNotificationContainerImage),
256+
ComputeContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_COMPUTE_IMAGE_URL_DEFAULT", CeilometerComputeContainerImage),
257+
IpmiContainerImageURL: util.GetEnvVar("RELATED_IMAGE_CEILOMETER_IPMI_IMAGE_URL_DEFAULT", CeilometerIpmiContainerImage),
258+
ProxyContainerImageURL: util.GetEnvVar("RELATED_IMAGE_APACHE_IMAGE_URL_DEFAULT", CeilometerProxyContainerImage),
259+
KSMContainerImageURL: util.GetEnvVar("RELATED_IMAGE_KSM_IMAGE_URL_DEFAULT", KubeStateMetricsImage),
260+
MysqldExporterContainerImageURL: util.GetEnvVar("RELATED_IMAGE_MYSQLD_EXPORTER_IMAGE_URL_DEFAULT", MysqldExporterContainerImage),
228261
}
229262

230263
SetupCeilometerDefaults(ceilometerDefaults)

api/v1beta1/ceilometer_webhook.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ import (
2626

2727
// CeilometerDefaults -
2828
type CeilometerDefaults struct {
29-
CentralContainerImageURL string
30-
NotificationContainerImageURL string
31-
SgCoreContainerImageURL string
32-
ComputeContainerImageURL string
33-
IpmiContainerImageURL string
34-
ProxyContainerImageURL string
35-
KSMContainerImageURL string
29+
CentralContainerImageURL string
30+
NotificationContainerImageURL string
31+
SgCoreContainerImageURL string
32+
ComputeContainerImageURL string
33+
IpmiContainerImageURL string
34+
ProxyContainerImageURL string
35+
KSMContainerImageURL string
36+
MysqldExporterContainerImageURL string
3637
}
3738

3839
var ceilometerDefaults CeilometerDefaults
@@ -89,6 +90,9 @@ func (spec *CeilometerSpec) Default() {
8990
if spec.KSMImage == "" {
9091
spec.KSMImage = ceilometerDefaults.KSMContainerImageURL
9192
}
93+
if spec.MysqldExporterImage == "" {
94+
spec.MysqldExporterImage = ceilometerDefaults.MysqldExporterContainerImageURL
95+
}
9296
}
9397

9498
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.

api/v1beta1/conditions.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ const (
5858

5959
// KSMReadyCondition Status=True condition which indicates if the KSM is configured and operational
6060
KSMReadyCondition condition.Type = "KSMReady"
61+
62+
// MysqldExporter conditions
63+
MysqldExporterDBReadyCondition condition.Type = "MysqldExporterDBReady"
64+
65+
MysqldExporterDeploymentReadyCondition condition.Type = "MysqldExporterDeploymentReady"
66+
67+
MysqldExporterMariaDBAccountReadyCondition condition.Type = "MysqldExporterMariaDBAccountReady"
68+
69+
MysqldExporterServiceConfigReadyCondition condition.Type = "MysqldExporterServiceConfigReady"
70+
71+
MysqldExporterTLSInputReadyCondition condition.Type = "MysqldExporterTLSInputReady"
6172
)
6273

6374
// Telemetry Reasons used by API objects.
@@ -207,4 +218,10 @@ const (
207218

208219
// KSMReadyRunningMessage
209220
KSMReadyRunningMessage = "KSM in progress"
221+
222+
//
223+
// mysqld_exporter condition messages
224+
//
225+
// MysqldExporterDisabledMessage
226+
MysqldExporterDisabledMessage = "mysqld_exporter is disabled"
210227
)

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 18 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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,31 @@ spec:
149149
description: SecretName - holding the cert, key for the service
150150
type: string
151151
type: object
152+
mysqldExporterDatabaseAccountPrefix:
153+
default: mysqld-exporter
154+
description: MysqldExporterDatabaseAccountPrefix - Database account
155+
prefix for the mysqld-exporter. A mariadbaccount CR named "<mysqldExporterDatabaseAccountPrefix>-<galera
156+
CR name>" for each galera instance needs to be either created by
157+
the user or if it's missing, it'll be created by the telemetry-operator
158+
automatically.
159+
type: string
160+
mysqldExporterEnabled:
161+
description: Whether mysqld_exporter should be deployed
162+
type: boolean
163+
mysqldExporterImage:
164+
type: string
165+
mysqldExporterTLS:
166+
description: MysqldExporterTLS - Parameters related to the TLS for
167+
mysqld_exporter
168+
properties:
169+
caBundleSecretName:
170+
description: CaBundleSecretName - holding the CA certs in a pre-created
171+
bundle file
172+
type: string
173+
secretName:
174+
description: SecretName - holding the cert, key for the service
175+
type: string
176+
type: object
152177
networkAttachmentDefinitions:
153178
description: NetworkAttachmentDefinitions list of network attachment
154179
definitions the service pod gets attached to
@@ -270,6 +295,21 @@ spec:
270295
type: string
271296
description: Map of hashes to track e.g. job status
272297
type: object
298+
mysqldExporterExportedGaleras:
299+
description: List of galera CRs, which are being exported with mysqld_exporter
300+
items:
301+
type: string
302+
type: array
303+
x-kubernetes-list-type: atomic
304+
mysqldExporterHash:
305+
additionalProperties:
306+
type: string
307+
description: Map of hashes to track e.g. job status
308+
type: object
309+
mysqldExporterReadyCount:
310+
description: ReadyCount of mysqld_exporter instances
311+
format: int32
312+
type: integer
273313
networks:
274314
description: Networks in addtion to the cluster network, the service
275315
is attached to

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,31 @@ spec:
446446
description: SecretName - holding the cert, key for the service
447447
type: string
448448
type: object
449+
mysqldExporterDatabaseAccountPrefix:
450+
default: mysqld-exporter
451+
description: MysqldExporterDatabaseAccountPrefix - Database account
452+
prefix for the mysqld-exporter. A mariadbaccount CR named "<mysqldExporterDatabaseAccountPrefix>-<galera
453+
CR name>" for each galera instance needs to be either created
454+
by the user or if it's missing, it'll be created by the telemetry-operator
455+
automatically.
456+
type: string
457+
mysqldExporterEnabled:
458+
description: Whether mysqld_exporter should be deployed
459+
type: boolean
460+
mysqldExporterImage:
461+
type: string
462+
mysqldExporterTLS:
463+
description: MysqldExporterTLS - Parameters related to the TLS
464+
for mysqld_exporter
465+
properties:
466+
caBundleSecretName:
467+
description: CaBundleSecretName - holding the CA certs in
468+
a pre-created bundle file
469+
type: string
470+
secretName:
471+
description: SecretName - holding the cert, key for the service
472+
type: string
473+
type: object
449474
networkAttachmentDefinitions:
450475
description: NetworkAttachmentDefinitions list of network attachment
451476
definitions the service pod gets attached to

config/rbac/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ rules:
134134
- patch
135135
- update
136136
- watch
137+
- apiGroups:
138+
- mariadb.openstack.org
139+
resources:
140+
- galeras
141+
verbs:
142+
- get
143+
- list
144+
- watch
137145
- apiGroups:
138146
- mariadb.openstack.org
139147
resources:

0 commit comments

Comments
 (0)