Enabling chargeback feature
You can enable the optional features of License Service to get more benefits.
License Service works in the background and does not require any configuration for license compliance. However, you can perform optional configuration to enable additional License Service features and get more benefits. By default, the features are disabled and transparent. To enable these features, edit the IBMLicensing custom resource.
Filtering the license usage data by user-defined groups
The following procedure is dedicated to tracking the license usage of products that are licensed with Virtual Processor Core (VPC) and Processor Value Unit (PVU). For the products that are licensed with other license metrics, check the product documentation to check if filtering by groups is supported and on what conditions.
Complete the following procedures to enable filtering by group.
Define groups
To define groups, add the group labels to your namespaces by completing the following steps:
-
Add labels to a namespace.
-
From the OpenShift console:
-
Log in to your OpenShift cluster console.
-
Go to Administration > Namespaces.
-
Find the namespace that you want to label.
-
Click the overflow action menu next to the namespace name, and select Edit labels.
-
Add the following label to the list:
ibm-chargeback-group=<groupName>
where
groupName
is the name of the group that you will use to filter the data.Important: The name of the group must be other than
default
. This name is reserved for the development use only.
-
-
From the command line:
- Log in to your cluster.
-
Run the following command:
- OpenShift:
oc label namespace <namespaceName> ibm-chargeback-group=<groupName>
- Kubernetes:
kubectl label namespace <namespaceName> ibm-chargeback-group=<groupName>
where
groupName
is the name of the group that you will use to filter the datanamespaceName
is the name of the namespace that you want to add a group name label
- OpenShift:
-
-
Repeat these steps for the remaining namespaces that you want to divide into groups. You can assign more than one namespace to one group.
Enable filtering by group
To enable filtering by group, complete the following steps.
-
Edit the
IBMLicensing
custom resource (CR).-
From the OpenShift console:
- Log in to your OpenShift console.
- Go to Operators > Installed Operators.
- From the Project drop-down list, select All Projects
- Select IBM Licensing Operator.
- Select the IBM License Service tab. The instance of License Service custom resource is listed.
- From the overflow action menu, select Edit IBMLicensing.
-
From the command line:
Run the following command:
- OpenShift:
oc edit IBMLicensing instance -n <your-License-Service-namespace>
- Kubernetes:
kubectl edit IBMLicensing instance -n <your-License-Service-namespace>
- OpenShift:
-
-
Add the following parameters to the
IBMLicensing
section, underspec
:-
To enable filtering by group, add the following line:
chargebackEnabled: true
-
Optional: To set the retention period for which the filtered data is stored, add the following line and specify the number of days for storing the filtered data:
chargebackRetentionPeriod: <number of days>
Specify the
chargebackRetentionPeriod
to define the number of days after which the data is deleted. If you do not addchargebackRetentionPeriod
to the custom resource, the retention period is set to 62 days.
-
-
Save or apply the changes to the CR.
Retention period
Storing information about license usage of the products that are installed on the namespaces that belong to the groups requires more memory. Because of that, the filtered data can only be stored for a limited time. By default, the chargebackRetentionPeriod
is set to 62 days. In case of issues with retrieving the filtered data, decrease the retention period to avoid overflow.
Note: Remember to regularly generate audit snapshot to preserve all the data required for compliance purposes. Generate audit snapshot at least once during the span of retention period.
To estimate the retention period that best suits your environment consider the number of products that are deployed in the namespace, and the number of groups that you define.
Given that the maximal accepted size of the storage is 1 MiB, which equals 1048576 bytes, you can use the following formula to estimate the maximal retention period for your environment:
1048576 / (number of products * number of groups * 11.85)
The outcome is the number of days to which you should set the retention period for the specified number of products and groups.
The following table shows the estimated retention period for different number of products and groups expressed in the number of days:
Environment | Small | Medium | Large |
---|---|---|---|
Products | up to 50 | 50-75 | more than 75 |
Suggested retention period | 1 quarter (90 days) | 2 months (60 days) | 1 month (30 days) |
Example scenario
You can use chargeback to track license usage for your products in different divisions in your organization. First, think about how many groups you can distinguish, and gather information about which namespaces these groups use.
In this example, the organization needs to define two groups HR
and Procurement
. The organization follows the procedure and defines the groups by adding the labels to appropriate namespaces, and then enables filtering by
group. As the organization defines only 2 groups that use only one product, the chargeback retention period is set to 90 days as recommended for small environments.
The Cluster Administrator edited the IBMLicensing
CR by adding the following lines under the .spec
section:
chargebackEnabled: true
chargebackRetentionPeriod: 90