Skip to content

Commit c7f9753

Browse files
authored
Merge pull request #443 from frobware/two-tier-metrics-agent-collection
Decouple metrics from hostNetwork using proxy DaemonSet
2 parents 6035293 + bc4262f commit c7f9753

File tree

111 files changed

+21182
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+21182
-214
lines changed

Containerfile.bpfman-agent

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ COPY . .
2323
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
2424
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
2525
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -mod vendor -o bpfman-agent ./cmd/bpfman-agent/main.go
26+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -mod vendor -o metrics-proxy ./cmd/metrics-proxy/main.go
2627

2728

2829
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.24 AS cri-tools-build
@@ -59,6 +60,7 @@ ARG TARGETPLATFORM
5960

6061
WORKDIR /
6162
COPY --from=bpfman-agent-build /usr/src/bpfman-operator/bpfman-agent .
63+
COPY --from=bpfman-agent-build /usr/src/bpfman-operator/metrics-proxy .
6264

6365
# Install crictl
6466
COPY --from=cri-tools-build /usr/src/cri-tools/crictl /usr/local/bin

Containerfile.bpfman-operator

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ ARG TARGETPLATFORM
3838
WORKDIR /
3939
COPY --from=bpfman-operator-build /usr/src/bpfman-operator/config/bpfman-deployment/daemonset.yaml ./config/bpfman-deployment/daemonset.yaml
4040
COPY --from=bpfman-operator-build /usr/src/bpfman-operator/config/bpfman-deployment/csidriverinfo.yaml ./config/bpfman-deployment/csidriverinfo.yaml
41+
COPY --from=bpfman-operator-build /usr/src/bpfman-operator/config/bpfman-deployment/metrics-proxy-daemonset.yaml ./config/bpfman-deployment/metrics-proxy-daemonset.yaml
4142
COPY --from=bpfman-operator-build /usr/src/bpfman-operator/config/openshift/restricted-scc.yaml ./config/openshift/restricted-scc.yaml
4243
COPY --from=bpfman-operator-build /usr/src/bpfman-operator/bpfman-operator .
4344
USER 65532:65532

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ test-integration: ## Run Integration tests.
310310
kustomization.yaml.env > kustomization.yaml
311311
GOFLAGS="-tags=integration_tests" go test -count=1 -race -v ./test/integration/...
312312

313+
.PHONY: test-integration-local
314+
test-integration-local: ## Run Integration tests against existing deployment. Use TEST= to specify test pattern.
315+
USE_EXISTING_KIND_CLUSTER=$(shell kubectl config current-context | sed 's/kind-//') \
316+
SKIP_BPFMAN_DEPLOY=true \
317+
GOFLAGS="-tags=integration_tests" go test -count=1 -race -v ./test/integration $(if $(TEST),-run $(TEST),)
318+
313319
## The physical bundle is no longer tracked in git since it should be considered
314320
## and treated as a release artifact, rather than something that's updated
315321
## as part of a pull request.
@@ -337,6 +343,7 @@ build-release-yamls: generate kustomize ## Generate the crd install bundle for a
337343
build: fmt ## Build bpfman-operator and bpfman-agent binaries.
338344
CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build -mod vendor -o bin/bpfman-operator cmd/bpfman-operator/main.go
339345
CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build -mod vendor -o bin/bpfman-agent cmd/bpfman-agent/main.go
346+
CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build -mod vendor -o bin/metrics-proxy cmd/metrics-proxy/main.go
340347

341348
# These paths map the host's GOCACHE location to the container's
342349
# location. We want to mount the host's Go cache in the container to

bundle/manifests/bpfman-agent-metrics-monitor_monitoring.coreos.com_v1_servicemonitor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ metadata:
1212
spec:
1313
endpoints:
1414
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
15-
path: /metrics
15+
path: /agent-metrics
1616
port: https-metrics
1717
scheme: https
1818
tlsConfig:

bundle/manifests/bpfman-agent-metrics-service_v1_service.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ metadata:
1313
app.kubernetes.io/part-of: bpfman-operator
1414
name: bpfman-agent-metrics-service
1515
spec:
16+
clusterIP: None
1617
ports:
1718
- name: https-metrics
1819
port: 8443
1920
protocol: TCP
2021
targetPort: https-metrics
2122
selector:
22-
name: bpfman-daemon
23+
name: bpfman-metrics-proxy
2324
status:
2425
loadBalancer: {}

bundle/manifests/bpfman-config_v1_configmap.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ data:
33
bpfman.agent.healthprobe.addr: :8175
44
bpfman.agent.image: quay.io/bpfman/bpfman-agent:latest
55
bpfman.agent.log.level: info
6-
bpfman.agent.metric.addr: :8443
76
bpfman.image: quay.io/bpfman/bpfman:latest
87
bpfman.log.level: info
98
bpfman.toml: |

bundle/manifests/bpfman-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ metadata:
1313
rules:
1414
- nonResourceURLs:
1515
- /metrics
16+
- /agent-metrics
1617
verbs:
1718
- get

bundle/manifests/bpfman-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ metadata:
994994
capabilities: Basic Install
995995
categories: OpenShift Optional
996996
containerImage: quay.io/bpfman/bpfman-operator:latest
997-
createdAt: "2025-05-13T16:53:16Z"
997+
createdAt: "2025-06-03T12:16:50Z"
998998
description: The bpfman Operator is designed to manage eBPF programs for applications.
999999
features.operators.openshift.io/cnf: "false"
10001000
features.operators.openshift.io/cni: "false"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app.kubernetes.io/component: metrics
7+
app.kubernetes.io/created-by: bpfman-operator
8+
app.kubernetes.io/instance: prometheus-metrics-reader
9+
app.kubernetes.io/managed-by: kustomize
10+
app.kubernetes.io/name: clusterrolebinding
11+
app.kubernetes.io/part-of: bpfman-operator
12+
name: bpfman-prometheus-metrics-reader
13+
roleRef:
14+
apiGroup: rbac.authorization.k8s.io
15+
kind: ClusterRole
16+
name: bpfman-metrics-reader
17+
subjects:
18+
- kind: ServiceAccount
19+
name: prometheus-k8s
20+
namespace: openshift-monitoring

0 commit comments

Comments
 (0)