From 0828f2f6c30b710e80a9a9c349949457ada6e8c2 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 ++++ go.mod | 2 +- go.sum | 2 ++ hack/export_related_images.sh | 1 + pkg/openstack/telemetry.go | 34 +++++++++++++++++++ pkg/openstack/version.go | 1 + 11 files changed, 61 insertions(+), 1 deletion(-) diff --git a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml index fd56ff816..4ebbd80b5 100644 --- a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -18352,6 +18352,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 fd56ff816..4ebbd80b5 100644 --- a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -18352,6 +18352,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/go.mod b/go.mod index 0470c958d..a8bfc83b3 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/openstack-k8s-operators/ovn-operator/api v0.4.1-0.20241007075619-241535441881 github.com/openstack-k8s-operators/placement-operator/api v0.4.1-0.20241007064654-9a07132ad7dd github.com/openstack-k8s-operators/swift-operator/api v0.4.1-0.20240930070251-1f0a2f5e19b0 - github.com/openstack-k8s-operators/telemetry-operator/api v0.4.1-0.20241007090220-a9bf21aa9e25 + github.com/openstack-k8s-operators/telemetry-operator/api v0.4.1-0.20241011103118-cc54e508ef4e github.com/openstack-k8s-operators/test-operator/api v0.0.0-20241007130221-f2ce22b18486 github.com/rabbitmq/cluster-operator/v2 v2.9.0 go.uber.org/zap v1.27.0 diff --git a/go.sum b/go.sum index 51c2d25da..7173d6503 100644 --- a/go.sum +++ b/go.sum @@ -152,6 +152,8 @@ github.com/openstack-k8s-operators/swift-operator/api v0.4.1-0.20240930070251-1f github.com/openstack-k8s-operators/swift-operator/api v0.4.1-0.20240930070251-1f0a2f5e19b0/go.mod h1:vEry4bUk3JoOt31oh/FDAWsP2/oQpuzUdrYkk6Q/qBk= github.com/openstack-k8s-operators/telemetry-operator/api v0.4.1-0.20241007090220-a9bf21aa9e25 h1:gtAmQ/JOi8nynNHsdR/d2SeghtJRlOwR/pSHlqBcA+k= github.com/openstack-k8s-operators/telemetry-operator/api v0.4.1-0.20241007090220-a9bf21aa9e25/go.mod h1:aeqjPtBNs/16t96iTpir4gPpDJ7EBgMENW1/RwGLfzo= +github.com/openstack-k8s-operators/telemetry-operator/api v0.4.1-0.20241011103118-cc54e508ef4e h1:Aivqxn+Qw4m34jQUyndkuCYktz1H1o2xLrWIN7NmKpo= +github.com/openstack-k8s-operators/telemetry-operator/api v0.4.1-0.20241011103118-cc54e508ef4e/go.mod h1:aeqjPtBNs/16t96iTpir4gPpDJ7EBgMENW1/RwGLfzo= github.com/openstack-k8s-operators/test-operator/api v0.0.0-20241007130221-f2ce22b18486 h1:/WURj+cwRq+bAGOIrIFK5BmIWVE1YZohDFF0F0OSAms= github.com/openstack-k8s-operators/test-operator/api v0.0.0-20241007130221-f2ce22b18486/go.mod h1:s1/uB2hSPldPAiTLQ13v/5ZET//E2T/VMvHhrg2bdc4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 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),