From 7097782c565bd2dabba12717e17a8f61a1b8c2c6 Mon Sep 17 00:00:00 2001 From: Yadnesh Kulkarni Date: Mon, 21 Oct 2024 05:28:08 -0400 Subject: [PATCH] Create new secret to store ipmi configuration files Currently, ipmi agent uses compute agent's secret to load config files during deployment but ipmi agent only requires "hardware" pollster to be enabled to report metrics. As compute and ipmi agents are deployed by different roles, segregating their config files into different secrets makes sense. Similarly, on the compute nodes [1] takes care of storing config files into different directories. [1] openstack-k8s-operators/edpm-ansible#793 --- controllers/ceilometer_controller.go | 24 ++++++++- pkg/ceilometer/const.go | 2 + templates/ceilometeripmi/bin/.keep | 0 .../config/ceilometer-agent-ipmi.json | 0 .../ceilometeripmi/config/ceilometer.conf | 49 +++++++++++++++++++ .../config/ceilometer_agent_ipmi.json | 0 templates/ceilometeripmi/config/polling.yaml | 6 +++ 7 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 templates/ceilometeripmi/bin/.keep rename templates/{ceilometercompute => ceilometeripmi}/config/ceilometer-agent-ipmi.json (100%) create mode 100644 templates/ceilometeripmi/config/ceilometer.conf rename templates/{ceilometercompute => ceilometeripmi}/config/ceilometer_agent_ipmi.json (100%) create mode 100644 templates/ceilometeripmi/config/polling.yaml diff --git a/controllers/ceilometer_controller.go b/controllers/ceilometer_controller.go index 6e389ae2..46cc5b18 100644 --- a/controllers/ceilometer_controller.go +++ b/controllers/ceilometer_controller.go @@ -888,6 +888,7 @@ func (r *CeilometerReconciler) generateComputeServiceConfig( envVars *map[string]env.Setter, ) error { cmLabels := labels.GetLabels(instance, labels.GetGroupLabel(ceilometer.ComputeServiceName), map[string]string{}) + ipmiLabels := labels.GetLabels(instance, labels.GetGroupLabel(ceilometer.IpmiServiceName), map[string]string{}) customData := map[string]string{common.CustomServiceConfigFileName: instance.Spec.CustomServiceConfig} for key, data := range instance.Spec.DefaultConfigOverwrite { customData[key] = data @@ -922,7 +923,7 @@ func (r *CeilometerReconciler) generateComputeServiceConfig( } cms := []util.Template{ - // ScriptsConfigMap + // CeilometerCompute ScriptsConfigMap { Name: fmt.Sprintf("%s-scripts", ceilometer.ComputeServiceName), Namespace: instance.Namespace, @@ -931,7 +932,7 @@ func (r *CeilometerReconciler) generateComputeServiceConfig( AdditionalTemplate: map[string]string{"common.sh": "/common/common.sh"}, Labels: cmLabels, }, - // ConfigMap + // CeilometerCompute ConfigMap { Name: fmt.Sprintf("%s-config-data", ceilometer.ComputeServiceName), Namespace: instance.Namespace, @@ -941,6 +942,25 @@ func (r *CeilometerReconciler) generateComputeServiceConfig( ConfigOptions: templateParameters, Labels: cmLabels, }, + // CeilometerIpmi ScriptsConfigMap + { + Name: fmt.Sprintf("%s-scripts", ceilometer.IpmiServiceName), + Namespace: instance.Namespace, + Type: util.TemplateTypeScripts, + InstanceType: "ceilometeripmi", + AdditionalTemplate: map[string]string{"common.sh": "/common/common.sh"}, + Labels: ipmiLabels, + }, + // CeilometerIpmi ConfigMap + { + Name: fmt.Sprintf("%s-config-data", ceilometer.IpmiServiceName), + Namespace: instance.Namespace, + Type: util.TemplateTypeConfig, + InstanceType: "ceilometeripmi", + CustomData: customData, + ConfigOptions: templateParameters, + Labels: ipmiLabels, + }, } return secret.EnsureSecrets(ctx, h, instance, cms, envVars) } diff --git a/pkg/ceilometer/const.go b/pkg/ceilometer/const.go index 917b6f34..87c1ec91 100644 --- a/pkg/ceilometer/const.go +++ b/pkg/ceilometer/const.go @@ -20,6 +20,8 @@ const ( ServiceName = "ceilometer" // ComputeServiceName - ComputeServiceName = "ceilometer-compute" + // IpmiServiceName - + IpmiServiceName = "ceilometer-ipmi" // ServiceType - ServiceType = "Ceilometer" diff --git a/templates/ceilometeripmi/bin/.keep b/templates/ceilometeripmi/bin/.keep new file mode 100644 index 00000000..e69de29b diff --git a/templates/ceilometercompute/config/ceilometer-agent-ipmi.json b/templates/ceilometeripmi/config/ceilometer-agent-ipmi.json similarity index 100% rename from templates/ceilometercompute/config/ceilometer-agent-ipmi.json rename to templates/ceilometeripmi/config/ceilometer-agent-ipmi.json diff --git a/templates/ceilometeripmi/config/ceilometer.conf b/templates/ceilometeripmi/config/ceilometer.conf new file mode 100644 index 00000000..e9859e77 --- /dev/null +++ b/templates/ceilometeripmi/config/ceilometer.conf @@ -0,0 +1,49 @@ +[DEFAULT] +tenant_name_discovery=False +debug=True +log_dir=/var/log/ceilometer +rpc_response_timeout=60 +polling_namespaces=ipmi +transport_url={{ .TransportURL }} + +[service_credentials] +auth_type=password +auth_url={{ .KeystoneInternalURL }} +project_name=service +project_domain_name=Default +username=ceilometer +user_domain_name=Default +password={{ .CeilometerPassword }} +interface = internalURL + +[coordination] +backend_url= + +[oslo_messaging_amqp] +rpc_address_prefix= +notify_address_prefix= + +[oslo_messaging_notifications] +driver=messagingv2 +topics=notifications +transport_url={{ .TransportURL }} + +[publisher] +telemetry_secret=eQ5qb0yysfJ8lx82Vl061vSyY + +[cache] +[event] +[ipmi] +[meter] +[monasca] +[notification] +[oslo_concurrency] +[oslo_messaging_kafka] +[oslo_messaging_rabbit] +[oslo_reports] +[polling] +[publisher_notifier] +[rgw_admin_credentials] +[rgw_client] +[service_types] +[vmware] diff --git a/templates/ceilometercompute/config/ceilometer_agent_ipmi.json b/templates/ceilometeripmi/config/ceilometer_agent_ipmi.json similarity index 100% rename from templates/ceilometercompute/config/ceilometer_agent_ipmi.json rename to templates/ceilometeripmi/config/ceilometer_agent_ipmi.json diff --git a/templates/ceilometeripmi/config/polling.yaml b/templates/ceilometeripmi/config/polling.yaml new file mode 100644 index 00000000..9f37bbf7 --- /dev/null +++ b/templates/ceilometeripmi/config/polling.yaml @@ -0,0 +1,6 @@ +--- +sources: + - name: pollsters + interval: 120 + meters: + - hardware.*