Skip to content

Instantly share code, notes, and snippets.

@bentito
Last active July 28, 2020 10:59
Show Gist options
  • Save bentito/67e6128f6488949c1bc90b032afbfedd to your computer and use it in GitHub Desktop.
Save bentito/67e6128f6488949c1bc90b032afbfedd to your computer and use it in GitHub Desktop.
Identify minimal setup for using Metering with CRC (mostly complete)
Identify minimal setup for using Metering completely with CRC
crc version
crc version: 1.11.0+883ca49
OpenShift version: 4.4.5 (embedded in binary)
No-fuss CR file that works with CRC for installing Metering
cat $METERING_CR_FILE
apiVersion: metering.openshift.io/v1
kind: MeteringConfig
metadata:
name: "operator-metering"
annotations:
"ansible.operator-sdk/verbosity": "1"
spec:
storage:
type: "hive"
hive:
type: "sharedPVC"
sharedPVC:
createPVC: true
storageClass: " "
size: 25Gi
initial list of disabled operators:
oc get clusterversion version -ojsonpath='{range .spec.overrides[*]}{.name}{"\n"}{end}' | nl -v 0
0 cluster-monitoring-operator
1 machine-config-operator
2 etcd-quorum-guard
3 machine-api-operator
4 cluster-autoscaler-operator
5 insights-operator
6 prometheus-k8s
7 cloud-credential-operator
8 csi-snapshot-controller-operator
9 cluster-storage-operator
10 kube-storage-version-migrator-operator
@bentito
Copy link
Author

bentito commented Jun 5, 2020

After turning on prometheus-k8s, cluster-monitoring-operator, cluster-storage-operator I see:

oc get reportdatasources
NAME                                         EARLIEST METRIC        NEWEST METRIC          IMPORT START           IMPORT END             LAST IMPORT TIME       AGE
cluster-cpu-capacity-raw                                                                                                                                        21h
cluster-cpu-usage-raw                                                                                                                                           21h
cluster-memory-capacity-raw                                                                                                                                     21h
cluster-memory-usage-raw                                                                                                                                        21h
node-allocatable-cpu-cores                   2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:27Z   21h
node-allocatable-memory-bytes                2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:27Z   21h
node-capacity-cpu-cores                      2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:24Z   21h
node-capacity-memory-bytes                   2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:24Z   21h
node-cpu-allocatable-raw                                                                                                                                        21h
node-cpu-capacity-raw                                                                                                                                           21h
node-memory-allocatable-raw                                                                                                                                     21h
node-memory-capacity-raw                                                                                                                                        21h
persistentvolumeclaim-capacity-bytes                                                       2020-06-04T14:56:00Z   2020-06-05T14:06:00Z   2020-06-05T14:08:58Z   21h
persistentvolumeclaim-capacity-raw                                                                                                                              21h
persistentvolumeclaim-phase                  2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:24Z   21h
persistentvolumeclaim-phase-raw                                                                                                                                 21h
persistentvolumeclaim-request-bytes          2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:24Z   21h
persistentvolumeclaim-request-raw                                                                                                                               21h
persistentvolumeclaim-usage-bytes                                                          2020-06-04T14:56:00Z   2020-06-05T14:06:00Z   2020-06-05T14:08:50Z   21h
persistentvolumeclaim-usage-raw                                                                                                                                 21h
persistentvolumeclaim-usage-with-phase-raw                                                                                                                      21h
pod-cpu-request-raw                                                                                                                                             21h
pod-cpu-usage-raw                                                                                                                                               21h
pod-limit-cpu-cores                          2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:26Z   21h
pod-limit-memory-bytes                       2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:25Z   21h
pod-memory-request-raw                                                                                                                                          21h
pod-memory-usage-raw                                                                                                                                            21h
pod-persistentvolumeclaim-request-info       2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:24Z   21h
pod-request-cpu-cores                        2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:24Z   21h
pod-request-memory-bytes                     2020-06-04T15:55:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:24Z   21h
pod-usage-cpu-cores                          2020-06-04T15:54:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:26Z   21h
pod-usage-memory-bytes                       2020-06-04T15:54:00Z   2020-06-05T14:10:00Z   2020-06-04T14:56:00Z   2020-06-05T14:10:00Z   2020-06-05T14:10:24Z   21h

@bentito
Copy link
Author

bentito commented Jun 5, 2020

Also turning on machine-api-operator with, for instance:
oc patch clusterversion/version --type='json' -p '[{"op":"remove", "path":"/spec/overrides/2"}]' -oyaml
didn't change the available datasource data.

@timflannagan
Copy link

This is pretty scriptable if you also creating the MeteringConfig custom resource doing something like this:

cat <<EOF | oc apply -f -
apiVersion: metering.openshift.io/v1
kind: MeteringConfig
metadata:
  name: "operator-metering"
  annotations:
    "ansible.operator-sdk/verbosity": "1"
spec:
  storage:
    type: "hive"
    hive:
      type: "sharedPVC"
      sharedPVC:
        createPVC: true
        storageClass: " "
        size: 25Gi
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment