Skip to content

Commit

Permalink
Merge downstream v3 (#447)
Browse files Browse the repository at this point in the history
* update whats new in 3.3.0 (#360)

* update docs (#363)

* fix make downstream (#365)

* v3.3.0 bundle (#362)

* Bump library/golang from 1.22.3 to 1.22.5 (#372)

* Bump github.com/prometheus/common (#369)

* Bump docker/build-push-action from 5 to 6 in the ci-dependencies group (#368)

* [COST-5183] dont use csvReader.ReadAll to improve memory usage (#370)

* update go in go.mod to 1.22 (#373)

* Bump the testing-framework group with 2 updates (#374)

* Bump github.com/onsi/gomega in the testing-framework group (#375)

* Update badges (#384)

* update license badge

* clean up badges

* remove license badge

* Bump library/golang from 1.22.5 to 1.22.6 (#385)

* update whats new in 3.3.1 (#388)

* [COST-5377] update whats new in 3.3.1

* fix typo

* [COST-5390] Make downstream v3.3.1 (#391)

* make bundle for v3.3.1 (#389)

* [COST-5390] make downstream v3.3.1

* clean up directory name and version

* Update downstream v3.3.1 (#395)

* make bundle for v3.3.1 (#389)

* [COST-5390] make downstream v3.3.1

* clean up directory name and version

* [COST-5409] Specify correct toolchain version number in go.mod (#394)

* [COST-5409] Specify correct toolchain version number in go.mod

* use mirco version

* definitely use toolchain and not micro version

* address non-constant format string in call to fmt.Errorf

* update dockerfile

* add bundle assets

* clean up dockerfiles

---------

Co-authored-by: Michael Skarbek <mskarbek@redhat.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 27, 2024
1 parent 8c10aa0 commit 21e15a4
Show file tree
Hide file tree
Showing 187 changed files with 4,955 additions and 12,241 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
password: ${{ secrets.QUAY_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ internal/collector/test_files/test_reports/*
# VSCode
.vscode

bundle/
community-operators-prod/
bundle.Dockerfile


# Ignore python virtual env
Expand Down
45 changes: 19 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# Build the manager binary
FROM --platform=${BUILDPLATFORM:-linux/amd64} docker.io/library/golang:1.22.3 AS builder
ARG TARGETOS
ARG TARGETARCH
FROM --platform=${BUILDPLATFORM:-linux/amd64} brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.22 AS builder

USER root

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY vendor/ vendor/
Expand All @@ -20,29 +16,26 @@ COPY internal/ internal/
COPY .git .git
# Build
RUN GIT_COMMIT=$(git rev-list -1 HEAD) && \
echo " injecting GIT COMMIT: $GIT_COMMIT" && \
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GOFLAGS=-mod=vendor \
go build -ldflags "-w -s -X github.com/project-koku/koku-metrics-operator/internal/controller.GitCommit=$GIT_COMMIT" -a -o manager cmd/main.go
echo " injecting GIT COMMIT: $GIT_COMMIT" && \
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GOFLAGS=-mod=vendor \
go build -ldflags "-w -s -X github.com/project-koku/koku-metrics-operator/internal/controller.GitCommit=$GIT_COMMIT" -a -o manager cmd/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot

# For terminal access, use this image:
# FROM gcr.io/distroless/base:debug-nonroot

LABEL \
com.redhat.component="koku-metrics-operator-container" \
description="Koku Metrics Operator" \
io.k8s.description="Operator to deploy and manage instances of Koku Metrics" \
io.k8s.display-name="Koku Metrics Operator" \
io.openshift.tags="cost,cost-management,prometheus,servicetelemetry,operators" \
maintainer="Cost Management <cost-mgmt@redhat.com>" \
name="koku-metrics-operator" \
summary="Koku Metrics Operator"
FROM registry.redhat.io/ubi8/ubi-micro:latest AS base-env

WORKDIR /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
COPY --from=builder /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /etc/ssl/certs/ca-bundle.crt
COPY --from=builder /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt /etc/ssl/certs/ca-bundle.trust.crt

ENTRYPOINT ["/manager"]
LABEL \
com.redhat.component="costmanagement-metrics-operator-container" \
description="Red Hat Cost Management Metrics Operator" \
io.k8s.description="Operator to deploy and manage instances of Cost Management Metrics" \
io.k8s.display-name="Cost Management Metrics Operator" \
io.openshift.tags="cost,cost-management,prometheus,servicetelemetry,operators" \
maintainer="Cost Management <cost-mgmt@redhat.com>" \
name="costmanagement-metrics-operator" \
summary="Red Hat Cost Management Metrics Operator" \
version="3.3.1"

ENTRYPOINT ["/manager"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
PREVIOUS_VERSION ?= 3.2.1
VERSION ?= 3.3.0
PREVIOUS_VERSION ?= 3.3.0
VERSION ?= 3.3.1

MIN_KUBE_VERSION = 1.24.0
MIN_OCP_VERSION = 4.12
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# koku-metrics-operator

[![License: Apache-2.0](https://img.shields.io/github/license/project-koku/koku.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![Build and Publish Images](https://github.com/project-koku/koku-metrics-operator/actions/workflows/build-and-publish.yaml/badge.svg?branch=main)](https://github.com/project-koku/koku-metrics-operator/actions/workflows/build-and-publish.yaml)
[![Unit Tests](https://github.com/project-koku/koku-metrics-operator/workflows/Unit%20Tests/badge.svg)](https://github.com/project-koku/koku-metrics-operator/actions?query=branch%3Amain+workflow%3A%22Unit+Tests%22)
[![CI](https://github.com/project-koku/koku-metrics-operator/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/project-koku/koku-metrics-operator/actions/workflows/ci.yaml)
[![CI Manual](https://github.com/project-koku/koku-metrics-operator/actions/workflows/ci-manual.yaml/badge.svg?branch=main)](https://github.com/project-koku/koku-metrics-operator/actions/workflows/ci-manual.yaml)

## About

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=costmanagement-metrics-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.33.0
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.35.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4

# Copy files to locations specified by labels.
COPY manifests /manifests/
COPY metadata /metadata/
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/

# Openshift specific labels
LABEL io.k8s.display-name='Cost Management Metrics Operator'
Expand All @@ -31,4 +31,4 @@ LABEL com.redhat.openshift.versions='v4.12'
LABEL name=openshift/costmanagement-metrics-operator-bundle
LABEL maintainer='<costmanagement@redhat.com>'
LABEL summary='Operator required to upload metrics data to the cost management service in console.redhat.com.'
LABEL version=3.3.0
LABEL version=3.3.1
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ metadata:
capabilities: Seamless Upgrades
categories: Monitoring
certified: "true"
containerImage: registry-proxy.engineering.redhat.com/rh-osbs/costmanagement-metrics-operator:3.3.0
createdAt: "2024-05-31T16:16:46Z"
containerImage: registry-proxy.engineering.redhat.com/rh-osbs/costmanagement-metrics-operator:3.3.1
createdAt: "2024-08-12T20:58:49Z"
description: A Golang-based OpenShift Operator that generates and uploads OpenShift usage metrics to cost management.
features.operators.openshift.io/disconnected: "true"
features.operators.openshift.io/fips-compliant: "false"
Expand All @@ -51,7 +51,7 @@ metadata:
features.operators.openshift.io/token-auth-gcp: "false"
operatorframework.io/suggested-namespace: costmanagement-metrics-operator
operators.openshift.io/infrastructure-features: '["disconnected", "proxy-aware"]'
operators.operatorframework.io/builder: operator-sdk-v1.33.0
operators.operatorframework.io/builder: operator-sdk-v1.35.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
repository: https://github.com/project-koku/koku-metrics-operator
support: Red Hat
Expand All @@ -62,7 +62,7 @@ metadata:
operatorframework.io/arch.ppc64le: supported
operatorframework.io/arch.s390x: supported
operatorframework.io/os.linux: supported
name: costmanagement-metrics-operator.3.3.0
name: costmanagement-metrics-operator.3.3.1
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -95,6 +95,9 @@ spec:
* PersistentVolumeClaim (PVC) configuration: The CostManagementMetricsConfig 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.
## New in v3.3.1:
* Optimize memory usage when reading CSV files.
## New in v3.3.0:
* Storage reports now contain `node`, `csi_driver`, and `csi_volume_handle` fields.
* The PVC capacity is now populated using the `kube_persistentvolume_capacity_bytes` metric instead of `kubelet_volume_stats_capacity_bytes`.
Expand Down Expand Up @@ -445,7 +448,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.annotations['olm.targetNamespaces']
image: registry-proxy.engineering.redhat.com/rh-osbs/costmanagement-metrics-operator:3.3.0
image: registry-proxy.engineering.redhat.com/rh-osbs/costmanagement-metrics-operator:3.3.1
livenessProbe:
httpGet:
path: /healthz
Expand Down Expand Up @@ -609,5 +612,5 @@ spec:
minKubeVersion: 1.24.0
provider:
name: Red Hat
version: 3.3.0
replaces: costmanagement-metrics-operator.3.2.1
version: 3.3.1
replaces: costmanagement-metrics-operator.3.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ annotations:
operators.operatorframework.io.bundle.package.v1: costmanagement-metrics-operator
operators.operatorframework.io.bundle.channels.v1: stable
operators.operatorframework.io.bundle.channel.default.v1: stable
operators.operatorframework.io.metrics.builder: operator-sdk-v1.33.0
operators.operatorframework.io.metrics.builder: operator-sdk-v1.35.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v4
# OpenShift specific annotations.
Expand Down
3 changes: 3 additions & 0 deletions docs/csv-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ The CostManagement Metrics Operator (`costmanagement-metrics-operator`) collects
* PersistentVolumeClaim (PVC) configuration: The CostManagementMetricsConfig 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.

## New in v3.3.1:
* Optimize memory usage when reading CSV files.

## New in v3.3.0:
* Storage reports now contain `node`, `csi_driver`, and `csi_volume_handle` fields.
* The PVC capacity is now populated using the `kube_persistentvolume_capacity_bytes` metric instead of `kubelet_volume_stats_capacity_bytes`.
Expand Down
30 changes: 15 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
module github.com/project-koku/koku-metrics-operator

go 1.21
go 1.22
toolchain go1.22.5

require (
github.com/go-logr/logr v1.4.2
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/mitchellh/mapstructure v1.5.0
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/onsi/ginkgo/v2 v2.19.1
github.com/onsi/gomega v1.34.1
github.com/openshift/api v0.0.0-20231130134125-f6ae1072b499
github.com/operator-framework/api v0.23.0
github.com/prometheus/client_golang v1.19.1
github.com/prometheus/common v0.53.0
github.com/prometheus/common v0.55.0
go.uber.org/zap v1.27.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.29.3
Expand Down Expand Up @@ -51,22 +52,21 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.21.0 // indirect
golang.org/x/tools v0.23.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.29.2 // indirect
Expand Down
Loading

0 comments on commit 21e15a4

Please sign in to comment.