Chapter 2. View optimization data on Red Hat Developer Hub
For organizations that want to isolate developers from the Red Hat Hybrid Cloud Console, cost management cost and resource optimization information is available through a plug-in on Red Hat Developer Hub.
The cost management plug-in for Red Hat Developer Hub displays OpenShift cost and optimization information and can be combined with the orchestrator plug-in, which you can use to define workflows using YAML files. This combination provides your organization with the ability to define a no-code workflow. The orchestrator can automatically apply a new recommendation or trigger actions such as sending an email, creating a Service Now or Jira ticket, or automatically applying the recommendation to the live cluster without restarting the workload. Developers are responsible for configuring how the optimizations interact with the orchestrator by defining the orchestrator workflows, which are constantly running and listening for events.
The cost management information, including the optimization data, is accessible within Developer Hub and can be exported as CSV or JSON files. The same cost management API is available through the Developer Hub plugin, allowing for automated actions beyond optimizations, such as monitoring project costs and taking action such as shutting down a project or sending a warning if a budget is exceeded.
2.1. Configure resource optimization for OpenShift on Red Hat Developer Hub Copy linkLink copied to clipboard!
Configure the Red Hat Developer Hub dynamic plug-in for Red Hat Lightspeed cost management to view automated OpenShift resource optimization recommendations.
Prerequisites
- Red Hat Developer Hub is installed and configured.
- The Red Hat Developer Hub orchestrator plug-in is installed. See the Installing Red Hat Developer Hub with Orchestrator by using the Red Hat Developer Hub Operator section of Orchestrator in Red Hat Developer Hub for more information.
- An OpenShift cluster is configured for Red Hat Developer Hub and Red Hat Lightspeed cost management.
- A Red Hat service account is configured with the Cost OpenShift Viewer role, to view both OpenShift cost data and optimization recommendations within the plugin. See the "Configuring service account authentication for the cost management metrics operator" section in Integrating OpenShift Container Platform data into cost management for information about service accounts in cost management.
Procedure
- In the Red Hat Hybrid Cloud Console, navigate to the Service Accounts page.
- Copy and save the values of the CLIENT_ID and CLIENT_SECRET from service account with Cost OpenShift Viewer role.
- In your OpenShift cluster console, navigate to WorkLoads > ConfigMaps.
-
Select the
dynamic-plugins-rhdhconfiguration map. -
Select the
secrets-rhdhconfiguration map. - Click the YAML tab.
Add the following lines:
CM_CLIENT_ID: # <CM_CLIENT_ID> CM_CLIENT_SECRET: # <CM_CLIENT_SECRET>where:
<CM_CLIENT_ID>- Specifies the value of the client ID of the service account with the Cost OpenShift Viewer role that you copied previously.
<CM_CLIENT_SECRET>- Specifies the value of the client secret of the service account with Cost OpenShift Viewer role that you copied previously.
-
Select the
dynamic-plugins-rhdhconfiguration map. - Click the YAML tab.
Paste the following packages in the YAML file:
- package: oci://quay.io/redhat-resource-optimization/dynamic-plugins:2.2.0!red-hat-developer-hub-plugin-cost-management disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.plugin-cost-management: appIcons: - name: costManagementIcon importName: CostManagementIconOutlined dynamicRoutes: - path: /cost-management/optimizations importName: ResourceOptimizationPage menuItem: icon: costManagementIcon text: Optimizations - path: /cost-management/openshift importName: OpenShiftPage menuItem: icon: costManagementIcon text: OpenShift menuItems: cost-management: icon: costManagementIcon title: Cost management priority: 100 cost-management.optimizations: parent: cost-management priority: 10 cost-management.openshift: parent: cost-management priority: 20 - package: oci://quay.io/redhat-resource-optimization/dynamic-plugins:2.2.0!red-hat-developer-hub-plugin-cost-management-backend disabled: false pluginConfig: costManagement: clientId: $<CM_CLIENT_ID> clientSecret: $<CM_CLIENT_SECRET> optimizationWorkflowId: 'patch-k8s-resource'-
Replace
<CM_CLIENT_ID>and<CM_CLIENT_SECRET>with the values of the service account that has the Cost OpenShift Viewer role, that you copied previously.
2.2. View resource optimization data in Red Hat Developer Hub Copy linkLink copied to clipboard!
View current OpenShift resource usage and recommendations for improvement in Red Hat Developer Hub to optimize costs and performance.
Prerequisites
- You are logged in to Red Hat Developer Hub.
- Cost management has received at least 24 hours of data from the operator.
Procedure
- In Red Hat Developer Hub, navigate to Cost Management > Optimizations. The Resource Optimization page lists your OpenShift containers.
Optional: Filter your container list or search for a specific container:
- Enter a value in one or more of the boxes under Filters and press Enter. You can filter by clusters, projects, workloads, and types.
- Enter a partial or full container name in the Search container name box.
- To view optimization recommendations, click a container name link. The container page opens with details about the container you selected, current and recommended configurations, and CPU and memory use.
- Select a time range from the Time menu. Resource optimization analyzes your resource use over this time range.
Review your current configuration and recommended configuration data on the Cost optimizations and Performance optimizations tabs.
When you optimize for cost, you allocate enough resources for the workload to run but with less margin for sudden spikes. Use this when your application has a stable performance or load profile.
When you optimize for performance, even small spikes recorded in the specified time frame are considered and resources are allocated to accommodatethem. Use performance recommendations when you want to avoid bottlenecks, even at the expense of running into more cost.
Next steps
To understand optimization recommendations, see Chapter 5, Resource optimization current and recommended configurations.