From a71d045c666a1f3e0049657126bd8b18a11ef1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=A1gr?= Date: Wed, 10 Apr 2024 14:39:20 +0200 Subject: [PATCH] KSM --- ....openstack.org_openstackcontrolplanes.yaml | 2 ++ .../core.openstack.org_openstackversions.yaml | 6 ++++ apis/core/v1beta1/openstackversion_types.go | 1 + apis/core/v1beta1/zz_generated.deepcopy.go | 5 +++ ....openstack.org_openstackcontrolplanes.yaml | 2 ++ .../core.openstack.org_openstackversions.yaml | 6 ++++ hack/export_related_images.sh | 1 + pkg/openstack/telemetry.go | 34 +++++++++++++++++++ pkg/openstack/version.go | 1 + 9 files changed, 58 insertions(+) diff --git a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml index 1f07ee23b..2a877795a 100644 --- a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -18363,6 +18363,8 @@ spec: type: string keystoneAPIImage: type: string + ksmImage: + type: string manilaAPIImage: type: string manilaSchedulerImage: diff --git a/apis/bases/core.openstack.org_openstackversions.yaml b/apis/bases/core.openstack.org_openstackversions.yaml index 9d3d4ceda..c9a492ddf 100644 --- a/apis/bases/core.openstack.org_openstackversions.yaml +++ b/apis/bases/core.openstack.org_openstackversions.yaml @@ -147,6 +147,8 @@ spec: type: string keystoneAPIImage: type: string + ksmImage: + type: string manilaAPIImage: type: string manilaSchedulerImage: @@ -354,6 +356,8 @@ spec: type: string keystoneAPIImage: type: string + ksmImage: + type: string manilaAPIImage: type: string manilaSchedulerImage: @@ -532,6 +536,8 @@ spec: type: string keystoneAPIImage: type: string + ksmImage: + type: string manilaAPIImage: type: string manilaSchedulerImage: diff --git a/apis/core/v1beta1/openstackversion_types.go b/apis/core/v1beta1/openstackversion_types.go index 0b5b3f460..e0b0842eb 100644 --- a/apis/core/v1beta1/openstackversion_types.go +++ b/apis/core/v1beta1/openstackversion_types.go @@ -126,6 +126,7 @@ type ContainerTemplate struct { IronicPxeImage *string `json:"ironicPxeImage,omitempty"` IronicPythonAgentImage *string `json:"ironicPythonAgentImage,omitempty"` KeystoneAPIImage *string `json:"keystoneAPIImage,omitempty"` + KsmImage *string `json:"ksmImage,omitempty"` ManilaAPIImage *string `json:"manilaAPIImage,omitempty"` ManilaSchedulerImage *string `json:"manilaSchedulerImage,omitempty"` MariadbImage *string `json:"mariadbImage,omitempty"` diff --git a/apis/core/v1beta1/zz_generated.deepcopy.go b/apis/core/v1beta1/zz_generated.deepcopy.go index 8e339bac3..2ed390a77 100644 --- a/apis/core/v1beta1/zz_generated.deepcopy.go +++ b/apis/core/v1beta1/zz_generated.deepcopy.go @@ -508,6 +508,11 @@ func (in *ContainerTemplate) DeepCopyInto(out *ContainerTemplate) { *out = new(string) **out = **in } + if in.KsmImage != nil { + in, out := &in.KsmImage, &out.KsmImage + *out = new(string) + **out = **in + } if in.ManilaAPIImage != nil { in, out := &in.ManilaAPIImage, &out.ManilaAPIImage *out = new(string) diff --git a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml index 1f07ee23b..2a877795a 100644 --- a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -18363,6 +18363,8 @@ spec: type: string keystoneAPIImage: type: string + ksmImage: + type: string manilaAPIImage: type: string manilaSchedulerImage: diff --git a/config/crd/bases/core.openstack.org_openstackversions.yaml b/config/crd/bases/core.openstack.org_openstackversions.yaml index 9d3d4ceda..c9a492ddf 100644 --- a/config/crd/bases/core.openstack.org_openstackversions.yaml +++ b/config/crd/bases/core.openstack.org_openstackversions.yaml @@ -147,6 +147,8 @@ spec: type: string keystoneAPIImage: type: string + ksmImage: + type: string manilaAPIImage: type: string manilaSchedulerImage: @@ -354,6 +356,8 @@ spec: type: string keystoneAPIImage: type: string + ksmImage: + type: string manilaAPIImage: type: string manilaSchedulerImage: @@ -532,6 +536,8 @@ spec: type: string keystoneAPIImage: type: string + ksmImage: + type: string manilaAPIImage: type: string manilaSchedulerImage: diff --git a/hack/export_related_images.sh b/hack/export_related_images.sh index 3f990bd48..3e97fa858 100755 --- a/hack/export_related_images.sh +++ b/hack/export_related_images.sh @@ -35,6 +35,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/infrawatch/sg-core:v5.2.0-nextgen +export RELATED_IMAGE_KSM_IMAGE_URL_DEFAULT=registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.10.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 diff --git a/pkg/openstack/telemetry.go b/pkg/openstack/telemetry.go index b9e08f9d7..94cb2302f 100644 --- a/pkg/openstack/telemetry.go +++ b/pkg/openstack/telemetry.go @@ -80,9 +80,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.KSMTLS = telemetry.Spec.Ceilometer.KSMTLS } 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.KSMTLS.CaBundleSecretName = instance.Status.TLS.CaBundleSecretName instance.Spec.Telemetry.Template.MetricStorage.PrometheusTLS.CaBundleSecretName = instance.Status.TLS.CaBundleSecretName aodhSvcs, err := service.GetServicesListWithLabel( @@ -123,6 +125,15 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont if err != nil { return ctrl.Result{}, err } + ksmSvcs, err := service.GetServicesListWithLabel( + ctx, + helper, + instance.Namespace, + map[string]string{common.AppSelector: "kube-state-metrics"}, + ) + 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) { @@ -231,6 +242,27 @@ 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) + + // NOTE: We don't have svc overrides for KSM objects too. + ksmEpDetails, ctrlResult, err := EnsureEndpointConfig( + ctx, + instance, + helper, + telemetry, + ksmSvcs, + 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.KSMTLS.SecretName = ksmEpDetails.GetEndptCertSecret(service.EndpointInternal) } helper.GetLogger().Info("Reconciling Telemetry", telemetryNamespaceLabel, instance.Namespace, telemetryNameLabel, telemetryName) @@ -251,6 +283,7 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont telemetry.Spec.Ceilometer.NotificationImage = *version.Status.ContainerImages.CeilometerNotificationImage telemetry.Spec.Ceilometer.SgCoreImage = *version.Status.ContainerImages.CeilometerSgcoreImage telemetry.Spec.Ceilometer.ProxyImage = *version.Status.ContainerImages.CeilometerProxyImage + telemetry.Spec.Ceilometer.KSMImage = *version.Status.ContainerImages.KsmImage telemetry.Spec.Autoscaling.AutoscalingSpec.Aodh.APIImage = *version.Status.ContainerImages.AodhAPIImage telemetry.Spec.Autoscaling.AutoscalingSpec.Aodh.EvaluatorImage = *version.Status.ContainerImages.AodhEvaluatorImage telemetry.Spec.Autoscaling.AutoscalingSpec.Aodh.NotifierImage = *version.Status.ContainerImages.AodhNotifierImage @@ -298,6 +331,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.KsmImage = version.Status.ContainerImages.KsmImage instance.Status.ContainerImages.AodhAPIImage = version.Status.ContainerImages.AodhAPIImage instance.Status.ContainerImages.AodhEvaluatorImage = version.Status.ContainerImages.AodhEvaluatorImage instance.Status.ContainerImages.AodhNotifierImage = version.Status.ContainerImages.AodhNotifierImage diff --git a/pkg/openstack/version.go b/pkg/openstack/version.go index 79f6246cb..cacad887d 100644 --- a/pkg/openstack/version.go +++ b/pkg/openstack/version.go @@ -135,6 +135,7 @@ func GetContainerImages(defaults *corev1beta1.ContainerDefaults, instance corev1 IronicPxeImage: getImg(instance.Spec.CustomContainerImages.IronicPxeImage, defaults.IronicPxeImage), IronicPythonAgentImage: getImg(instance.Spec.CustomContainerImages.IronicPythonAgentImage, defaults.IronicPythonAgentImage), KeystoneAPIImage: getImg(instance.Spec.CustomContainerImages.KeystoneAPIImage, defaults.KeystoneAPIImage), + KsmImage: getImg(instance.Spec.CustomContainerImages.KsmImage, defaults.KsmImage), ManilaAPIImage: getImg(instance.Spec.CustomContainerImages.ManilaAPIImage, defaults.ManilaAPIImage), ManilaSchedulerImage: getImg(instance.Spec.CustomContainerImages.ManilaSchedulerImage, defaults.ManilaSchedulerImage), MariadbImage: getImg(instance.Spec.CustomContainerImages.MariadbImage, defaults.MariadbImage),