-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow dlv debugging for lvm operator and vgmanager
Signed-off-by: Jakob Möller <[email protected]>
- Loading branch information
1 parent
5e45008
commit 45c99b2
Showing
10 changed files
with
136 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
patchesStrategicMerge: | ||
- manager_debug_patch.yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: operator | ||
namespace: system | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: manager | ||
command: | ||
- "/usr/sbin/dlv" | ||
- "exec" | ||
- "--listen=:2345" | ||
- "--headless=true" | ||
- "--log=true" | ||
- "--accept-multiclient" | ||
- "--api-version=2" | ||
- "--continue" | ||
- "/usr/sbin/lvms" | ||
- "--" | ||
- "operator" | ||
args: | ||
- "--vgmanager-cmd=/usr/sbin/dlv,exec,--listen=:2345,--headless=true,--log=true,--accept-multiclient,--api-version=2,--continue,/usr/sbin/lvms,--,vgmanager" | ||
ports: | ||
- containerPort: 2345 | ||
name: "debug" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETPLATFORM | ||
FROM golang:1.20 as builder | ||
|
||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
COPY ../go.mod go.mod | ||
COPY ../go.sum go.sum | ||
|
||
# since we use vendoring we don't need to redownload our dependencies every time. Instead we can simply | ||
# reuse our vendored directory and verify everything is good. If not we can abort here and ask for a revendor. | ||
COPY ../vendor vendor/ | ||
RUN go mod verify | ||
|
||
# Copy the go source | ||
COPY ../api api/ | ||
COPY ../cmd cmd/ | ||
COPY ../internal internal/ | ||
|
||
ENV GOARCH=$TARGETARCH | ||
ENV GOOS=$TARGETOS | ||
ENV CGO_ENABLED=0 | ||
|
||
# Build | ||
RUN go build -gcflags "all=-N -l" -mod=vendor -a -o lvms cmd/main.go | ||
|
||
FROM golang:1.20 as dlv | ||
RUN go install -ldflags "-s -w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv@latest | ||
|
||
# vgmanager needs 'nsenter' and other basic linux utils to correctly function | ||
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9/ubi-minimal:9.2 | ||
|
||
# Update the image to get the latest CVE updates | ||
RUN microdnf update -y && \ | ||
microdnf install -y util-linux && \ | ||
microdnf clean all | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /workspace/lvms /usr/sbin/lvms | ||
COPY --from=dlv /go/bin/dlv /usr/sbin/dlv | ||
|
||
USER 65532:65532 | ||
|
||
EXPOSE 2345 | ||
|
||
ENTRYPOINT ["/usr/sbin/dlv"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters