Skip to content

Commit b056433

Browse files
authored
[new-component] Operator OpAMP Bridge Service (open-telemetry#1339)
* Begin the journey * Some hacks to functionality * Fix create bug, getting prepped for refactor * Some reorganization and cleaning, added tests * Add deletion and dockerfile * Add logic for specifying allowed components * Linting, CI, header * Makefile CI * Added comments, created an object for use by the applied keys map * Fix makefile, update to use require * IMports * updated from comments * Improved logging, working dockerfile * Rename the whole thing * Change service name * Update from feedback
1 parent 0bdaa9e commit b056433

29 files changed

+3013
-3
lines changed
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: new_component
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
5+
component: Operator OpAMP Bridge
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Introducing the Operator OpAMP Bridge service, which allows a user to manage OpenTelemetry Collector CRDs via OpAMP
9+
10+
# One or more tracking issues related to the change
11+
issues: [1318]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:

.github/workflows/continuous-integration.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
runs-on: ubuntu-20.04
3434
strategy:
3535
matrix:
36-
workdir: [".", "./cmd/otel-allocator"]
36+
workdir: [".", "./cmd/otel-allocator", "./cmd/operator-opamp-bridge"]
3737
steps:
3838
- name: Set up Go
3939
uses: actions/setup-go@v3

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.dylib
88
bin
99
vendor
10+
.DS_Store
1011

1112
# Test binary, build with `go test -c`
1213
*.test

Makefile

+15-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ BUNDLE_IMG ?= ${IMG_PREFIX}/${IMG_REPO}-bundle:${VERSION}
2121
TARGETALLOCATOR_IMG_REPO ?= target-allocator
2222
TARGETALLOCATOR_IMG ?= ${IMG_PREFIX}/${TARGETALLOCATOR_IMG_REPO}:$(addprefix v,${VERSION})
2323

24+
OPERATOROPAMPBRIDGE_IMG_REPO ?= operator-opamp-bridge
25+
OPERATOROPAMPBRIDGE_IMG ?= ${IMG_PREFIX}/${OPERATOROPAMPBRIDGE_IMG_REPO}:$(addprefix v,${VERSION})
26+
2427
# Options for 'bundle-build'
2528
ifneq ($(origin CHANNELS), undefined)
2629
BUNDLE_CHANNELS := --channels=$(CHANNELS)
@@ -89,6 +92,7 @@ ci: test
8992
test: generate fmt vet ensure-generate-is-noop envtest
9093
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBE_VERSION) -p path)" go test ${GOTEST_OPTS} ./...
9194
cd cmd/otel-allocator && KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBE_VERSION) -p path)" go test ${GOTEST_OPTS} ./...
95+
cd cmd/operator-opamp-bridge && KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBE_VERSION) -p path)" go test ${GOTEST_OPTS} ./...
9296

9397
# Build manager binary
9498
.PHONY: manager
@@ -152,6 +156,7 @@ vet:
152156
lint:
153157
golangci-lint run
154158
cd cmd/otel-allocator && golangci-lint run
159+
cd cmd/operator-opamp-bridge && golangci-lint run
155160

156161
# Generate code
157162
.PHONY: generate
@@ -174,7 +179,7 @@ e2e-log-operator:
174179
kubectl get deploy -A
175180

176181
.PHONY: prepare-e2e
177-
prepare-e2e: kuttl set-image-controller container container-target-allocator start-kind cert-manager install-metrics-server install-openshift-routes load-image-all deploy
182+
prepare-e2e: kuttl set-image-controller container container-target-allocator container-operator-opamp-bridge start-kind cert-manager install-metrics-server install-openshift-routes load-image-all deploy
178183
TARGETALLOCATOR_IMG=$(TARGETALLOCATOR_IMG) ./hack/modify-test-images.sh
179184

180185
.PHONY: scorecard-tests
@@ -201,6 +206,10 @@ container-target-allocator-push:
201206
container-target-allocator:
202207
docker buildx build --load --platform linux/${ARCH} -t ${TARGETALLOCATOR_IMG} cmd/otel-allocator
203208

209+
.PHONY: container-operator-opamp-bridge
210+
container-operator-opamp-bridge:
211+
docker buildx build --platform linux/${ARCH} -t ${OPERATOROPAMPBRIDGE_IMG} cmd/operator-opamp-bridge
212+
204213
.PHONY: start-kind
205214
start-kind:
206215
ifeq (true,$(START_KIND_CLUSTER))
@@ -216,7 +225,7 @@ install-openshift-routes:
216225
./hack/install-openshift-routes.sh
217226

218227
.PHONY: load-image-all
219-
load-image-all: load-image-operator load-image-target-allocator
228+
load-image-all: load-image-operator load-image-target-allocator load-image-operator-opamp-bridge
220229

221230
.PHONY: load-image-operator
222231
load-image-operator: container
@@ -236,6 +245,10 @@ else
236245
endif
237246

238247

248+
.PHONY: load-image-operator-opamp-bridge
249+
load-image-operator-opamp-bridge:
250+
kind load docker-image ${OPERATOROPAMPBRIDGE_IMG}
251+
239252
.PHONY: cert-manager
240253
cert-manager: cmctl
241254
# Consider using cmctl to install the cert-manager once install command is not experimental

cmd/operator-opamp-bridge/Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Build the operator-opamp-bridge binary
2+
FROM golang:1.19-alpine as builder
3+
4+
WORKDIR /app
5+
6+
RUN apk --no-cache add ca-certificates
7+
8+
# Copy go mod and sum files
9+
COPY go.mod go.sum ./
10+
11+
RUN go mod download
12+
13+
COPY . .
14+
15+
# Build the Go app
16+
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
17+
18+
######## Start a new stage from scratch #######
19+
FROM scratch
20+
21+
WORKDIR /root/
22+
23+
# Copy the certs from the builder
24+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
25+
26+
# Copy the pre-built binary file from the previous stage
27+
COPY --from=builder /app/main .
28+
29+
ENTRYPOINT ["./main"]

0 commit comments

Comments
 (0)