Skip to content

Commit c079b81

Browse files
committed
Add first cut at duct-tape for skaffold-debug
1 parent 52df504 commit c079b81

5 files changed

Lines changed: 101 additions & 0 deletions

File tree

skaffold-duct-tape/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Duct Tape
2+
3+
_Caution: this is work-in-progress_
4+
5+
This repository gathers additional dependencies required to debug
6+
particular language runtimes with `skaffold debug`. These dependencies
7+
are packaged into an image container suitable for use as an
8+
`initContainer` on a pod.
9+
10+
Currently supported:
11+
* None!
12+
13+
In Progress:
14+
15+
* Go: provides Delve
16+
17+
## Development
18+
19+
The idea is that `skaffold debug` will transform k8s manifests to
20+
make available any support files required to debug specific language
21+
runtimes. For example, the `k8s-pod.yaml.orig` file shows an k8s
22+
podspec that would be transformed to `k8s-pod.yaml` to:
23+
- mount a volume to hold the debugging support files
24+
- provide an initContainer to populate the volume
25+
- mount the volume to the applicable containers
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM golang:1.11 as delve
2+
RUN curl --location --output delve-1.2.0.tar.gz https://github.com/go-delve/delve/archive/v1.2.0.tar.gz \
3+
&& tar xzf delve-1.2.0.tar.gz
4+
RUN cd delve-1.2.0/cmd/dlv && go install
5+
6+
#
7+
#FROM python:2.7 as python27
8+
#RUN curl --location --output ptsvd.zip https://github.com/Microsoft/ptvsd/archive/v4.2.4.zip \
9+
# && unzip ptsvd.zip \
10+
# && cd ptsvd-4.2.4 \
11+
# &&
12+
13+
# The debian image is about 95MB bigger
14+
FROM gcr.io/distroless/base:debug
15+
SHELL ["/busybox/sh","-c"]
16+
WORKDIR /duct-tape
17+
COPY --from=delve /go/bin/dlv .
18+
COPY install.sh /
19+
ENTRYPOINT ["/busybox/sh", "/install.sh"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
set -e
4+
echo "This is the duct-tape installation script!"
5+
6+
if [ ! -d /dbg ]; then
7+
echo "Debugging installation requires a volume mount at /dbg" 1>&2
8+
exit 1
9+
fi
10+
11+
# Install Delve for Go
12+
cp -p /duct-tape/dlv /dbg

skaffold-duct-tape/k8s-pod.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: demo-duct-tape
5+
labels:
6+
app: demo-duct-tape
7+
spec:
8+
initContainers:
9+
- name: apply-duct-tape
10+
image: gcr.io/gcp-dev-tools/duct-tape:latest
11+
volumeMounts:
12+
- name: dbg
13+
mountPath: "/dbg"
14+
containers:
15+
- name: helloworld1
16+
image: busybox
17+
command: ['sh', '-c', 'echo "The app is running"; ls / /dbg; sleep 3600']
18+
volumeMounts:
19+
- name: dbg
20+
mountPath: "/dbg"
21+
readOnly: true
22+
- name: helloworld2
23+
image: busybox
24+
command: ['sh', '-c', 'echo "The app is running"; ls / /dbg; sleep 3600']
25+
volumeMounts:
26+
- name: dbg
27+
mountPath: "/dbg"
28+
readOnly: true
29+
volumes:
30+
- name: dbg
31+
emptyDir: {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: demo-duct-tape
5+
labels:
6+
app: demo-duct-tape
7+
spec:
8+
containers:
9+
- name: helloworld1
10+
image: busybox
11+
command: ['sh', '-c', 'echo "The app is running"; ls / /dbg; sleep 3600']
12+
- name: helloworld2
13+
image: busybox
14+
command: ['sh', '-c', 'echo "The app is running"; ls / /dbg; sleep 3600']

0 commit comments

Comments
 (0)