# Enhancing Namespace Chargeback Reports with Custom Label-Based Metadata in Rafay

In the world of **FinOps**, precise cost allocation is more than just a “nice to have”, it’s the foundation for accurate chargeback, accountability, and informed decision-making. With Rafay’s latest release, **Chargeback Summary Reports** aggregated by **namespace** now support **custom label-based metadata enrichment**.

This enhancement empowers FinOps teams to add business-relevant metadata (like `team` or `cost_center`) directly into their cost reports making it easier to trace expenses to the right owners and justify resource consumption.

---

## Why This Matters for FinOps

In large, multi-tenant Kubernetes environments, namespaces often represent workloads owned by different teams, applications, or business units. Without enriched metadata, a FinOps practitioner might see “Namespace A” incurring costs, but need extra steps to figure out which **team** or **cost center** is responsible.

Now, you can define **specific label keys** (e.g., `team`, `cost_center`) in the **chargeback report configuration**, and Rafay will automatically include them as **additional columns** in the report—populated with values from the namespace labels. This directly embeds organizational context into your cost visibility.

> **Note:**  
> This enhancement applies to **namespace-based aggregation** in chargeback reports (not namespace-label-based aggregation). This is because if a primary label value (e.g., `cost_center`) is the same across multiple namespaces but secondary label values (e.g., `team`) differ, the report will **not** be able to aggregate on primary labels in such cases.

---

## Implementing This in Rafay

The process is straightforward. Below is an example using **RCTL** (though API interface is also available for automation). We have added labels to both system namespaces and namespaces belonging to application teams to begin with.

### Step 1: Create a Chargeback Group with Additional Labels

```
apiVersion: system.k8smgmt.io/v3
kind: ChargebackGroup
metadata:
  annotations:
    additionalNSLabels: "team,cost-center"
  name: chargeback-demo
spec:
  aggregate:
    namespace: true
  inclusions:
    - project: '*'
  type: summary
```

```
./rctl apply -f chargeback_group.yaml
```

### Step 2: Generate the Chargeback Report

```
apiVersion: system.k8smgmt.io/v3
kind: ChargebackGroupReport
metadata:
  name: chargeback-demo
spec:
  groupName: chargeback-demo
  startDate:
    seconds: 1754438400
  endDate:
    seconds: 1754803200
```

```
./rctl create chargebackgroupreport -f chargeback_report.yaml --download
```

Your generated report will now include two new columns, "team" and "cost_center" with values pulled from namespace labels. This gives FinOps teams instant insight into who is driving costs and where they should be allocated.

---

## Summary

This new capability transforms namespace chargeback into a business-aligned cost reporting system helping FinOps teams:

- Improve cost transparency
- Simplify internal chargeback processes
- Enable better cost optimization conversations with stakeholders

With Rafay, you can align Kubernetes cost reporting directly with your organization’s financial and operational structure so that no manual reconciliation is required.
