From e4b748bd7dc9caa93d0bf82739ac6319ed8a4d4d Mon Sep 17 00:00:00 2001 From: Michael Skarbek Date: Tue, 28 Jun 2022 14:32:50 -0400 Subject: [PATCH 1/4] create v1.1.6 bundle (#142) --- Makefile | 4 +- koku-metrics-operator/1.1.6/Dockerfile | 21 + ...s-cfg.openshift.io_kokumetricsconfigs.yaml | 842 ++++++++++++++++++ ...etrics-operator.clusterserviceversion.yaml | 491 ++++++++++ .../1.1.6/metadata/annotations.yaml | 15 + .../1.1.6/tests/scorecard/config.yaml | 28 + 6 files changed, 1399 insertions(+), 2 deletions(-) create mode 100644 koku-metrics-operator/1.1.6/Dockerfile create mode 100644 koku-metrics-operator/1.1.6/manifests/koku-metrics-cfg.openshift.io_kokumetricsconfigs.yaml create mode 100644 koku-metrics-operator/1.1.6/manifests/koku-metrics-operator.clusterserviceversion.yaml create mode 100644 koku-metrics-operator/1.1.6/metadata/annotations.yaml create mode 100644 koku-metrics-operator/1.1.6/tests/scorecard/config.yaml diff --git a/Makefile b/Makefile index 7af04e5b3..d2462ee14 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Current Operator version -PREVIOUS_VERSION ?= 1.1.5 -VERSION ?= 1.1.6 +PREVIOUS_VERSION ?= 1.1.6 +VERSION ?= 1.1.7 # Default bundle image tag IMAGE_TAG_BASE ?= quay.io/project-koku/koku-metrics-operator BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION) diff --git a/koku-metrics-operator/1.1.6/Dockerfile b/koku-metrics-operator/1.1.6/Dockerfile new file mode 100644 index 000000000..7147fd722 --- /dev/null +++ b/koku-metrics-operator/1.1.6/Dockerfile @@ -0,0 +1,21 @@ +FROM scratch + +# Core bundle labels. +LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1 +LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ +LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ +LABEL operators.operatorframework.io.bundle.package.v1=koku-metrics-operator +LABEL operators.operatorframework.io.bundle.channels.v1=alpha,beta +LABEL operators.operatorframework.io.bundle.channel.default.v1=beta +LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.10.0+git +LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 +LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v2 + +# Labels for testing. +LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 +LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ + +# Copy files to locations specified by labels. +COPY manifests /manifests/ +COPY metadata /metadata/ +COPY tests/scorecard /tests/scorecard/ diff --git a/koku-metrics-operator/1.1.6/manifests/koku-metrics-cfg.openshift.io_kokumetricsconfigs.yaml b/koku-metrics-operator/1.1.6/manifests/koku-metrics-cfg.openshift.io_kokumetricsconfigs.yaml new file mode 100644 index 000000000..651ae1bba --- /dev/null +++ b/koku-metrics-operator/1.1.6/manifests/koku-metrics-cfg.openshift.io_kokumetricsconfigs.yaml @@ -0,0 +1,842 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.3.0 + creationTimestamp: null + labels: + app: koku-metrics-operator + name: kokumetricsconfigs.koku-metrics-cfg.openshift.io +spec: + group: koku-metrics-cfg.openshift.io + names: + kind: KokuMetricsConfig + listKind: KokuMetricsConfigList + plural: kokumetricsconfigs + singular: kokumetricsconfig + scope: Namespaced + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + description: KokuMetricsConfig is the Schema for the kokumetricsconfig API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: KokuMetricsConfigSpec defines the desired state of KokuMetricsConfig. + properties: + api_url: + default: https://cloud.redhat.com + description: FOR DEVELOPMENT ONLY. APIURL is a field of KokuMetricsConfig + to represent the url of the API endpoint for service interaction. + The default is `https://cloud.redhat.com`. + type: string + authentication: + description: Authentication is a field of KokuMetricsConfig to represent + the authentication object. + properties: + secret_name: + description: AuthenticationSecretName is a field of KokuMetricsConfig + to represent the secret with the user and password used for + uploads. + type: string + type: + default: token + description: 'AuthType is a field of KokuMetricsConfig to represent + the authentication type to be used basic or token. Valid values + are: - "basic" : Enables authentication using user and password + from authentication secret. - "token" (default): Uses cluster + token for authentication.' + enum: + - token + - basic + type: string + required: + - type + type: object + clusterID: + description: ClusterID is a field of KokuMetricsConfig to represent + the cluster UUID. Normally this value should not be specified. Only + set this value if the clusterID cannot be obtained from the ClusterVersion. + type: string + clusterVersion: + description: ClusterVersion is a field of KokuMetricsConfig to represent + the cluster version. Normally this value should not be specified. + Only set this value if the clusterVersion cannot be obtained from + the ClusterVersion. + type: string + packaging: + description: Packaging is a field of KokuMetricsConfig to represent + the packaging object. + properties: + max_reports_to_store: + default: 30 + description: MaxReports is a field of KokuMetricsConfig to represent + the maximum number of reports to store. The default is 30 reports + which corresponds to approximately 7 days worth of data given + the other default values. + format: int64 + minimum: 1 + type: integer + max_size_MB: + default: 100 + description: MaxSize is a field of KokuMetricsConfig to represent + the max file size in megabytes that will be compressed for upload + to Ingress. The default is 100. + format: int64 + maximum: 100 + minimum: 1 + type: integer + required: + - max_reports_to_store + - max_size_MB + type: object + prometheus_config: + description: PrometheusConfig is a field of KokuMetricsConfig to represent + the configuration of Prometheus connection. + properties: + context_timeout: + default: 120 + description: ContextTimeout is a field of KokuMetricsConfig to + represent how long a query to prometheus should run in seconds + before timing out. The default is 120 seconds. + format: int64 + maximum: 180 + minimum: 10 + type: integer + service_address: + default: https://thanos-querier.openshift-monitoring.svc:9091 + description: FOR DEVELOPMENT ONLY. SvcAddress is a field of KokuMetricsConfig + to represent the thanos-querier address. The default is `https://thanos-querier.openshift-monitoring.svc:9091`. + type: string + skip_tls_verification: + default: false + description: FOR DEVELOPMENT ONLY. SkipTLSVerification is a field + of KokuMetricsConfig to represent if the thanos-querier endpoint + must be certificate validated. The default is false. + type: boolean + required: + - service_address + - skip_tls_verification + type: object + source: + description: Source is a field of KokuMetricsConfig to represent the + desired source on cloud.redhat.com. + properties: + check_cycle: + default: 1440 + description: CheckCycle is a field of KokuMetricsConfig to represent + the number of minutes between each source check schedule The + default is 1440 min (24 hours). + format: int64 + minimum: 0 + type: integer + create_source: + default: false + description: CreateSource is a field of KokuMetricsConfigSpec + to represent if the source should be created if not found. + type: boolean + name: + description: SourceName is a field of KokuMetricsConfigSpec to + represent the source name on cloud.redhat.com. + type: string + sources_path: + default: /api/sources/v1.0/ + description: FOR DEVELOPMENT ONLY. SourcesAPIPath is a field of + KokuMetricsConfig to represent the path of the Sources API service. + The default is `/api/sources/v1.0/`. + type: string + required: + - check_cycle + - create_source + - sources_path + type: object + upload: + description: Upload is a field of KokuMetricsConfig to represent the + upload object. + properties: + ingress_path: + default: /api/ingress/v1/upload + description: FOR DEVELOPMENT ONLY. IngressAPIPath is a field of + KokuMetricsConfig to represent the path of the Ingress API service. + The default is `/api/ingress/v1/upload`. + type: string + upload_cycle: + default: 360 + description: UploadCycle is a field of KokuMetricsConfig to represent + the number of minutes between each upload schedule. The default + is 360 min (6 hours). + format: int64 + minimum: 0 + type: integer + upload_toggle: + default: true + description: UploadToggle is a field of KokuMetricsConfig to represent + if the operator is installed in a restricted-network. If `false`, + the operator will not upload to cloud.redhat.com or check/create + sources. The default is true. + type: boolean + upload_wait: + description: UploadWait is a field of KokuMetricsConfig to represent + the time to wait before sending an upload. + format: int64 + minimum: 0 + type: integer + validate_cert: + default: true + description: ValidateCert is a field of KokuMetricsConfig to represent + if the Ingress endpoint must be certificate validated. + type: boolean + required: + - ingress_path + - upload_cycle + - upload_toggle + - validate_cert + type: object + volume_claim_template: + description: VolumeClaimTemplate is a field of KokuMetricsConfig to + represent a PVC template. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + description: EmbeddedMetadata contains metadata relevant to an + EmbeddedResource. + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + http://kubernetes.io/docs/user-guide/annotations' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. May + match selectors of replication controllers and services. + More info: http://kubernetes.io/docs/user-guide/labels' + type: object + name: + description: 'Name must be unique within a namespace. Is required + when creating resources, although some resources may allow + a client to request the generation of an appropriate name + automatically. Name is primarily intended for creation idempotence + and configuration definition. Cannot be updated. More info: + http://kubernetes.io/docs/user-guide/identifiers#names' + type: string + type: object + spec: + description: 'Spec defines the desired characteristics of a volume + requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + properties: + accessModes: + description: 'AccessModes contains the desired access modes + the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + items: + type: string + type: array + dataSource: + description: 'This field can be used to specify either: * + An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) * An existing + custom resource that implements data population (Alpha) + In order to use custom resource types that implement data + population, the AnyVolumeDataSource feature gate must be + enabled. If the provisioner or an external controller can + support the specified data source, it will create a new + volume based on the contents of the specified data source.' + properties: + apiGroup: + description: APIGroup is the group for the resource being + referenced. If APIGroup is not specified, the specified + Kind must be in the core API group. For any other third-party + types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + resources: + description: 'Resources represents the minimum resources the + volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of + compute resources required. If Requests is omitted for + a container, it defaults to Limits if that is explicitly + specified, otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + type: object + selector: + description: A label query over volumes to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + storageClassName: + description: 'Name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + type: string + volumeMode: + description: volumeMode defines what type of volume is required + by the claim. Value of Filesystem is implied when not included + in claim spec. + type: string + volumeName: + description: VolumeName is the binding reference to the PersistentVolume + backing this claim. + type: string + type: object + type: object + required: + - authentication + - packaging + - prometheus_config + - source + - upload + type: object + status: + description: KokuMetricsConfigStatus defines the observed state of KokuMetricsConfig. + properties: + api_url: + description: APIURL is a field of KokuMetricsConfig to represent the + url of the API endpoint for service interaction. + type: string + authentication: + description: Authentication is a field of KokuMetricsConfig to represent + the authentication status. + properties: + credentials_found: + description: AuthenticationCredentialsFound is a field of KokuMetricsConfig + to represent if used for uploads were found. + type: boolean + error: + description: AuthErrorMessage is a field of KokuMetricsConfig + to represent an `invalid credentials` error message. + type: string + last_credential_verification_time: + description: LastVerificationTime is a field of KokuMetricsConfig + to represent the last time credentials were verified. + format: date-time + nullable: true + type: string + secret_name: + description: AuthenticationSecretName is a field of KokuMetricsConfig + to represent the secret with the user and password used for + uploads. + type: string + type: + description: AuthType is a field of KokuMetricsConfig to represent + the authentication type to be used basic or token. + enum: + - token + - basic + type: string + valid_basic_auth: + description: ValidBasicAuth is a field of KokuMetricsConfig to + represent if the given basic auth credentials are valid. + type: boolean + type: object + clusterID: + description: ClusterID is a field of KokuMetricsConfig to represent + the cluster UUID. + type: string + clusterVersion: + description: ClusterVersion is a field of KokuMetricsConfig to represent + the cluster version. + type: string + operator_commit: + description: OperatorCommit is a field of KokuMetricsConfig that shows + the commit hash of the operator. + type: string + packaging: + description: Packaging is a field of KokuMetricsConfig to represent + the packaging status + properties: + error: + description: PackagingError is a field of KokuMetricsConfig to + represent the error encountered packaging the reports. + type: string + last_successful_packaging_time: + description: LastSuccessfulPackagingTime is a field of KokuMetricsConfig + that shows the time of the last successful file packaging. + format: date-time + nullable: true + type: string + max_reports_to_store: + description: MaxReports is a field of KokuMetricsConfig to represent + the maximum number of reports to store. + format: int64 + type: integer + max_size_MB: + description: MaxSize is a field of KokuMetricsConfig to represent + the max file size in megabytes that will be compressed for upload + to Ingress. + format: int64 + type: integer + number_reports_stored: + description: ReportCount is a field of KokuMetricsConfig to represent + the number of reports in storage. + format: int64 + type: integer + packaged_files: + description: PackagedFiles is a field of KokuMetricsConfig to + represent the list of file packages in storage. + items: + type: string + type: array + type: object + persistent_volume_claim: + description: PersistentVolumeClaim is a field of KokuMetricsConfig + to represent a PVC. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + description: EmbeddedMetadata contains metadata relevant to an + EmbeddedResource. + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + http://kubernetes.io/docs/user-guide/annotations' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. May + match selectors of replication controllers and services. + More info: http://kubernetes.io/docs/user-guide/labels' + type: object + name: + description: 'Name must be unique within a namespace. Is required + when creating resources, although some resources may allow + a client to request the generation of an appropriate name + automatically. Name is primarily intended for creation idempotence + and configuration definition. Cannot be updated. More info: + http://kubernetes.io/docs/user-guide/identifiers#names' + type: string + type: object + spec: + description: 'Spec defines the desired characteristics of a volume + requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + properties: + accessModes: + description: 'AccessModes contains the desired access modes + the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + items: + type: string + type: array + dataSource: + description: 'This field can be used to specify either: * + An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) * An existing + custom resource that implements data population (Alpha) + In order to use custom resource types that implement data + population, the AnyVolumeDataSource feature gate must be + enabled. If the provisioner or an external controller can + support the specified data source, it will create a new + volume based on the contents of the specified data source.' + properties: + apiGroup: + description: APIGroup is the group for the resource being + referenced. If APIGroup is not specified, the specified + Kind must be in the core API group. For any other third-party + types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + resources: + description: 'Resources represents the minimum resources the + volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of + compute resources required. If Requests is omitted for + a container, it defaults to Limits if that is explicitly + specified, otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + type: object + selector: + description: A label query over volumes to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + storageClassName: + description: 'Name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + type: string + volumeMode: + description: volumeMode defines what type of volume is required + by the claim. Value of Filesystem is implied when not included + in claim spec. + type: string + volumeName: + description: VolumeName is the binding reference to the PersistentVolume + backing this claim. + type: string + type: object + type: object + prometheus: + description: Prometheus represents the status of premetheus queries. + properties: + configuration_error: + description: ConfigError is a field of KokuMetricsConfigStatus + to represent errors during prometheus configuration. + type: string + context_timeout: + description: ContextTimeout is a field of KokuMetricsConfigState + to represent how long a query to prometheus should run in seconds + before timing out. + format: int64 + type: integer + last_query_start_time: + description: LastQueryStartTime is a field of KokuMetricsConfigStatus + to represent the last time queries were started. + format: date-time + nullable: true + type: string + last_query_success_time: + description: LastQuerySuccessTime is a field of KokuMetricsConfigStatus + to represent the last time queries were successful. + format: date-time + nullable: true + type: string + prometheus_configured: + description: PrometheusConfigured is a field of KokuMetricsConfigStatus + to represent if the operator is configured to connect to prometheus. + type: boolean + prometheus_connected: + description: PrometheusConnected is a field of KokuMetricsConfigStatus + to represent if prometheus can be queried. + type: boolean + prometheus_connection_error: + description: ConnectionError is a field of KokuMetricsConfigStatus + to represent errors during prometheus test query. + type: string + service_address: + description: SvcAddress is the internal thanos-querier address. + type: string + skip_tls_verification: + description: SkipTLSVerification is a field of KokuMetricsConfigStatus + to represent if the thanos-querier endpoint must be certificate + validated. + type: boolean + required: + - prometheus_configured + - prometheus_connected + type: object + reports: + description: Reports represents the status of report generation. + properties: + data_collected: + description: DataCollected is a field of KokuMetricsConfigStatus + to represent whether or not data was collected for the last + query. + type: boolean + data_collection_message: + description: DataCollectionMessage is a field of KokuMetricsConfigStatus + to represent a message associated with the data_collected status. + type: string + last_hour_queried: + description: LastHourQueried is a field of KokuMetricsConfigStatus + to represent the time range for which metrics were last queried. + type: string + report_month: + description: ReportMonth is a field of KokuMetricsConfigStatus + to represent the month for which reports are being generated. + type: string + type: object + source: + description: Source is a field of KokuMetricsConfig to represent the + observed state of the source on cloud.redhat.com. + properties: + check_cycle: + description: CheckCycle is a field of KokuMetricsConfig to represent + the number of minutes between each source check schedule. The + default is 1440 min (24 hours). + format: int64 + type: integer + create_source: + description: CreateSource is a field of KokuMetricsConfigStatus + to represent if the source should be created if not found. A + source will not be created if upload_toggle is `false`. + type: boolean + error: + description: SourceError is a field of KokuMetricsConfigStatus + to represent the error encountered creating the source. + type: string + last_check_time: + description: LastSourceCheckTime is a field of KokuMetricsConfig + that shows the time that the last check was attempted. + format: date-time + nullable: true + type: string + name: + description: SourceName is a field of KokuMetricsConfigStatus + to represent the source name on cloud.redhat.com. + type: string + source_defined: + description: SourceDefined is a field of KokuMetricsConfigStatus + to represent if the source exists as defined on cloud.redhat.com. + type: boolean + sources_path: + description: SourcesAPIPath is a field of KokuMetricsConfig to + represent the path of the Sources API service. + type: string + type: object + storage: + description: Storage is a field + properties: + volume_mounted: + description: VolumeMounted is a bool to indicate if storage volume + was mounted. + type: boolean + volume_type: + description: VolumeType is the string representation of the volume + type. + type: string + type: object + upload: + description: Upload is a field of KokuMetricsConfig to represent the + upload object. + properties: + error: + description: UploadError is a field of KokuMetricsConfigStatus + to represent the error encountered uploading reports. + type: string + ingress_path: + description: IngressAPIPath is a field of KokuMetricsConfig to + represent the path of the Ingress API service. + type: string + last_payload_files: + description: LastPayloadFiles is a field of KokuMetricsConfig + to represent the list of files in the last payload that was + sent. + items: + type: string + type: array + last_payload_manifest_id: + description: LastPayloadManifest is a field of KokuMetricsConfig + that shows the manifestID of the last payload. + type: string + last_payload_name: + description: LastPayloadName is a field of KokuMetricsConfig that + shows the name of the last payload file. + type: string + last_payload_request_id: + description: LastPayloadRequestID is a field of KokuMetricsConfig + that shows the insights request id of the last payload. + type: string + last_successful_upload_time: + description: LastSuccessfulUploadTime is a field of KokuMetricsConfig + that shows the time of the last successful upload. + format: date-time + nullable: true + type: string + last_upload_status: + description: LastUploadStatus is a field of KokuMetricsConfig + that shows the http status of the last upload. + type: string + upload: + description: UploadToggle is a field of KokuMetricsConfig to represent + if the operator should upload to cloud.redhat.com. The default + is true + type: boolean + upload_cycle: + description: UploadCycle is a field of KokuMetricsConfig to represent + the number of minutes between each upload schedule. The default + is 360 min (6 hours). + format: int64 + type: integer + upload_wait: + description: UploadWait is a field of KokuMetricsConfig to represent + the time to wait before sending an upload. + format: int64 + type: integer + validate_cert: + description: ValidateCert is a field of KokuMetricsConfig to represent + if the Ingress endpoint must be certificate validated. + type: boolean + type: object + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/koku-metrics-operator/1.1.6/manifests/koku-metrics-operator.clusterserviceversion.yaml b/koku-metrics-operator/1.1.6/manifests/koku-metrics-operator.clusterserviceversion.yaml new file mode 100644 index 000000000..efd1184e1 --- /dev/null +++ b/koku-metrics-operator/1.1.6/manifests/koku-metrics-operator.clusterserviceversion.yaml @@ -0,0 +1,491 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + alm-examples: |- + [ + { + "apiVersion": "koku-metrics-cfg.openshift.io/v1beta1", + "kind": "KokuMetricsConfig", + "metadata": { + "name": "kokumetricscfg-sample-v1beta1" + }, + "spec": { + "authentication": { + "type": "token" + }, + "packaging": { + "max_reports_to_store": 30, + "max_size_MB": 100 + }, + "prometheus_config": {}, + "source": { + "check_cycle": 1440, + "create_source": false, + "name": "INSERT-SOURCE-NAME" + }, + "upload": { + "upload_cycle": 360, + "upload_toggle": true + } + } + } + ] + capabilities: Seamless Upgrades + categories: Monitoring + certified: "false" + containerImage: quay.io/project-koku/koku-metrics-operator@sha256:812b3be055f76913e0e00ef3bccb3c866bbc93e49fa439556d6298f83492fc6f + createdAt: "2022-06-28T15:17:37Z" + description: A Golang-based OpenShift Operator that generates and uploads OpenShift + usage metrics to cost management. + operatorframework.io/suggested-namespace: koku-metrics-operator + operators.openshift.io/infrastructure-features: '["Disconnected"]' + operators.operatorframework.io/builder: operator-sdk-v1.10.0+git + operators.operatorframework.io/project_layout: go.kubebuilder.io/v2 + repository: https://github.com/project-koku/koku-metrics-operator + support: Cost Management + name: koku-metrics-operator.v1.1.6 + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - description: KokuMetricsConfig is the Schema for the kokumetricsconfig API + displayName: Koku Metrics Config + kind: KokuMetricsConfig + name: kokumetricsconfigs.koku-metrics-cfg.openshift.io + version: v1beta1 + description: |- + # Koku Metrics Operator + ## Introduction + The `koku-metrics-operator` is a component of the [cost managment](https://access.redhat.com/documentation/en-us/cost_management_service) service for Openshift, used to gather the required information from the cluster. It is recommended to be installed in OpenShift 4.5+. This operator obtains OpenShift usage data by querying Prometheus and uploads it to cost management to be processed. The Operator queries Prometheus every hour to create metric reports, which are then packaged and uploaded to cost management at [console.redhat.com](https://console.redhat.com). For more information, reach out to . + + This operator is capable of functioning within a disconnected/restricted network (aka air-gapped mode). In this mode, the operator will store the packaged reports for manual retrieval instead of being uploaded to cost management. Documentation for installing an operator within a restricted network can be found [here](https://docs.openshift.com/container-platform/latest/operators/admin/olm-restricted-networks.html). + + ## Features and Capabilities + #### Metrics collection: + The Koku Metrics Operator (`koku-metrics-operator`) collects the metrics required for cost management by: + * Querying Prometheus to gather the necessary metrics for cost management. + * Writing Prometheus queries to CSV report files. + * Packaging the CSV report files into tarballs. + + #### Additional Capabilities: + * The operator can be configured to automatically upload the packaged reports to cost management through Red Hat Insights Ingress service. + * The operator can create a source in console.redhat.com. A source is required for cost management to process the uploaded packages. + * PersistentVolumeClaim (PVC) configuration: The KokuMetricsConfig CR can accept a PVC definition and the operator will create and mount the PVC. If one is not provided, a default PVC will be created. + * Restricted network installation: this operator can function on a restricted network. In this mode, the operator stores the packaged reports for manual retrieval. + + ## Limitations and Pre-Requisites + #### Limitations (Potential for metrics data loss) + * A source **must** exist in console.redhat.com for an uploaded payload to be processed by cost management. The operator sends the payload to the Red Hat Insights Ingress service which usually returns successfully, but the operator does not currently confirm with cost management that the payload was processed. After Ingress accepts the uploaded payload, the payload is removed from the operator and is gone forever. If the data within the payload is not processed, a gap will be introduced in the usage metrics. + + **Note** The following limitations are specific to operators configured to run in a restricted network: + * The `koku-metrics-operator` will not be able to generate new reports if the PVC storage is filled. If this occurs, the reports must be manually deleted from the PVC so that the operator can function as normal. + * The default report retention is 30 reports (about one week's worth of data). The reports must be manually downloaded and uploaded to console.redhat.com every week, or they will be deleted and the data will be lost. + + #### Storage configuration prerequisite + The operator will attempt to create and use the following PVC when installed: + + volume_claim_template: + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: koku-metrics-operator-data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + + If a different PVC should be utilized, a valid PVC should be specified in the KokuMetricsConfig CR as described in the appropriate section below. The PVC to be used may exist already, or the operator will attempt to create it. + + To use the default specification, the follow assumptions must be met: + 1. A default StorageClass is defined. + 2. Dynamic provisioning for that default StorageClass is enabled. + + If these assumptions are not met, the operator will not deploy correctly. In these cases, storage must be manually configured. After configuring storage, a valid PVC template should be supplied in the `volume_claim_template` spec of the KokuMetricsConfig CR. + + ## Configure the koku-metrics-operator + **Note** There are separate instructions for configuring the `koku-metrics-operator` to run in a restricted network. + ##### Configure authentication + The default authentication for the operator is `token`. No further steps are required to configure token authentication. If `basic` is the preferred authentication method, a Secret must be created which holds username and password credentials: + 1. On the left navigation pane, select `Workloads` -> `Secrets` -> select Project: `koku-metrics-operator` -> `Create` -> `Key/Value Secret` + 2. Give the Secret a name and add 2 keys: `username` and `password` (all lowercase). The values for these keys correspond to console.redhat.com credentials. + 3. Select `Create`. + ##### Create the KokuMetricsConfig + Configure the koku-metrics-operator by creating a `KokuMetricsConfig`. + 1. On the left navigation pane, select `Operators` -> `Installed Operators` -> `koku-metrics-operator` -> `KokuMetricsConfig` -> `Create Instance`. + 2. For `basic` authentication, edit the following values in the spec: + * Replace `authentication: type:` with `basic`. + * Add the `secret_name` field under `authentication`, and set it equal to the name of the authentication Secret that was created above. The spec should look similar to the following: + + ``` + authentication: + secret_name: SECRET-NAME + type: basic + ``` + + 3. To configure the koku-metrics-operator to create a cost management source, edit the following values in the `source` field: + * Replace `INSERT-SOURCE-NAME` with the preferred name of the source to be created. + * Replace the `create_source` field value with `true`. + + **Note:** if the source already exists, replace `INSERT-SOURCE-NAME` with the existing name, and leave `create_source` as false. This will allow the operator to confirm the source exists. + 4. If not specified, the operator will create a default PersistentVolumeClaim called `koku-metrics-operator-data` with 10Gi of storage. To configure the koku-metrics-operator to use or create a different PVC, edit the following in the spec: + * Add the desired configuration to the `volume_claim_template` field in the spec: + + ``` + volume_claim_template: + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + ``` + + **Note:** If using the YAML View, the `volume_claim_template` field must be added to the spec + 5. Select `Create`. + + # Restricted Network Usage (disconnected/air-gapped mode) + ## Installation + To install the `koku-metrics-operator` in a restricted network, follow the [olm documentation](https://docs.openshift.com/container-platform/latest/operators/admin/olm-restricted-networks.html). The operator is found in the `community-operators` Catalog in the `registry.redhat.io/redhat/community-operator-index:latest` Index. If pruning the index before pushing to the mirrored registry, keep the `koku-metrics-operator` package. + + Within a restricted network, the operator queries prometheus to gather the necessary usage metrics, writes the query results to CSV files, and packages the reports for storage in the PVC. These reports then need to be manually downloaded from the cluster and uploaded to [console.redhat.com](https://console.redhat.com). + + ## Configure the koku-metrics-operator for a restricted network + ##### Create the KokuMetricsConfig + Configure the koku-metrics-operator by creating a `KokuMetricsConfig`. + 1. On the left navigation pane, select `Operators` -> `Installed Operators` -> `koku-metrics-operator` -> `KokuMetricsConfig` -> `Create Instance`. + 2. Specify the desired storage. If not specified, the operator will create a default Persistent Volume Claim called `koku-metrics-operator-data` with 10Gi of storage. To configure the koku-metrics-operator to use or create a different PVC, edit the following in the spec: + * Add the desired configuration to the `volume_claim_template` field in the spec: + + ``` + volume_claim_template: + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: + spec: + storageClassName: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + ``` + + **Note:** If using the YAML View, the `volume_claim_template` field must be added to the spec + 3. (Optional) Specify the desired report retention. The operator will retain 30 reports by default. This corresponds to approximately one week's worth of data if using the default packaging cycle. To modify the number of retained reports: + * Change the `packaging` spec field `max_reports_to_store` to the desired number of reports to retain. Once this max number is reached, the operator will start removing the oldest packages remaining on the PVC: + + ``` + packaging: + max_size_MB: 100 + max_reports_to_store: 30 + ``` + + **Note:** The number of retained reports directly affects the frequency that reports must be manually downloaded from the PVC. Take caution in setting this to a higher number of reports, as the operator cannot write data to the PVC if the storage is full. + 4. To configure the operator to perform in a restricted network, set the `upload_toggle` to `false`: + + ``` + upload: + upload_cycle: 360, + upload_toggle: false + ``` + + 5. Select `Create`. + + ## Download reports from the Operator & clean up the PVC + If the `koku-metrics-operator` is configured to run in a restricted network, the metric reports will not automatically upload to cost managment. Instead, they need to be manually copied from the PVC for upload to [console.redhat.com](https://console.redhat.com). The default configuration saves one week of reports which means the process of downloading and uploading reports should be repeated weekly to prevent loss of metrics data. To download the reports, complete the following steps: + 1. Create the following Pod, ensuring the `claimName` matches the PVC containing the report data: + + ``` + kind: Pod + apiVersion: v1 + metadata: + name: volume-shell + namespace: koku-metrics-operator + labels: + app: koku-metrics-operator + spec: + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - koku-metrics-operator + topologyKey: kubernetes.io/hostname + volumes: + - name: koku-metrics-operator-reports + persistentVolumeClaim: + claimName: koku-metrics-operator-data + containers: + - name: volume-shell + image: busybox + command: ['sleep', 'infinity'] + volumeMounts: + - name: koku-metrics-operator-reports + mountPath: /tmp/koku-metrics-operator-reports + ``` + + 2. Use rsync to copy all of the files ready for upload from the PVC to a local folder: + + ``` + $ oc rsync volume-shell:/tmp/koku-metrics-operator-reports/upload local/path/to/save/folder + ``` + + 3. Once confirming that the files have been successfully copied, use rsh to connect to the pod and delete the contents of the upload folder so that they are no longer in storage: + + ``` + $ oc rsh volume-shell + $ rm /tmp/koku-metrics-operator-reports/upload/* + ``` + + 4. (Optional) Delete the pod that was used to connect to the PVC: + + ``` + $ oc delete -f volume-shell.yaml + ``` + + ## Create a source + In a restricted network, the `koku-metrics-operator` cannot automatically create a source. This process must be done manually. In the console.redhat.com platform, open the [Sources menu](https://console.redhat.com/settings/sources/) to begin adding an OpenShift source to cost management: + + Prerequisites: + * The cluster identifier which can be found in the KokuMetricsConfig CR, the cluster Overview page, or the cluster Help > About. + + Create source: + 1. Navigate to the Sources menu + 2. Select the `Red Hat sources` tab + 3. Create a new `Red Hat Openshift Container Platform` source: + * give the source a unique name + * add the Cost Management application + * add the cluster identifier + 4. In the Sources wizard, review the details and click `Finish` to create the Source. + + ## Upload the reports to cost managment + Uploading reports to cost managment is done through curl: + + $ curl -vvvv -F "file=@FILE_NAME.tar.gz;type=application/vnd.redhat.hccm.tar+tgz" https://cloud.redhat.com/api/ingress/v1/upload -u USERNAME:PASS + + where `USERNAME` and `PASS` correspond to the user credentials for [console.redhat.com](https://console.redhat.com), and `FILE_NAME` is the name of the report to upload. + + displayName: Koku Metrics Operator + icon: + - base64data: PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFk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EzNwoJCQljLTAuNjQ5Njg4NywwLjY0OTY3MzUtMC45NzY4MjE5LDEuNDc0NDQxNS0wLjk3NjgyMTksMi40NjUwODc5YzAsMC42ODY1NTQsMC4yMzAzOTI1LDEuMzM2MjEyMiwwLjY5MTE0NjksMS45NDkwMzU2CgkJCWMwLjQ1NjE2MTUsMC42MTI4MjM1LDEuMDMyMTE5OCwxLjAzMjExOTgsMS43MTg2NTg0LDEuMjYyNDk2OUwxNzQuMjgwNjM5NiwxODUuODczNjExNXoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K + mediatype: image/svg+xml + install: + spec: + clusterPermissions: + - rules: + - apiGroups: + - config.openshift.io + resources: + - clusterversions + verbs: + - get + - list + - watch + - apiGroups: + - "" + resources: + - namespaces + verbs: + - get + - list + - watch + - apiGroups: + - "" + resources: + - secrets + verbs: + - get + serviceAccountName: koku-metrics-controller-manager + deployments: + - name: koku-metrics-operator + spec: + replicas: 1 + selector: + matchLabels: + app: koku-metrics-operator + control-plane: controller-manager + strategy: {} + template: + metadata: + labels: + app: koku-metrics-operator + control-plane: controller-manager + spec: + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - koku-metrics-operator + topologyKey: kubernetes.io/hostname + containers: + - args: + - --enable-leader-election + command: + - /manager + env: + - name: IN_CLUSTER + value: "true" + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.annotations['olm.targetNamespaces'] + image: quay.io/project-koku/koku-metrics-operator@sha256:812b3be055f76913e0e00ef3bccb3c866bbc93e49fa439556d6298f83492fc6f + name: manager + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 100m + memory: 20Mi + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /tmp/koku-metrics-operator-reports + name: koku-metrics-operator-reports + serviceAccountName: koku-metrics-controller-manager + terminationGracePeriodSeconds: 10 + volumes: + - name: koku-metrics-operator-reports + permissions: + - rules: + - apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete + - apiGroups: + - "" + resources: + - configmaps/status + verbs: + - get + - update + - patch + - apiGroups: + - "" + resources: + - events + verbs: + - create + - patch + - apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete + - apiGroups: + - apps + resources: + - deployments + verbs: + - get + - list + - patch + - watch + - apiGroups: + - "" + resources: + - configmaps + - endpoints + - events + - persistentvolumeclaims + - pods + - secrets + - serviceaccounts + - services + - services/finalizers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - koku-metrics-cfg.openshift.io + resources: + - kokumetricsconfigs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - koku-metrics-cfg.openshift.io + resources: + - kokumetricsconfigs/status + verbs: + - get + - patch + - update + - apiGroups: + - operators.coreos.com + resources: + - clusterserviceversions + verbs: + - get + - list + - patch + - update + - watch + serviceAccountName: koku-metrics-controller-manager + strategy: deployment + installModes: + - supported: true + type: OwnNamespace + - supported: true + type: SingleNamespace + - supported: false + type: MultiNamespace + - supported: false + type: AllNamespaces + relatedImages: + - name: koku-metrics-operator + image: quay.io/project-koku/koku-metrics-operator@sha256:812b3be055f76913e0e00ef3bccb3c866bbc93e49fa439556d6298f83492fc6f + keywords: + - cost + - management + - usage + - monitor + maintainers: + - email: costmanagement@redhat.com + name: costmanagement + maturity: alpha + provider: + name: Red Hat + replaces: koku-metrics-operator.v1.1.5 + version: 1.1.6 diff --git a/koku-metrics-operator/1.1.6/metadata/annotations.yaml b/koku-metrics-operator/1.1.6/metadata/annotations.yaml new file mode 100644 index 000000000..5e2f30385 --- /dev/null +++ b/koku-metrics-operator/1.1.6/metadata/annotations.yaml @@ -0,0 +1,15 @@ +annotations: + # Core bundle annotations. + operators.operatorframework.io.bundle.mediatype.v1: registry+v1 + operators.operatorframework.io.bundle.manifests.v1: manifests/ + operators.operatorframework.io.bundle.metadata.v1: metadata/ + operators.operatorframework.io.bundle.package.v1: koku-metrics-operator + operators.operatorframework.io.bundle.channels.v1: alpha,beta + operators.operatorframework.io.bundle.channel.default.v1: beta + operators.operatorframework.io.metrics.builder: operator-sdk-v1.10.0+git + operators.operatorframework.io.metrics.mediatype.v1: metrics+v1 + operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v2 + + # Annotations for testing. + operators.operatorframework.io.test.mediatype.v1: scorecard+v1 + operators.operatorframework.io.test.config.v1: tests/scorecard/ diff --git a/koku-metrics-operator/1.1.6/tests/scorecard/config.yaml b/koku-metrics-operator/1.1.6/tests/scorecard/config.yaml new file mode 100644 index 000000000..e2d83b262 --- /dev/null +++ b/koku-metrics-operator/1.1.6/tests/scorecard/config.yaml @@ -0,0 +1,28 @@ +apiVersion: scorecard.operatorframework.io/v1alpha3 +kind: Configuration +metadata: + name: config +stages: +- parallel: true + tests: + - entrypoint: + - scorecard-test + - basic-check-spec + image: quay.io/operator-framework/scorecard-test:v1.10.1 + labels: + suite: basic + test: basic-check-spec-test + - entrypoint: + - scorecard-test + - olm-bundle-validation + image: quay.io/operator-framework/scorecard-test:v1.10.1 + labels: + suite: olm + test: olm-bundle-validation-test + - entrypoint: + - scorecard-test + - olm-crds-have-validation + image: quay.io/operator-framework/scorecard-test:v1.10.1 + labels: + suite: olm + test: olm-crds-have-validation-test From 2003f0ea23efc49b7ba1337a16b1c90c6899824b Mon Sep 17 00:00:00 2001 From: Michael Skarbek Date: Tue, 5 Jul 2022 12:36:04 -0400 Subject: [PATCH 2/4] remove pod affinity (#145) * remove pod affinity * remove affinity from docs too --- config/manager/manager.yaml | 10 ---------- docs/csv-description.md | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 0636a3ae0..0c010d5aa 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -22,16 +22,6 @@ spec: labels: control-plane: controller-manager spec: - affinity: - podAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - koku-metrics-operator - topologyKey: kubernetes.io/hostname containers: - command: - /manager diff --git a/docs/csv-description.md b/docs/csv-description.md index 04c7a930f..0f9ad9548 100644 --- a/docs/csv-description.md +++ b/docs/csv-description.md @@ -155,16 +155,6 @@ If the `koku-metrics-operator` is configured to run in a restricted network, the labels: app: koku-metrics-operator spec: - affinity: - podAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - koku-metrics-operator - topologyKey: kubernetes.io/hostname volumes: - name: koku-metrics-operator-reports persistentVolumeClaim: From 1f0b2060c372163296be34fe571963f2b2277bcf Mon Sep 17 00:00:00 2001 From: Michael Skarbek Date: Mon, 18 Jul 2022 13:09:24 -0700 Subject: [PATCH 3/4] v1.1.7 bundle (#147) --- koku-metrics-operator/1.1.7/Dockerfile | 21 + ...s-cfg.openshift.io_kokumetricsconfigs.yaml | 842 ++++++++++++++++++ ...etrics-operator.clusterserviceversion.yaml | 471 ++++++++++ .../1.1.7/metadata/annotations.yaml | 15 + .../1.1.7/tests/scorecard/config.yaml | 28 + 5 files changed, 1377 insertions(+) create mode 100644 koku-metrics-operator/1.1.7/Dockerfile create mode 100644 koku-metrics-operator/1.1.7/manifests/koku-metrics-cfg.openshift.io_kokumetricsconfigs.yaml create mode 100644 koku-metrics-operator/1.1.7/manifests/koku-metrics-operator.clusterserviceversion.yaml create mode 100644 koku-metrics-operator/1.1.7/metadata/annotations.yaml create mode 100644 koku-metrics-operator/1.1.7/tests/scorecard/config.yaml diff --git a/koku-metrics-operator/1.1.7/Dockerfile b/koku-metrics-operator/1.1.7/Dockerfile new file mode 100644 index 000000000..7147fd722 --- /dev/null +++ b/koku-metrics-operator/1.1.7/Dockerfile @@ -0,0 +1,21 @@ +FROM scratch + +# Core bundle labels. +LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1 +LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ +LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ +LABEL operators.operatorframework.io.bundle.package.v1=koku-metrics-operator +LABEL operators.operatorframework.io.bundle.channels.v1=alpha,beta +LABEL operators.operatorframework.io.bundle.channel.default.v1=beta +LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.10.0+git +LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 +LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v2 + +# Labels for testing. +LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 +LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ + +# Copy files to locations specified by labels. +COPY manifests /manifests/ +COPY metadata /metadata/ +COPY tests/scorecard /tests/scorecard/ diff --git a/koku-metrics-operator/1.1.7/manifests/koku-metrics-cfg.openshift.io_kokumetricsconfigs.yaml b/koku-metrics-operator/1.1.7/manifests/koku-metrics-cfg.openshift.io_kokumetricsconfigs.yaml new file mode 100644 index 000000000..651ae1bba --- /dev/null +++ b/koku-metrics-operator/1.1.7/manifests/koku-metrics-cfg.openshift.io_kokumetricsconfigs.yaml @@ -0,0 +1,842 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.3.0 + creationTimestamp: null + labels: + app: koku-metrics-operator + name: kokumetricsconfigs.koku-metrics-cfg.openshift.io +spec: + group: koku-metrics-cfg.openshift.io + names: + kind: KokuMetricsConfig + listKind: KokuMetricsConfigList + plural: kokumetricsconfigs + singular: kokumetricsconfig + scope: Namespaced + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + description: KokuMetricsConfig is the Schema for the kokumetricsconfig API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: KokuMetricsConfigSpec defines the desired state of KokuMetricsConfig. + properties: + api_url: + default: https://cloud.redhat.com + description: FOR DEVELOPMENT ONLY. APIURL is a field of KokuMetricsConfig + to represent the url of the API endpoint for service interaction. + The default is `https://cloud.redhat.com`. + type: string + authentication: + description: Authentication is a field of KokuMetricsConfig to represent + the authentication object. + properties: + secret_name: + description: AuthenticationSecretName is a field of KokuMetricsConfig + to represent the secret with the user and password used for + uploads. + type: string + type: + default: token + description: 'AuthType is a field of KokuMetricsConfig to represent + the authentication type to be used basic or token. Valid values + are: - "basic" : Enables authentication using user and password + from authentication secret. - "token" (default): Uses cluster + token for authentication.' + enum: + - token + - basic + type: string + required: + - type + type: object + clusterID: + description: ClusterID is a field of KokuMetricsConfig to represent + the cluster UUID. Normally this value should not be specified. Only + set this value if the clusterID cannot be obtained from the ClusterVersion. + type: string + clusterVersion: + description: ClusterVersion is a field of KokuMetricsConfig to represent + the cluster version. Normally this value should not be specified. + Only set this value if the clusterVersion cannot be obtained from + the ClusterVersion. + type: string + packaging: + description: Packaging is a field of KokuMetricsConfig to represent + the packaging object. + properties: + max_reports_to_store: + default: 30 + description: MaxReports is a field of KokuMetricsConfig to represent + the maximum number of reports to store. The default is 30 reports + which corresponds to approximately 7 days worth of data given + the other default values. + format: int64 + minimum: 1 + type: integer + max_size_MB: + default: 100 + description: MaxSize is a field of KokuMetricsConfig to represent + the max file size in megabytes that will be compressed for upload + to Ingress. The default is 100. + format: int64 + maximum: 100 + minimum: 1 + type: integer + required: + - max_reports_to_store + - max_size_MB + type: object + prometheus_config: + description: PrometheusConfig is a field of KokuMetricsConfig to represent + the configuration of Prometheus connection. + properties: + context_timeout: + default: 120 + description: ContextTimeout is a field of KokuMetricsConfig to + represent how long a query to prometheus should run in seconds + before timing out. The default is 120 seconds. + format: int64 + maximum: 180 + minimum: 10 + type: integer + service_address: + default: https://thanos-querier.openshift-monitoring.svc:9091 + description: FOR DEVELOPMENT ONLY. SvcAddress is a field of KokuMetricsConfig + to represent the thanos-querier address. The default is `https://thanos-querier.openshift-monitoring.svc:9091`. + type: string + skip_tls_verification: + default: false + description: FOR DEVELOPMENT ONLY. SkipTLSVerification is a field + of KokuMetricsConfig to represent if the thanos-querier endpoint + must be certificate validated. The default is false. + type: boolean + required: + - service_address + - skip_tls_verification + type: object + source: + description: Source is a field of KokuMetricsConfig to represent the + desired source on cloud.redhat.com. + properties: + check_cycle: + default: 1440 + description: CheckCycle is a field of KokuMetricsConfig to represent + the number of minutes between each source check schedule The + default is 1440 min (24 hours). + format: int64 + minimum: 0 + type: integer + create_source: + default: false + description: CreateSource is a field of KokuMetricsConfigSpec + to represent if the source should be created if not found. + type: boolean + name: + description: SourceName is a field of KokuMetricsConfigSpec to + represent the source name on cloud.redhat.com. + type: string + sources_path: + default: /api/sources/v1.0/ + description: FOR DEVELOPMENT ONLY. SourcesAPIPath is a field of + KokuMetricsConfig to represent the path of the Sources API service. + The default is `/api/sources/v1.0/`. + type: string + required: + - check_cycle + - create_source + - sources_path + type: object + upload: + description: Upload is a field of KokuMetricsConfig to represent the + upload object. + properties: + ingress_path: + default: /api/ingress/v1/upload + description: FOR DEVELOPMENT ONLY. IngressAPIPath is a field of + KokuMetricsConfig to represent the path of the Ingress API service. + The default is `/api/ingress/v1/upload`. + type: string + upload_cycle: + default: 360 + description: UploadCycle is a field of KokuMetricsConfig to represent + the number of minutes between each upload schedule. The default + is 360 min (6 hours). + format: int64 + minimum: 0 + type: integer + upload_toggle: + default: true + description: UploadToggle is a field of KokuMetricsConfig to represent + if the operator is installed in a restricted-network. If `false`, + the operator will not upload to cloud.redhat.com or check/create + sources. The default is true. + type: boolean + upload_wait: + description: UploadWait is a field of KokuMetricsConfig to represent + the time to wait before sending an upload. + format: int64 + minimum: 0 + type: integer + validate_cert: + default: true + description: ValidateCert is a field of KokuMetricsConfig to represent + if the Ingress endpoint must be certificate validated. + type: boolean + required: + - ingress_path + - upload_cycle + - upload_toggle + - validate_cert + type: object + volume_claim_template: + description: VolumeClaimTemplate is a field of KokuMetricsConfig to + represent a PVC template. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + description: EmbeddedMetadata contains metadata relevant to an + EmbeddedResource. + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + http://kubernetes.io/docs/user-guide/annotations' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. May + match selectors of replication controllers and services. + More info: http://kubernetes.io/docs/user-guide/labels' + type: object + name: + description: 'Name must be unique within a namespace. Is required + when creating resources, although some resources may allow + a client to request the generation of an appropriate name + automatically. Name is primarily intended for creation idempotence + and configuration definition. Cannot be updated. More info: + http://kubernetes.io/docs/user-guide/identifiers#names' + type: string + type: object + spec: + description: 'Spec defines the desired characteristics of a volume + requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + properties: + accessModes: + description: 'AccessModes contains the desired access modes + the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + items: + type: string + type: array + dataSource: + description: 'This field can be used to specify either: * + An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) * An existing + custom resource that implements data population (Alpha) + In order to use custom resource types that implement data + population, the AnyVolumeDataSource feature gate must be + enabled. If the provisioner or an external controller can + support the specified data source, it will create a new + volume based on the contents of the specified data source.' + properties: + apiGroup: + description: APIGroup is the group for the resource being + referenced. If APIGroup is not specified, the specified + Kind must be in the core API group. For any other third-party + types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + resources: + description: 'Resources represents the minimum resources the + volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of + compute resources required. If Requests is omitted for + a container, it defaults to Limits if that is explicitly + specified, otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + type: object + selector: + description: A label query over volumes to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + storageClassName: + description: 'Name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + type: string + volumeMode: + description: volumeMode defines what type of volume is required + by the claim. Value of Filesystem is implied when not included + in claim spec. + type: string + volumeName: + description: VolumeName is the binding reference to the PersistentVolume + backing this claim. + type: string + type: object + type: object + required: + - authentication + - packaging + - prometheus_config + - source + - upload + type: object + status: + description: KokuMetricsConfigStatus defines the observed state of KokuMetricsConfig. + properties: + api_url: + description: APIURL is a field of KokuMetricsConfig to represent the + url of the API endpoint for service interaction. + type: string + authentication: + description: Authentication is a field of KokuMetricsConfig to represent + the authentication status. + properties: + credentials_found: + description: AuthenticationCredentialsFound is a field of KokuMetricsConfig + to represent if used for uploads were found. + type: boolean + error: + description: AuthErrorMessage is a field of KokuMetricsConfig + to represent an `invalid credentials` error message. + type: string + last_credential_verification_time: + description: LastVerificationTime is a field of KokuMetricsConfig + to represent the last time credentials were verified. + format: date-time + nullable: true + type: string + secret_name: + description: AuthenticationSecretName is a field of KokuMetricsConfig + to represent the secret with the user and password used for + uploads. + type: string + type: + description: AuthType is a field of KokuMetricsConfig to represent + the authentication type to be used basic or token. + enum: + - token + - basic + type: string + valid_basic_auth: + description: ValidBasicAuth is a field of KokuMetricsConfig to + represent if the given basic auth credentials are valid. + type: boolean + type: object + clusterID: + description: ClusterID is a field of KokuMetricsConfig to represent + the cluster UUID. + type: string + clusterVersion: + description: ClusterVersion is a field of KokuMetricsConfig to represent + the cluster version. + type: string + operator_commit: + description: OperatorCommit is a field of KokuMetricsConfig that shows + the commit hash of the operator. + type: string + packaging: + description: Packaging is a field of KokuMetricsConfig to represent + the packaging status + properties: + error: + description: PackagingError is a field of KokuMetricsConfig to + represent the error encountered packaging the reports. + type: string + last_successful_packaging_time: + description: LastSuccessfulPackagingTime is a field of KokuMetricsConfig + that shows the time of the last successful file packaging. + format: date-time + nullable: true + type: string + max_reports_to_store: + description: MaxReports is a field of KokuMetricsConfig to represent + the maximum number of reports to store. + format: int64 + type: integer + max_size_MB: + description: MaxSize is a field of KokuMetricsConfig to represent + the max file size in megabytes that will be compressed for upload + to Ingress. + format: int64 + type: integer + number_reports_stored: + description: ReportCount is a field of KokuMetricsConfig to represent + the number of reports in storage. + format: int64 + type: integer + packaged_files: + description: PackagedFiles is a field of KokuMetricsConfig to + represent the list of file packages in storage. + items: + type: string + type: array + type: object + persistent_volume_claim: + description: PersistentVolumeClaim is a field of KokuMetricsConfig + to represent a PVC. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + description: EmbeddedMetadata contains metadata relevant to an + EmbeddedResource. + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + http://kubernetes.io/docs/user-guide/annotations' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. May + match selectors of replication controllers and services. + More info: http://kubernetes.io/docs/user-guide/labels' + type: object + name: + description: 'Name must be unique within a namespace. Is required + when creating resources, although some resources may allow + a client to request the generation of an appropriate name + automatically. Name is primarily intended for creation idempotence + and configuration definition. Cannot be updated. More info: + http://kubernetes.io/docs/user-guide/identifiers#names' + type: string + type: object + spec: + description: 'Spec defines the desired characteristics of a volume + requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + properties: + accessModes: + description: 'AccessModes contains the desired access modes + the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + items: + type: string + type: array + dataSource: + description: 'This field can be used to specify either: * + An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) * An existing + custom resource that implements data population (Alpha) + In order to use custom resource types that implement data + population, the AnyVolumeDataSource feature gate must be + enabled. If the provisioner or an external controller can + support the specified data source, it will create a new + volume based on the contents of the specified data source.' + properties: + apiGroup: + description: APIGroup is the group for the resource being + referenced. If APIGroup is not specified, the specified + Kind must be in the core API group. For any other third-party + types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + resources: + description: 'Resources represents the minimum resources the + volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of + compute resources required. If Requests is omitted for + a container, it defaults to Limits if that is explicitly + specified, otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + type: object + selector: + description: A label query over volumes to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + storageClassName: + description: 'Name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + type: string + volumeMode: + description: volumeMode defines what type of volume is required + by the claim. Value of Filesystem is implied when not included + in claim spec. + type: string + volumeName: + description: VolumeName is the binding reference to the PersistentVolume + backing this claim. + type: string + type: object + type: object + prometheus: + description: Prometheus represents the status of premetheus queries. + properties: + configuration_error: + description: ConfigError is a field of KokuMetricsConfigStatus + to represent errors during prometheus configuration. + type: string + context_timeout: + description: ContextTimeout is a field of KokuMetricsConfigState + to represent how long a query to prometheus should run in seconds + before timing out. + format: int64 + type: integer + last_query_start_time: + description: LastQueryStartTime is a field of KokuMetricsConfigStatus + to represent the last time queries were started. + format: date-time + nullable: true + type: string + last_query_success_time: + description: LastQuerySuccessTime is a field of KokuMetricsConfigStatus + to represent the last time queries were successful. + format: date-time + nullable: true + type: string + prometheus_configured: + description: PrometheusConfigured is a field of KokuMetricsConfigStatus + to represent if the operator is configured to connect to prometheus. + type: boolean + prometheus_connected: + description: PrometheusConnected is a field of KokuMetricsConfigStatus + to represent if prometheus can be queried. + type: boolean + prometheus_connection_error: + description: ConnectionError is a field of KokuMetricsConfigStatus + to represent errors during prometheus test query. + type: string + service_address: + description: SvcAddress is the internal thanos-querier address. + type: string + skip_tls_verification: + description: SkipTLSVerification is a field of KokuMetricsConfigStatus + to represent if the thanos-querier endpoint must be certificate + validated. + type: boolean + required: + - prometheus_configured + - prometheus_connected + type: object + reports: + description: Reports represents the status of report generation. + properties: + data_collected: + description: DataCollected is a field of KokuMetricsConfigStatus + to represent whether or not data was collected for the last + query. + type: boolean + data_collection_message: + description: DataCollectionMessage is a field of KokuMetricsConfigStatus + to represent a message associated with the data_collected status. + type: string + last_hour_queried: + description: LastHourQueried is a field of KokuMetricsConfigStatus + to represent the time range for which metrics were last queried. + type: string + report_month: + description: ReportMonth is a field of KokuMetricsConfigStatus + to represent the month for which reports are being generated. + type: string + type: object + source: + description: Source is a field of KokuMetricsConfig to represent the + observed state of the source on cloud.redhat.com. + properties: + check_cycle: + description: CheckCycle is a field of KokuMetricsConfig to represent + the number of minutes between each source check schedule. The + default is 1440 min (24 hours). + format: int64 + type: integer + create_source: + description: CreateSource is a field of KokuMetricsConfigStatus + to represent if the source should be created if not found. A + source will not be created if upload_toggle is `false`. + type: boolean + error: + description: SourceError is a field of KokuMetricsConfigStatus + to represent the error encountered creating the source. + type: string + last_check_time: + description: LastSourceCheckTime is a field of KokuMetricsConfig + that shows the time that the last check was attempted. + format: date-time + nullable: true + type: string + name: + description: SourceName is a field of KokuMetricsConfigStatus + to represent the source name on cloud.redhat.com. + type: string + source_defined: + description: SourceDefined is a field of KokuMetricsConfigStatus + to represent if the source exists as defined on cloud.redhat.com. + type: boolean + sources_path: + description: SourcesAPIPath is a field of KokuMetricsConfig to + represent the path of the Sources API service. + type: string + type: object + storage: + description: Storage is a field + properties: + volume_mounted: + description: VolumeMounted is a bool to indicate if storage volume + was mounted. + type: boolean + volume_type: + description: VolumeType is the string representation of the volume + type. + type: string + type: object + upload: + description: Upload is a field of KokuMetricsConfig to represent the + upload object. + properties: + error: + description: UploadError is a field of KokuMetricsConfigStatus + to represent the error encountered uploading reports. + type: string + ingress_path: + description: IngressAPIPath is a field of KokuMetricsConfig to + represent the path of the Ingress API service. + type: string + last_payload_files: + description: LastPayloadFiles is a field of KokuMetricsConfig + to represent the list of files in the last payload that was + sent. + items: + type: string + type: array + last_payload_manifest_id: + description: LastPayloadManifest is a field of KokuMetricsConfig + that shows the manifestID of the last payload. + type: string + last_payload_name: + description: LastPayloadName is a field of KokuMetricsConfig that + shows the name of the last payload file. + type: string + last_payload_request_id: + description: LastPayloadRequestID is a field of KokuMetricsConfig + that shows the insights request id of the last payload. + type: string + last_successful_upload_time: + description: LastSuccessfulUploadTime is a field of KokuMetricsConfig + that shows the time of the last successful upload. + format: date-time + nullable: true + type: string + last_upload_status: + description: LastUploadStatus is a field of KokuMetricsConfig + that shows the http status of the last upload. + type: string + upload: + description: UploadToggle is a field of KokuMetricsConfig to represent + if the operator should upload to cloud.redhat.com. The default + is true + type: boolean + upload_cycle: + description: UploadCycle is a field of KokuMetricsConfig to represent + the number of minutes between each upload schedule. The default + is 360 min (6 hours). + format: int64 + type: integer + upload_wait: + description: UploadWait is a field of KokuMetricsConfig to represent + the time to wait before sending an upload. + format: int64 + type: integer + validate_cert: + description: ValidateCert is a field of KokuMetricsConfig to represent + if the Ingress endpoint must be certificate validated. + type: boolean + type: object + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/koku-metrics-operator/1.1.7/manifests/koku-metrics-operator.clusterserviceversion.yaml b/koku-metrics-operator/1.1.7/manifests/koku-metrics-operator.clusterserviceversion.yaml new file mode 100644 index 000000000..3934e9072 --- /dev/null +++ b/koku-metrics-operator/1.1.7/manifests/koku-metrics-operator.clusterserviceversion.yaml @@ -0,0 +1,471 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + alm-examples: |- + [ + { + "apiVersion": "koku-metrics-cfg.openshift.io/v1beta1", + "kind": "KokuMetricsConfig", + "metadata": { + "name": "kokumetricscfg-sample-v1beta1" + }, + "spec": { + "authentication": { + "type": "token" + }, + "packaging": { + "max_reports_to_store": 30, + "max_size_MB": 100 + }, + "prometheus_config": {}, + "source": { + "check_cycle": 1440, + "create_source": false, + "name": "INSERT-SOURCE-NAME" + }, + "upload": { + "upload_cycle": 360, + "upload_toggle": true + } + } + } + ] + capabilities: Seamless Upgrades + categories: Monitoring + certified: "false" + containerImage: quay.io/project-koku/koku-metrics-operator@sha256:4bebd4f6a2bc65732c2d9b488931669312669387b196e64ef0c0afb4180d2c3f + createdAt: "2022-07-05T16:48:40Z" + description: A Golang-based OpenShift Operator that generates and uploads OpenShift + usage metrics to cost management. + operatorframework.io/suggested-namespace: koku-metrics-operator + operators.openshift.io/infrastructure-features: '["Disconnected"]' + operators.operatorframework.io/builder: operator-sdk-v1.10.0+git + operators.operatorframework.io/project_layout: go.kubebuilder.io/v2 + repository: https://github.com/project-koku/koku-metrics-operator + support: Cost Management + name: koku-metrics-operator.v1.1.7 + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - description: KokuMetricsConfig is the Schema for the kokumetricsconfig API + displayName: Koku Metrics Config + kind: KokuMetricsConfig + name: kokumetricsconfigs.koku-metrics-cfg.openshift.io + version: v1beta1 + description: |- + # Koku Metrics Operator + ## Introduction + The `koku-metrics-operator` is a component of the [cost managment](https://access.redhat.com/documentation/en-us/cost_management_service) service for Openshift, used to gather the required information from the cluster. It is recommended to be installed in OpenShift 4.5+. This operator obtains OpenShift usage data by querying Prometheus and uploads it to cost management to be processed. The Operator queries Prometheus every hour to create metric reports, which are then packaged and uploaded to cost management at [console.redhat.com](https://console.redhat.com). For more information, reach out to . + + This operator is capable of functioning within a disconnected/restricted network (aka air-gapped mode). In this mode, the operator will store the packaged reports for manual retrieval instead of being uploaded to cost management. Documentation for installing an operator within a restricted network can be found [here](https://docs.openshift.com/container-platform/latest/operators/admin/olm-restricted-networks.html). + + ## Features and Capabilities + #### Metrics collection: + The Koku Metrics Operator (`koku-metrics-operator`) collects the metrics required for cost management by: + * Querying Prometheus to gather the necessary metrics for cost management. + * Writing Prometheus queries to CSV report files. + * Packaging the CSV report files into tarballs. + + #### Additional Capabilities: + * The operator can be configured to automatically upload the packaged reports to cost management through Red Hat Insights Ingress service. + * The operator can create a source in console.redhat.com. A source is required for cost management to process the uploaded packages. + * PersistentVolumeClaim (PVC) configuration: The KokuMetricsConfig CR can accept a PVC definition and the operator will create and mount the PVC. If one is not provided, a default PVC will be created. + * Restricted network installation: this operator can function on a restricted network. In this mode, the operator stores the packaged reports for manual retrieval. + + ## Limitations and Pre-Requisites + #### Limitations (Potential for metrics data loss) + * A source **must** exist in console.redhat.com for an uploaded payload to be processed by cost management. The operator sends the payload to the Red Hat Insights Ingress service which usually returns successfully, but the operator does not currently confirm with cost management that the payload was processed. After Ingress accepts the uploaded payload, the payload is removed from the operator and is gone forever. If the data within the payload is not processed, a gap will be introduced in the usage metrics. + + **Note** The following limitations are specific to operators configured to run in a restricted network: + * The `koku-metrics-operator` will not be able to generate new reports if the PVC storage is filled. If this occurs, the reports must be manually deleted from the PVC so that the operator can function as normal. + * The default report retention is 30 reports (about one week's worth of data). The reports must be manually downloaded and uploaded to console.redhat.com every week, or they will be deleted and the data will be lost. + + #### Storage configuration prerequisite + The operator will attempt to create and use the following PVC when installed: + + volume_claim_template: + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: koku-metrics-operator-data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + + If a different PVC should be utilized, a valid PVC should be specified in the KokuMetricsConfig CR as described in the appropriate section below. The PVC to be used may exist already, or the operator will attempt to create it. + + To use the default specification, the follow assumptions must be met: + 1. A default StorageClass is defined. + 2. Dynamic provisioning for that default StorageClass is enabled. + + If these assumptions are not met, the operator will not deploy correctly. In these cases, storage must be manually configured. After configuring storage, a valid PVC template should be supplied in the `volume_claim_template` spec of the KokuMetricsConfig CR. + + ## Configure the koku-metrics-operator + **Note** There are separate instructions for configuring the `koku-metrics-operator` to run in a restricted network. + ##### Configure authentication + The default authentication for the operator is `token`. No further steps are required to configure token authentication. If `basic` is the preferred authentication method, a Secret must be created which holds username and password credentials: + 1. On the left navigation pane, select `Workloads` -> `Secrets` -> select Project: `koku-metrics-operator` -> `Create` -> `Key/Value Secret` + 2. Give the Secret a name and add 2 keys: `username` and `password` (all lowercase). The values for these keys correspond to console.redhat.com credentials. + 3. Select `Create`. + ##### Create the KokuMetricsConfig + Configure the koku-metrics-operator by creating a `KokuMetricsConfig`. + 1. On the left navigation pane, select `Operators` -> `Installed Operators` -> `koku-metrics-operator` -> `KokuMetricsConfig` -> `Create Instance`. + 2. For `basic` authentication, edit the following values in the spec: + * Replace `authentication: type:` with `basic`. + * Add the `secret_name` field under `authentication`, and set it equal to the name of the authentication Secret that was created above. The spec should look similar to the following: + + ``` + authentication: + secret_name: SECRET-NAME + type: basic + ``` + + 3. To configure the koku-metrics-operator to create a cost management source, edit the following values in the `source` field: + * Replace `INSERT-SOURCE-NAME` with the preferred name of the source to be created. + * Replace the `create_source` field value with `true`. + + **Note:** if the source already exists, replace `INSERT-SOURCE-NAME` with the existing name, and leave `create_source` as false. This will allow the operator to confirm the source exists. + 4. If not specified, the operator will create a default PersistentVolumeClaim called `koku-metrics-operator-data` with 10Gi of storage. To configure the koku-metrics-operator to use or create a different PVC, edit the following in the spec: + * Add the desired configuration to the `volume_claim_template` field in the spec: + + ``` + volume_claim_template: + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + ``` + + **Note:** If using the YAML View, the `volume_claim_template` field must be added to the spec + 5. Select `Create`. + + # Restricted Network Usage (disconnected/air-gapped mode) + ## Installation + To install the `koku-metrics-operator` in a restricted network, follow the [olm documentation](https://docs.openshift.com/container-platform/latest/operators/admin/olm-restricted-networks.html). The operator is found in the `community-operators` Catalog in the `registry.redhat.io/redhat/community-operator-index:latest` Index. If pruning the index before pushing to the mirrored registry, keep the `koku-metrics-operator` package. + + Within a restricted network, the operator queries prometheus to gather the necessary usage metrics, writes the query results to CSV files, and packages the reports for storage in the PVC. These reports then need to be manually downloaded from the cluster and uploaded to [console.redhat.com](https://console.redhat.com). + + ## Configure the koku-metrics-operator for a restricted network + ##### Create the KokuMetricsConfig + Configure the koku-metrics-operator by creating a `KokuMetricsConfig`. + 1. On the left navigation pane, select `Operators` -> `Installed Operators` -> `koku-metrics-operator` -> `KokuMetricsConfig` -> `Create Instance`. + 2. Specify the desired storage. If not specified, the operator will create a default Persistent Volume Claim called `koku-metrics-operator-data` with 10Gi of storage. To configure the koku-metrics-operator to use or create a different PVC, edit the following in the spec: + * Add the desired configuration to the `volume_claim_template` field in the spec: + + ``` + volume_claim_template: + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: + spec: + storageClassName: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + ``` + + **Note:** If using the YAML View, the `volume_claim_template` field must be added to the spec + 3. (Optional) Specify the desired report retention. The operator will retain 30 reports by default. This corresponds to approximately one week's worth of data if using the default packaging cycle. To modify the number of retained reports: + * Change the `packaging` spec field `max_reports_to_store` to the desired number of reports to retain. Once this max number is reached, the operator will start removing the oldest packages remaining on the PVC: + + ``` + packaging: + max_size_MB: 100 + max_reports_to_store: 30 + ``` + + **Note:** The number of retained reports directly affects the frequency that reports must be manually downloaded from the PVC. Take caution in setting this to a higher number of reports, as the operator cannot write data to the PVC if the storage is full. + 4. To configure the operator to perform in a restricted network, set the `upload_toggle` to `false`: + + ``` + upload: + upload_cycle: 360, + upload_toggle: false + ``` + + 5. Select `Create`. + + ## Download reports from the Operator & clean up the PVC + If the `koku-metrics-operator` is configured to run in a restricted network, the metric reports will not automatically upload to cost managment. Instead, they need to be manually copied from the PVC for upload to [console.redhat.com](https://console.redhat.com). The default configuration saves one week of reports which means the process of downloading and uploading reports should be repeated weekly to prevent loss of metrics data. To download the reports, complete the following steps: + 1. Create the following Pod, ensuring the `claimName` matches the PVC containing the report data: + + ``` + kind: Pod + apiVersion: v1 + metadata: + name: volume-shell + namespace: koku-metrics-operator + labels: + app: koku-metrics-operator + spec: + volumes: + - name: koku-metrics-operator-reports + persistentVolumeClaim: + claimName: koku-metrics-operator-data + containers: + - name: volume-shell + image: busybox + command: ['sleep', 'infinity'] + volumeMounts: + - name: koku-metrics-operator-reports + mountPath: /tmp/koku-metrics-operator-reports + ``` + + 2. Use rsync to copy all of the files ready for upload from the PVC to a local folder: + + ``` + $ oc rsync volume-shell:/tmp/koku-metrics-operator-reports/upload local/path/to/save/folder + ``` + + 3. Once confirming that the files have been successfully copied, use rsh to connect to the pod and delete the contents of the upload folder so that they are no longer in storage: + + ``` + $ oc rsh volume-shell + $ rm /tmp/koku-metrics-operator-reports/upload/* + ``` + + 4. (Optional) Delete the pod that was used to connect to the PVC: + + ``` + $ oc delete -f volume-shell.yaml + ``` + + ## Create a source + In a restricted network, the `koku-metrics-operator` cannot automatically create a source. This process must be done manually. In the console.redhat.com platform, open the [Sources menu](https://console.redhat.com/settings/sources/) to begin adding an OpenShift source to cost management: + + Prerequisites: + * The cluster identifier which can be found in the KokuMetricsConfig CR, the cluster Overview page, or the cluster Help > About. + + Create source: + 1. Navigate to the Sources menu + 2. Select the `Red Hat sources` tab + 3. Create a new `Red Hat Openshift Container Platform` source: + * give the source a unique name + * add the Cost Management application + * add the cluster identifier + 4. In the Sources wizard, review the details and click `Finish` to create the Source. + + ## Upload the reports to cost managment + Uploading reports to cost managment is done through curl: + + $ curl -vvvv -F "file=@FILE_NAME.tar.gz;type=application/vnd.redhat.hccm.tar+tgz" https://cloud.redhat.com/api/ingress/v1/upload -u USERNAME:PASS + + where `USERNAME` and `PASS` correspond to the user credentials for [console.redhat.com](https://console.redhat.com), and `FILE_NAME` is the name of the report to upload. + + displayName: Koku Metrics Operator + icon: + - base64data: PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIyLjE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jY0OTY3MzUtMC45NzY4MjE5LDEuNDc0NDQxNS0wLjk3NjgyMTksMi40NjUwODc5YzAsMC42ODY1NTQsMC4yMzAzOTI1LDEuMzM2MjEyMiwwLjY5MTE0NjksMS45NDkwMzU2CgkJCWMwLjQ1NjE2MTUsMC42MTI4MjM1LDEuMDMyMTE5OCwxLjAzMjExOTgsMS43MTg2NTg0LDEuMjYyNDk2OUwxNzQuMjgwNjM5NiwxODUuODczNjExNXoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K + mediatype: image/svg+xml + install: + spec: + clusterPermissions: + - rules: + - apiGroups: + - config.openshift.io + resources: + - clusterversions + verbs: + - get + - list + - watch + - apiGroups: + - "" + resources: + - namespaces + verbs: + - get + - list + - watch + - apiGroups: + - "" + resources: + - secrets + verbs: + - get + serviceAccountName: koku-metrics-controller-manager + deployments: + - name: koku-metrics-operator + spec: + replicas: 1 + selector: + matchLabels: + app: koku-metrics-operator + control-plane: controller-manager + strategy: {} + template: + metadata: + labels: + app: koku-metrics-operator + control-plane: controller-manager + spec: + containers: + - args: + - --enable-leader-election + command: + - /manager + env: + - name: IN_CLUSTER + value: "true" + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.annotations['olm.targetNamespaces'] + image: quay.io/project-koku/koku-metrics-operator@sha256:4bebd4f6a2bc65732c2d9b488931669312669387b196e64ef0c0afb4180d2c3f + name: manager + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 100m + memory: 20Mi + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /tmp/koku-metrics-operator-reports + name: koku-metrics-operator-reports + serviceAccountName: koku-metrics-controller-manager + terminationGracePeriodSeconds: 10 + volumes: + - name: koku-metrics-operator-reports + permissions: + - rules: + - apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete + - apiGroups: + - "" + resources: + - configmaps/status + verbs: + - get + - update + - patch + - apiGroups: + - "" + resources: + - events + verbs: + - create + - patch + - apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete + - apiGroups: + - apps + resources: + - deployments + verbs: + - get + - list + - patch + - watch + - apiGroups: + - "" + resources: + - configmaps + - endpoints + - events + - persistentvolumeclaims + - pods + - secrets + - serviceaccounts + - services + - services/finalizers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - koku-metrics-cfg.openshift.io + resources: + - kokumetricsconfigs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - koku-metrics-cfg.openshift.io + resources: + - kokumetricsconfigs/status + verbs: + - get + - patch + - update + - apiGroups: + - operators.coreos.com + resources: + - clusterserviceversions + verbs: + - get + - list + - patch + - update + - watch + serviceAccountName: koku-metrics-controller-manager + strategy: deployment + installModes: + - supported: true + type: OwnNamespace + - supported: true + type: SingleNamespace + - supported: false + type: MultiNamespace + - supported: false + type: AllNamespaces + relatedImages: + - name: koku-metrics-operator + image: quay.io/project-koku/koku-metrics-operator@sha256:4bebd4f6a2bc65732c2d9b488931669312669387b196e64ef0c0afb4180d2c3f + keywords: + - cost + - management + - usage + - monitor + maintainers: + - email: costmanagement@redhat.com + name: costmanagement + maturity: alpha + provider: + name: Red Hat + replaces: koku-metrics-operator.v1.1.6 + version: 1.1.7 diff --git a/koku-metrics-operator/1.1.7/metadata/annotations.yaml b/koku-metrics-operator/1.1.7/metadata/annotations.yaml new file mode 100644 index 000000000..5e2f30385 --- /dev/null +++ b/koku-metrics-operator/1.1.7/metadata/annotations.yaml @@ -0,0 +1,15 @@ +annotations: + # Core bundle annotations. + operators.operatorframework.io.bundle.mediatype.v1: registry+v1 + operators.operatorframework.io.bundle.manifests.v1: manifests/ + operators.operatorframework.io.bundle.metadata.v1: metadata/ + operators.operatorframework.io.bundle.package.v1: koku-metrics-operator + operators.operatorframework.io.bundle.channels.v1: alpha,beta + operators.operatorframework.io.bundle.channel.default.v1: beta + operators.operatorframework.io.metrics.builder: operator-sdk-v1.10.0+git + operators.operatorframework.io.metrics.mediatype.v1: metrics+v1 + operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v2 + + # Annotations for testing. + operators.operatorframework.io.test.mediatype.v1: scorecard+v1 + operators.operatorframework.io.test.config.v1: tests/scorecard/ diff --git a/koku-metrics-operator/1.1.7/tests/scorecard/config.yaml b/koku-metrics-operator/1.1.7/tests/scorecard/config.yaml new file mode 100644 index 000000000..e2d83b262 --- /dev/null +++ b/koku-metrics-operator/1.1.7/tests/scorecard/config.yaml @@ -0,0 +1,28 @@ +apiVersion: scorecard.operatorframework.io/v1alpha3 +kind: Configuration +metadata: + name: config +stages: +- parallel: true + tests: + - entrypoint: + - scorecard-test + - basic-check-spec + image: quay.io/operator-framework/scorecard-test:v1.10.1 + labels: + suite: basic + test: basic-check-spec-test + - entrypoint: + - scorecard-test + - olm-bundle-validation + image: quay.io/operator-framework/scorecard-test:v1.10.1 + labels: + suite: olm + test: olm-bundle-validation-test + - entrypoint: + - scorecard-test + - olm-crds-have-validation + image: quay.io/operator-framework/scorecard-test:v1.10.1 + labels: + suite: olm + test: olm-crds-have-validation-test From ccc78b4fd4b63a6cb1516574d5e38a9b1078ea16 Mon Sep 17 00:00:00 2001 From: Michael Skarbek Date: Thu, 6 Oct 2022 15:51:11 -0400 Subject: [PATCH 4/4] [COST-2285] - update prometheus queries for many-to-many matching error (#148) --- collector/queries.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/collector/queries.go b/collector/queries.go index f3fa4f52e..3c76575c4 100644 --- a/collector/queries.go +++ b/collector/queries.go @@ -127,7 +127,7 @@ var ( podQueries = &querys{ query{ Name: "pod-limit-cpu-cores", - QueryString: "sum(kube_pod_container_resource_limits{resource='cpu',namespace!='',node!='',pod!=''} * on(pod, namespace) group_left kube_pod_status_phase{phase='Running'}) without (container, instance, uid)", + QueryString: "sum by (namespace, node, pod) (kube_pod_container_resource_limits{resource='cpu',namespace!='',node!='',pod!=''} * on(namespace, pod) group_left() max by (namespace, pod) (kube_pod_status_phase{phase='Running'}))", MetricKey: staticFields{"pod": "pod", "namespace": "namespace", "node": "node"}, QueryValue: &saveQueryValue{ ValName: "pod-limit-cpu-cores", @@ -139,7 +139,7 @@ var ( }, query{ Name: "pod-limit-memory-bytes", - QueryString: "sum(kube_pod_container_resource_limits{resource='memory',namespace!='',node!='',pod!=''} * on(pod, namespace) group_left kube_pod_status_phase{phase='Running'}) without (container, instance, uid)", + QueryString: "sum by (namespace, node, pod) (kube_pod_container_resource_limits{resource='memory',namespace!='',node!='',pod!=''} * on(namespace, pod) group_left() max by (namespace, pod) (kube_pod_status_phase{phase='Running'}))", MetricKey: staticFields{"pod": "pod", "namespace": "namespace", "node": "node"}, QueryValue: &saveQueryValue{ ValName: "pod-limit-memory-bytes", @@ -151,7 +151,7 @@ var ( }, query{ Name: "pod-request-cpu-cores", - QueryString: "sum(kube_pod_container_resource_requests{resource='cpu',namespace!='',node!='',pod!=''} * on(pod, namespace) group_left kube_pod_status_phase{phase='Running'}) without (container, instance, uid)", + QueryString: "sum by (namespace, node, pod) (kube_pod_container_resource_requests{resource='cpu',namespace!='',node!='',pod!=''} * on(namespace, pod) group_left() max by (namespace, pod) (kube_pod_status_phase{phase='Running'}))", MetricKey: staticFields{"pod": "pod", "namespace": "namespace", "node": "node"}, QueryValue: &saveQueryValue{ ValName: "pod-request-cpu-cores", @@ -163,7 +163,7 @@ var ( }, query{ Name: "pod-request-memory-bytes", - QueryString: "sum(kube_pod_container_resource_requests{resource='memory',namespace!='',node!='',pod!=''} * on(pod, namespace) group_left kube_pod_status_phase{phase='Running'}) without (container, instance, uid)", + QueryString: "sum by (namespace, node, pod) (kube_pod_container_resource_requests{resource='memory',namespace!='',node!='',pod!=''} * on(namespace, pod) group_left() max by (namespace, pod) (kube_pod_status_phase{phase='Running'}))", MetricKey: staticFields{"pod": "pod", "namespace": "namespace", "node": "node"}, QueryValue: &saveQueryValue{ ValName: "pod-request-memory-bytes", @@ -175,7 +175,7 @@ var ( }, query{ Name: "pod-usage-cpu-cores", - QueryString: "sum(rate(container_cpu_usage_seconds_total{container!='POD',container!='',namespace!='',node!='',pod!=''}[5m])) without (container, instance, uid)", + QueryString: "sum by (namespace, node, pod) (rate(container_cpu_usage_seconds_total{container!='POD',container!='',namespace!='',node!='',pod!=''}[5m]))", MetricKey: staticFields{"pod": "pod", "namespace": "namespace", "node": "node"}, QueryValue: &saveQueryValue{ ValName: "pod-usage-cpu-cores", @@ -187,7 +187,7 @@ var ( }, query{ Name: "pod-usage-memory-bytes", - QueryString: "sum(container_memory_usage_bytes{container!='POD',container!='',namespace!='',node!='',pod!=''}) without (container, instance, uid)", + QueryString: "sum by (namespace, node, pod) (container_memory_usage_bytes{container!='POD',container!='',namespace!='',node!='',pod!=''})", MetricKey: staticFields{"pod": "pod", "namespace": "namespace", "node": "node"}, QueryValue: &saveQueryValue{ ValName: "pod-usage-memory-bytes",