Skip to content

Instantly share code, notes, and snippets.

View myersCody's full-sized avatar

Cody Myers myersCody

  • RedHat
  • Durham, NC
View GitHub Profile
import os
import logging
import boto3
from botocore.config import Config
from botocore.exceptions import EndpointConnectionError
from botocore.exceptions import ClientError
LOG = logging.getLogger(__name__)
S3_ACCESS_KEY = os.getenv("AWS_ACCESS_KEY_ID")

What's New?

Koku/Cost Management is now able to better report and distribute OpenShift storage costs, especially when running OpenShift on Azure. Enhancements for AWS, GCP and on-premise will follow.

Customers utilizing the Azure Disk CSI Driver storage class to dynamically provision persistent volumes, in conjunction with the latest release of the cost-management-metrics-operator, will now see improved correlation of Azure disk costs to OpenShift projects within the Azure filtered by OpenShift view. The latest operator enables us to collect the unique identifier for disks created by the CSI driver during the creation of persistent volumes.

For customers not using the latest operator, the previous method of matching persistent volume names to Azure disk resource identifiers will still be in use. However, this method can result in uncorrelated costs. We highly recommend adopting the new approach for optimal cost visibility.

Additionally, we've made significant improvements in assigning Azure disk costs to

Step One: Insert expired data for schema

INSERT INTO reporting_ocpusagelineitem_daily_summary (
    report_period_id,
    cluster_id,
    cluster_alias,
    usage_start,
    usage_end,
    namespace,
    node,
    date    |      pv      |        azure_resource_id        | pv_capacity | disk_capacity | disk_difference |    original_cost     |  unattributed_cost   |   attributed_cost    |      final_cost
------------+--------------+---------------------------------+-------------+---------------+-----------------+----------------------+----------------------+----------------------+----------------------
 2024-05-04 | pvc-volume_2 | azure-cloud-prefix-pvc-volume_2 |        20.0 |           128 |           108.0 |  0.41122313364371627 |   0.3469695190118856 |  0.06425361463183067 |  0.41122313364371627
 2024-05-04 | pvc-volume_1 | pvc-volume_1-azure_cloud_suffix |        20.0 |           128 |           108.0 |  0.10657935678176436 |  0.08992633228461368 |  0.01665302449715068 |  0.10657935678176436
 2024-05-07 | pvc-volume_1 | pvc-volume_1-azure_cloud_suffix |        20.0 |           128 |           108.0 | 0.039920295180440574 |  0.03368274905849673 |  0.00623754612194384 | 0.039920295180440574
 2024-05-03 | pvc-v

The correlation logic between Microsoft Azure cloud integrations and OpenShift clusters has been updated to perform a partial match instead of an exact match. This change accommodates any additional prefixes or suffixes added to the Azure resource identifiers when matching with the names of OpenShift's persistent volumes.

Azure OpenShift
az-123-volume_name1 volume_name1
my-volume-name-OS_disk my-volume-name

What's New?

Our team is introducing a new feature called Tag Mapping that allows you to coalesce similar tag keys. This new addition to our Settings page provides the ability to easily unify your tagging conventions by mapping tags with similar or related meanings, reducing complexity and enhancing consistency across your resources. This functionality offers greater flexibility and control over how you categorize and track your resources, allowing for more accurate reporting and analysis.

For example, imagine you're tracking environment spend across different platforms, each with its own naming variations:

Platform Key Variations
GCP env
OpenShift environment
AWS Environment

What's Changed

Our team discovered a bug regarding Openshift Container Platform (OCP) Integrations. We have been reporting our storage and memory costs as Gigabytes (GB), when the values represented Gibibytes (GiB). These units have now been fixed. After an internal investigation of our other cloud providers and units, we have decided to convert storage cost for Google Cloud Platform Integrations to (GB) to match the other cloud providers.

Details

The GCP storage usage amount will now be multiplied by the conversion rate (1.073741824) and the units have been updated to GB.

GiB Units GB Units
#!/bin/bash
# export AUTH_TOKEN="your-github-token"
REPO_OWNER="project-koku"
REPO_NAME="koku"
RELEASE_HASH="725c0c053eafe7ac36ecb7b73282b9f744eb0957"
BOILERPLATE="This includes bug fixes and performance enhancements. For more detailed information see below"
# Function to fetch commit details
fetch_commit_details() {
@myersCody
myersCody / release_note_template.md
Last active March 13, 2024 04:25
Release Note Template

Whats Changed

This includes bug fixes and performance enhancements. For more detailed information see below

TODO: Summarize the following

The issues below need to be added to the summary above in greater detail.

  1. Summarize the issue and describe what we did
  2. Any impacted urls
  3. Update jiras & PR description with relevant information

Change History

# pip install prettytable
# pip install python-docx
from prettytable import PrettyTable
from docx import Document
from docx.shared import Pt
from docx.enum.table import WD_ALIGN_VERTICAL, WD_ALIGN_VERTICAL
def create_word_document(data):
if not data or not isinstance(data, list) or not isinstance(data[0], dict):
print("Invalid input. Expecting a list of dictionaries.")