Storage locations

Metering is a deprecated feature. Deprecated functionality is still included in OKD and continues to be supported; however, it will be removed in a future release of this product and is not recommended for new deployments.

For the most recent list of major functionality that has been deprecated or removed within OKD, refer to the Deprecated and removed features section of the OKD release notes.

A StorageLocation custom resource configures where data will be stored by the Reporting Operator. This includes the data collected from Prometheus, and the results produced by generating a Report custom resource.

You only need to configure a StorageLocation custom resource if you want to store data in multiple locations, like multiple S3 buckets or both S3 and HDFS, or if you wish to access a database in Hive and Presto that was not created by metering. For most users this is not a requirement, and the documentation on configuring metering is sufficient to configure all necessary storage components.

Storage location examples

The following example shows the built-in local storage option, and is configured to use Hive. By default, data is stored wherever Hive is configured to use storage, such as HDFS, S3, or a ReadWriteMany persistent volume claim (PVC).

Local storage example

  1. apiVersion: metering.openshift.io/v1
  2. kind: StorageLocation
  3. metadata:
  4. name: hive
  5. labels:
  6. operator-metering: "true"
  7. spec:
  8. hive: (1)
  9. databaseName: metering (2)
  10. unmanagedDatabase: false (3)
1If the hive section is present, then the StorageLocation resource will be configured to store data in Presto by creating the table using the Hive server. Only databaseName and unmanagedDatabase are required fields.
2The name of the database within hive.
3If true, the StorageLocation resource will not be actively managed, and the databaseName is expected to already exist in Hive. If false, the Reporting Operator will create the database in Hive.

The following example uses an AWS S3 bucket for storage. The prefix is appended to the bucket name when constructing the path to use.

Remote storage example

  1. apiVersion: metering.openshift.io/v1
  2. kind: StorageLocation
  3. metadata:
  4. name: example-s3-storage
  5. labels:
  6. operator-metering: "true"
  7. spec:
  8. hive:
  9. databaseName: example_s3_storage
  10. unmanagedDatabase: false
  11. location: "s3a://bucket-name/path/within/bucket" (1)
1Optional: The filesystem URL for Presto and Hive to use for the database. This can be an hdfs:// or s3a:// filesystem URL.

There are additional optional fields that can be specified in the hive section:

Default storage location

If an annotation storagelocation.metering.openshift.io/is-default exists and is set to true on a StorageLocation resource, then that resource becomes the default storage resource. Any components with a storage configuration option where the storage location is not specified will use the default storage resource. There can be only one default storage resource. If more than one resource with the annotation exists, an error is logged because the Reporting Operator cannot determine the default.

Default storage example

  1. apiVersion: metering.openshift.io/v1
  2. kind: StorageLocation
  3. metadata:
  4. name: example-s3-storage
  5. labels:
  6. operator-metering: "true"
  7. annotations:
  8. storagelocation.metering.openshift.io/is-default: "true"
  9. spec:
  10. hive:
  11. databaseName: example_s3_storage
  12. unmanagedDatabase: false
  13. location: "s3a://bucket-name/path/within/bucket"