Skip to content

Commit 6bc1679

Browse files
authored
Merge pull request #491 from guillaumerose/k8svpnkit
Add Kubernetes port forwarder controller running inside the VM using the vpnkit.Client
2 parents 0865fe2 + a901551 commit 6bc1679

File tree

193 files changed

+13226
-269
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+13226
-269
lines changed

go/Dockerfile.kube-forwarder

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
FROM linuxkit/alpine:630ee558e4869672fae230c78364e367b8ea67a9 AS mirror
2-
3-
RUN apk add --no-cache go musl-dev build-base
1+
FROM golang:1.13-alpine3.10 AS mirror
2+
RUN apk add --update build-base
43

54
ADD . /go/src/github.com/moby/vpnkit/go
65
WORKDIR /go/src/github.com/moby/vpnkit/go
76

8-
RUN GOPATH=/go make test
9-
RUN GOPATH=/go make build/kube-vpnkit-forwarder.linux
7+
RUN make build/kube-vpnkit-forwarder.linux
108

11-
FROM scratch
9+
FROM alpine:3.10
1210
COPY --from=mirror /go/src/github.com/moby/vpnkit/go/build/kube-vpnkit-forwarder.linux /kube-vpnkit-forwarder
13-
CMD ["/kube-vpnkit-forwarder"]
11+
CMD ["/kube-vpnkit-forwarder"]

go/Gopkg.lock

+57-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ build/dial-example.linux: $(DEPS_DIAL_EXAMPLE)
4545
$(DEPS_DIAL_EXAMPLE)
4646

4747
build/kube-vpnkit-forwarder.linux: $(DEPS_KUBE_FORWARDER)
48-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
48+
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 \
4949
go build -o $@ --ldflags '-s -w' --buildmode pie \
5050
$(DEPS_KUBE_FORWARDER)
5151

go/cmd/kube-vpnkit-forwarder/forwarder.go

-132
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,48 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1beta1
3+
kind: ClusterRole
4+
metadata:
5+
name: kube-vpnkit-forwarder
6+
rules:
7+
- apiGroups: [v1]
8+
resources: [services]
9+
verbs: [watch]
10+
---
111
apiVersion: v1
2-
kind: List
3-
items:
4-
- apiVersion: v1
5-
kind: ServiceAccount
6-
metadata:
7-
name: kube-vpnkit-forwarder
8-
namespace: kube-system
9-
labels:
10-
name: kube-vpnkit-forwarder
11-
- apiVersion: rbac.authorization.k8s.io/v1beta1
12-
kind: ClusterRole
13-
metadata:
14-
name: kube-vpnkit-forwarder
15-
labels:
16-
name: kube-vpnkit-forwarder
17-
rules:
18-
- apiGroups: [ v1 ]
19-
resources: [ services ]
20-
verbs: [ watch ]
21-
- apiVersion: rbac.authorization.k8s.io/v1beta1
22-
kind: ClusterRoleBinding
23-
metadata:
24-
name: kube-vpnkit-forwarder
25-
namespace: kube-system
26-
labels:
27-
name: kube-vpnkit-forwarder
28-
roleRef:
29-
kind: ClusterRole
30-
name: kube-vpnkit-forwarder
31-
apiGroup: rbac.authorization.k8s.io
32-
subjects:
33-
- kind: ServiceAccount
34-
name: kube-vpnkit-forwarder
35-
namespace: kube-system
36-
- apiVersion: apps/v1beta2
37-
kind: DaemonSet
38-
metadata:
39-
name: kube-vpnkit-forwarder
40-
namespace: kube-system
41-
labels:
42-
name: kube-vpnkit-forwarder
43-
spec:
44-
selector:
45-
matchLabels:
46-
name: kube-vpnkit-forwarder
47-
updateStrategy:
48-
type: RollingUpdate
49-
template:
50-
metadata:
51-
labels:
52-
name: kube-vpnkit-forwarder
53-
spec:
54-
serviceAccount: kube-vpnkit-forwarder
55-
tolerations:
56-
- effect: NoSchedule
57-
operator: Exists
58-
containers:
59-
- name: app
60-
image: 'vpnkit/kube-vpnkit-forwarder:current'
61-
imagePullPolicy: IfNotPresent
62-
volumeMounts:
63-
- mountPath: /port
64-
name: vpnkit-filesystem
65-
volumes:
66-
- name: vpnkit-filesystem
67-
hostPath:
68-
path: /var/vpnkit/port
12+
kind: ServiceAccount
13+
metadata:
14+
name: kube-vpnkit-forwarder
15+
namespace: kube-system
16+
---
17+
apiVersion: rbac.authorization.k8s.io/v1
18+
kind: ClusterRoleBinding
19+
metadata:
20+
name: kube-vpnkit-forwarder
21+
roleRef:
22+
apiGroup: rbac.authorization.k8s.io
23+
kind: ClusterRole
24+
name: kube-vpnkit-forwarder
25+
subjects:
26+
- kind: ServiceAccount
27+
name: kube-vpnkit-forwarder
28+
namespace: kube-system
29+
---
30+
apiVersion: v1
31+
kind: Pod
32+
metadata:
33+
name: kube-vpnkit-forwarder
34+
namespace: kube-system
35+
spec:
36+
serviceAccountName: kube-vpnkit-forwarder
37+
containers:
38+
- name: kube-vpnkit-forwarder
39+
image: vpnkit/kube-vpnkit-forwarder:latest
40+
command: ["/kube-vpnkit-forwarder", "-path", "/run/host-services/backend.sock"]
41+
imagePullPolicy: IfNotPresent
42+
volumeMounts:
43+
- mountPath: /run/host-services/backend.sock
44+
name: api
45+
volumes:
46+
- name: api
47+
hostPath:
48+
path: /run/host-services/backend.sock

0 commit comments

Comments
 (0)