To store your data in Google Cloud Storage you must use an existing bucket. Edit the spec.storage
section in the example gcs-storage.yaml
file below.
apiVersion: metering.openshift.io/v1
kind: MeteringConfig
metadata:
name: "operator-metering"
spec:
storage:
type: "hive"
hive:
type: "gcs"
gcs:
bucket: "metering-gcs/test1" (1)
secretName: "my-gcs-secret" (2)
-
Specify the name of the bucket. You can optionally specify the directory within the bucket where you would like to store your data.
-
Specify a secret in the metering namespace. Use the example that follows for more details.
Use the example secret below as a template:
apiVersion: v1
kind: Secret
metadata:
name: your-gcs-secret
data:
gcs-service-account.json: "c2VjcmV0Cg=="
You can use the following command to create the secret.
oc create secret -n openshift-metering generic your-gcs-secret --from-file gcs-service-account.json=/path/to/your/service-account-key.json