Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new-component] Operator OpAMP Bridge Service #1339

Merged
merged 17 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .chloggen/1318-remote-config-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: new_component

# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
component: Operator OpAMP Bridge

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Introducing the Operator OpAMP Bridge service, which allows a user to manage OpenTelemetry Collector CRDs via OpAMP

# One or more tracking issues related to the change
issues: [1318]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
workdir: [".", "./cmd/otel-allocator"]
workdir: [".", "./cmd/otel-allocator", "./cmd/operator-opamp-bridge"]
steps:
- name: Set up Go
uses: actions/setup-go@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.dylib
bin
vendor
.DS_Store

# Test binary, build with `go test -c`
*.test
Expand Down
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ BUNDLE_IMG ?= ${IMG_PREFIX}/${IMG_REPO}-bundle:${VERSION}
TARGETALLOCATOR_IMG_REPO ?= target-allocator
TARGETALLOCATOR_IMG ?= ${IMG_PREFIX}/${TARGETALLOCATOR_IMG_REPO}:$(addprefix v,${VERSION})

OPERATOROPAMPBRIDGE_IMG_REPO ?= operator-opamp-bridge
OPERATOROPAMPBRIDGE_IMG ?= ${IMG_PREFIX}/${OPERATOROPAMPBRIDGE_IMG_REPO}:$(addprefix v,${VERSION})

# Options for 'bundle-build'
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
Expand Down Expand Up @@ -89,6 +92,7 @@ ci: test
test: generate fmt vet ensure-generate-is-noop envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBE_VERSION) -p path)" go test ${GOTEST_OPTS} ./...
cd cmd/otel-allocator && KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBE_VERSION) -p path)" go test ${GOTEST_OPTS} ./...
cd cmd/operator-opamp-bridge && KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBE_VERSION) -p path)" go test ${GOTEST_OPTS} ./...

# Build manager binary
.PHONY: manager
Expand Down Expand Up @@ -152,6 +156,7 @@ vet:
lint:
golangci-lint run
cd cmd/otel-allocator && golangci-lint run
cd cmd/operator-opamp-bridge && golangci-lint run

# Generate code
.PHONY: generate
Expand All @@ -174,7 +179,7 @@ e2e-log-operator:
kubectl get deploy -A

.PHONY: prepare-e2e
prepare-e2e: kuttl set-image-controller container container-target-allocator start-kind cert-manager install-metrics-server install-openshift-routes load-image-all deploy
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
TARGETALLOCATOR_IMG=$(TARGETALLOCATOR_IMG) ./hack/modify-test-images.sh

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

.PHONY: container-operator-opamp-bridge
container-operator-opamp-bridge:
docker buildx build --platform linux/${ARCH} -t ${OPERATOROPAMPBRIDGE_IMG} cmd/operator-opamp-bridge

.PHONY: start-kind
start-kind:
ifeq (true,$(START_KIND_CLUSTER))
Expand All @@ -216,7 +225,7 @@ install-openshift-routes:
./hack/install-openshift-routes.sh

.PHONY: load-image-all
load-image-all: load-image-operator load-image-target-allocator
load-image-all: load-image-operator load-image-target-allocator load-image-operator-opamp-bridge

.PHONY: load-image-operator
load-image-operator: container
Expand All @@ -236,6 +245,10 @@ else
endif


.PHONY: load-image-operator-opamp-bridge
load-image-operator-opamp-bridge:
kind load docker-image ${OPERATOROPAMPBRIDGE_IMG}

.PHONY: cert-manager
cert-manager: cmctl
# Consider using cmctl to install the cert-manager once install command is not experimental
Expand Down
29 changes: 29 additions & 0 deletions cmd/operator-opamp-bridge/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Build the operator-opamp-bridge binary
FROM golang:1.19-alpine as builder

WORKDIR /app

RUN apk --no-cache add ca-certificates

# Copy go mod and sum files
COPY go.mod go.sum ./

RUN go mod download

COPY . .

# Build the Go app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

######## Start a new stage from scratch #######
FROM scratch

WORKDIR /root/

# Copy the certs from the builder
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

# Copy the pre-built binary file from the previous stage
COPY --from=builder /app/main .

ENTRYPOINT ["./main"]
Loading