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 12 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: Remote Configuration

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Introducing the Operator Remote Configuration 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/remote-configuration"]
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})

REMOTECONFIGURATION_IMG_REPO ?= remote-configuration
REMOTECONFIGURATION_IMG ?= ${IMG_PREFIX}/${REMOTECONFIGURATION_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/remote-configuration && 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/remote-configuration && 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-remote-configuration 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-remote-configuration
container-remote-configuration:
jaronoff97 marked this conversation as resolved.
Show resolved Hide resolved
docker buildx build --platform linux/${ARCH} -t ${REMOTECONFIGURATION_IMG} cmd/remote-configuration

.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-remote-configuration

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


.PHONY: load-image-remote-configuration
load-image-remote-configuration:
kind load docker-image ${REMOTECONFIGURATION_IMG}

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

WORKDIR /app

# 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 alpine:latest
jaronoff97 marked this conversation as resolved.
Show resolved Hide resolved

RUN apk --no-cache add ca-certificates

WORKDIR /root/

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

ENTRYPOINT ["./main"]
Loading