Skip to content

Commit

Permalink
Merge pull request #1236 from vyzigold/add_mysqld_exporter
Browse files Browse the repository at this point in the history
[OSPRH-12079] Add mysqld exporter
  • Loading branch information
openshift-merge-bot[bot] authored Jan 7, 2025
2 parents cb18787 + bb1bbc4 commit caa23e7
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apis/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16750,6 +16750,8 @@ spec:
type: string
ceilometerIpmiImage:
type: string
ceilometerMysqldExporterImage:
type: string
ceilometerNotificationImage:
type: string
ceilometerProxyImage:
Expand Down
6 changes: 6 additions & 0 deletions apis/bases/core.openstack.org_openstackversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ spec:
type: string
ceilometerIpmiImage:
type: string
ceilometerMysqldExporterImage:
type: string
ceilometerNotificationImage:
type: string
ceilometerSgcoreImage:
Expand Down Expand Up @@ -271,6 +273,8 @@ spec:
type: string
ceilometerIpmiImage:
type: string
ceilometerMysqldExporterImage:
type: string
ceilometerNotificationImage:
type: string
ceilometerSgcoreImage:
Expand Down Expand Up @@ -443,6 +447,8 @@ spec:
type: string
ceilometerIpmiImage:
type: string
ceilometerMysqldExporterImage:
type: string
ceilometerNotificationImage:
type: string
ceilometerProxyImage:
Expand Down
1 change: 1 addition & 0 deletions apis/core/v1beta1/openstackversion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ type ContainerTemplate struct {
CeilometerIpmiImage *string `json:"ceilometerIpmiImage,omitempty"`
CeilometerNotificationImage *string `json:"ceilometerNotificationImage,omitempty"`
CeilometerSgcoreImage *string `json:"ceilometerSgcoreImage,omitempty"`
CeilometerMysqldExporterImage *string `json:"ceilometerMysqldExporterImage,omitempty"`
CinderAPIImage *string `json:"cinderAPIImage,omitempty"`
CinderBackupImage *string `json:"cinderBackupImage,omitempty"`
CinderSchedulerImage *string `json:"cinderSchedulerImage,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions apis/core/v1beta1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -16750,6 +16750,8 @@ spec:
type: string
ceilometerIpmiImage:
type: string
ceilometerMysqldExporterImage:
type: string
ceilometerNotificationImage:
type: string
ceilometerProxyImage:
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/core.openstack.org_openstackversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ spec:
type: string
ceilometerIpmiImage:
type: string
ceilometerMysqldExporterImage:
type: string
ceilometerNotificationImage:
type: string
ceilometerSgcoreImage:
Expand Down Expand Up @@ -271,6 +273,8 @@ spec:
type: string
ceilometerIpmiImage:
type: string
ceilometerMysqldExporterImage:
type: string
ceilometerNotificationImage:
type: string
ceilometerSgcoreImage:
Expand Down Expand Up @@ -443,6 +447,8 @@ spec:
type: string
ceilometerIpmiImage:
type: string
ceilometerMysqldExporterImage:
type: string
ceilometerNotificationImage:
type: string
ceilometerProxyImage:
Expand Down
2 changes: 2 additions & 0 deletions config/default/manager_default_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ spec:
value: quay.io/podified-antelope-centos9/openstack-ceilometer-ipmi:current-podified
- name: RELATED_IMAGE_CEILOMETER_NOTIFICATION_IMAGE_URL_DEFAULT
value: quay.io/podified-antelope-centos9/openstack-ceilometer-notification:current-podified
- name: RELATED_IMAGE_CEILOMETER_MYSQLD_EXPORTER_IMAGE_URL_DEFAULT
value: quay.io/prometheus/mysqld-exporter:v0.16.0
- name: RELATED_IMAGE_CEILOMETER_SGCORE_IMAGE_URL_DEFAULT
value: quay.io/openstack-k8s-operators/sg-core:v6.0.0
- name: RELATED_IMAGE_CINDER_API_IMAGE_URL_DEFAULT
Expand Down
1 change: 1 addition & 0 deletions hack/export_related_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export RELATED_IMAGE_CEILOMETER_COMPUTE_IMAGE_URL_DEFAULT=quay.io/podified-antel
export RELATED_IMAGE_CEILOMETER_NOTIFICATION_IMAGE_URL_DEFAULT=quay.io/podified-antelope-centos9/openstack-ceilometer-notification:current-podified
export RELATED_IMAGE_CEILOMETER_IPMI_IMAGE_URL_DEFAULT=quay.io/podified-antelope-centos9/openstack-ceilometer-ipmi:current-podified
export RELATED_IMAGE_CEILOMETER_SGCORE_IMAGE_URL_DEFAULT=quay.io/openstack-k8s-operators/sg-core:v6.0.0
export RELATED_IMAGE_CEILOMETER_MYSQLD_EXPORTER_IMAGE_URL_DEFAULT=quay.io/prometheus/mysqld-exporter:v0.16.0
export RELATED_IMAGE_AODH_API_IMAGE_URL_DEFAULT=quay.io/podified-antelope-centos9/openstack-aodh-api:current-podified
export RELATED_IMAGE_AODH_EVALUATOR_IMAGE_URL_DEFAULT=quay.io/podified-antelope-centos9/openstack-aodh-evaluator:current-podified
export RELATED_IMAGE_AODH_NOTIFIER_IMAGE_URL_DEFAULT=quay.io/podified-antelope-centos9/openstack-aodh-notifier:current-podified
Expand Down
45 changes: 45 additions & 0 deletions pkg/openstack/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont
instance.Status.ContainerImages.CeilometerNotificationImage = nil
instance.Status.ContainerImages.CeilometerSgcoreImage = nil
instance.Status.ContainerImages.CeilometerProxyImage = nil
instance.Status.ContainerImages.CeilometerMysqldExporterImage = nil
instance.Status.ContainerImages.AodhAPIImage = nil
instance.Status.ContainerImages.AodhEvaluatorImage = nil
instance.Status.ContainerImages.AodhNotifierImage = nil
Expand Down Expand Up @@ -84,9 +85,11 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont
instance.Spec.Telemetry.Template.Autoscaling.Aodh.TLS = telemetry.Spec.Autoscaling.Aodh.TLS
instance.Spec.Telemetry.Template.MetricStorage.PrometheusTLS = telemetry.Spec.MetricStorage.PrometheusTLS
instance.Spec.Telemetry.Template.Ceilometer.TLS = telemetry.Spec.Ceilometer.TLS
instance.Spec.Telemetry.Template.Ceilometer.MysqldExporterTLS = telemetry.Spec.Ceilometer.MysqldExporterTLS
}
instance.Spec.Telemetry.Template.Autoscaling.Aodh.TLS.CaBundleSecretName = instance.Status.TLS.CaBundleSecretName
instance.Spec.Telemetry.Template.Ceilometer.TLS.CaBundleSecretName = instance.Status.TLS.CaBundleSecretName
instance.Spec.Telemetry.Template.Ceilometer.MysqldExporterTLS.CaBundleSecretName = instance.Status.TLS.CaBundleSecretName
instance.Spec.Telemetry.Template.MetricStorage.PrometheusTLS.CaBundleSecretName = instance.Status.TLS.CaBundleSecretName

aodhSvcs, err := service.GetServicesListWithLabel(
Expand Down Expand Up @@ -128,6 +131,16 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont
return ctrl.Result{}, err
}

mysqldExporterSvcs, err := service.GetServicesListWithLabel(
ctx,
helper,
instance.Namespace,
map[string]string{common.AppSelector: "mysqld-exporter"},
)
if err != nil {
return ctrl.Result{}, err
}

// make sure to get to EndpointConfig when all service got created
if len(aodhSvcs.Items) == len(instance.Spec.Telemetry.Template.Autoscaling.Aodh.Override.Service) {
endpointDetails, ctrlResult, err := EnsureEndpointConfig(
Expand Down Expand Up @@ -216,6 +229,7 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont

if telemetry.Status.Conditions.IsTrue(telemetryv1.CeilometerReadyCondition) {
// NOTE: We don't have svc overrides for ceilometer objects.
// Ceilometer
endpointDetails, ctrlResult, err := EnsureEndpointConfig(
ctx,
instance,
Expand All @@ -235,6 +249,29 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont
}
// update TLS settings with cert secret
instance.Spec.Telemetry.Template.Ceilometer.TLS.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointInternal)

// MysqldExporter
if telemetry.Spec.Ceilometer.MysqldExporterEnabled != nil && *telemetry.Spec.Ceilometer.MysqldExporterEnabled {
endpointDetails, ctrlResult, err := EnsureEndpointConfig(
ctx,
instance,
helper,
telemetry,
mysqldExporterSvcs,
nil,
corev1beta1.Override{},
corev1beta1.OpenStackControlPlaneExposeTelemetryReadyCondition,
false, // TODO (mschuppert) could be removed when all integrated service support TLS
tls.API{},
)
if err != nil {
return ctrlResult, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}
// update TLS settings with cert secret
instance.Spec.Telemetry.Template.Ceilometer.MysqldExporterTLS.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointInternal)
}
}

helper.GetLogger().Info("Reconciling Telemetry", telemetryNamespaceLabel, instance.Namespace, telemetryNameLabel, telemetryName)
Expand All @@ -260,6 +297,12 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont
telemetry.Spec.Autoscaling.AutoscalingSpec.Aodh.NotifierImage = *version.Status.ContainerImages.AodhNotifierImage
telemetry.Spec.Autoscaling.AutoscalingSpec.Aodh.ListenerImage = *version.Status.ContainerImages.AodhListenerImage

if version.Status.ContainerImages.CeilometerMysqldExporterImage != nil {
telemetry.Spec.Ceilometer.MysqldExporterImage = *version.Status.ContainerImages.CeilometerMysqldExporterImage
} else {
telemetry.Spec.Ceilometer.MysqldExporterImage = ""
}

if telemetry.Spec.Ceilometer.Secret == "" {
telemetry.Spec.Ceilometer.Secret = instance.Spec.Secret
}
Expand Down Expand Up @@ -302,6 +345,7 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont
instance.Status.ContainerImages.CeilometerNotificationImage = version.Status.ContainerImages.CeilometerNotificationImage
instance.Status.ContainerImages.CeilometerSgcoreImage = version.Status.ContainerImages.CeilometerSgcoreImage
instance.Status.ContainerImages.CeilometerProxyImage = version.Status.ContainerImages.CeilometerProxyImage
instance.Status.ContainerImages.CeilometerMysqldExporterImage = version.Status.ContainerImages.CeilometerMysqldExporterImage
instance.Status.ContainerImages.AodhAPIImage = version.Status.ContainerImages.AodhAPIImage
instance.Status.ContainerImages.AodhEvaluatorImage = version.Status.ContainerImages.AodhEvaluatorImage
instance.Status.ContainerImages.AodhNotifierImage = version.Status.ContainerImages.AodhNotifierImage
Expand All @@ -328,6 +372,7 @@ func TelemetryImageMatch(ctx context.Context, controlPlane *corev1beta1.OpenStac
!stringPointersEqual(controlPlane.Status.ContainerImages.CeilometerNotificationImage, version.Status.ContainerImages.CeilometerNotificationImage) ||
!stringPointersEqual(controlPlane.Status.ContainerImages.CeilometerSgcoreImage, version.Status.ContainerImages.CeilometerSgcoreImage) ||
!stringPointersEqual(controlPlane.Status.ContainerImages.CeilometerProxyImage, version.Status.ContainerImages.CeilometerProxyImage) ||
!stringPointersEqual(controlPlane.Status.ContainerImages.CeilometerMysqldExporterImage, version.Status.ContainerImages.CeilometerMysqldExporterImage) ||
!stringPointersEqual(controlPlane.Status.ContainerImages.AodhAPIImage, version.Status.ContainerImages.AodhAPIImage) ||
!stringPointersEqual(controlPlane.Status.ContainerImages.AodhEvaluatorImage, version.Status.ContainerImages.AodhEvaluatorImage) ||
!stringPointersEqual(controlPlane.Status.ContainerImages.AodhNotifierImage, version.Status.ContainerImages.AodhNotifierImage) ||
Expand Down
1 change: 1 addition & 0 deletions pkg/openstack/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func GetContainerImages(defaults *corev1beta1.ContainerDefaults, instance corev1
CeilometerIpmiImage: getImg(instance.Spec.CustomContainerImages.CeilometerIpmiImage, defaults.CeilometerIpmiImage),
CeilometerNotificationImage: getImg(instance.Spec.CustomContainerImages.CeilometerNotificationImage, defaults.CeilometerNotificationImage),
CeilometerSgcoreImage: getImg(instance.Spec.CustomContainerImages.CeilometerSgcoreImage, defaults.CeilometerSgcoreImage),
CeilometerMysqldExporterImage: getImg(instance.Spec.CustomContainerImages.CeilometerMysqldExporterImage, defaults.CeilometerMysqldExporterImage),
CinderAPIImage: getImg(instance.Spec.CustomContainerImages.CinderAPIImage, defaults.CinderAPIImage),
CinderBackupImage: getImg(instance.Spec.CustomContainerImages.CinderBackupImage, defaults.CinderBackupImage),
CinderSchedulerImage: getImg(instance.Spec.CustomContainerImages.CinderSchedulerImage, defaults.CinderSchedulerImage),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ var _ = Describe("OpenStackOperator controller", func() {
g.Expect(version.Status.ContainerImages.CeilometerNotificationImage).ShouldNot(BeNil())
g.Expect(version.Status.ContainerImages.CeilometerSgcoreImage).ShouldNot(BeNil())
g.Expect(version.Status.ContainerImages.CeilometerProxyImage).ShouldNot(BeNil())
g.Expect(version.Status.ContainerImages.CeilometerMysqldExporterImage).ShouldNot(BeNil())
g.Expect(version.Status.ContainerImages.CinderAPIImage).ShouldNot(BeNil())
g.Expect(version.Status.ContainerImages.CinderBackupImage).ShouldNot(BeNil())
g.Expect(version.Status.ContainerImages.CinderSchedulerImage).ShouldNot(BeNil())
Expand Down

0 comments on commit caa23e7

Please sign in to comment.