Skip to content
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
21 changes: 21 additions & 0 deletions hack/toolbox/Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Build cns
FROM golang:1.17 AS builder
# Build args
ARG VERSION
ARG CNS_AI_PATH
ARG CNS_AI_ID

WORKDIR /usr/local/src/cns
COPY . .
RUN $Env:CGO_ENABLED=0; go build -v -o /usr/local/bin/toolbox.exe -gcflags="-dwarflocationlists=true" ./hack/toolbox/server


# Copy into final image
FROM mcr.microsoft.com/windows/servercore:ltsc2022
COPY --from=builder /usr/local/bin/toolbox.exe \
/usr/local/bin/toolbox.exe

RUN powershell.exe Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
RUN choco install -y vim wget

ENTRYPOINT ["/usr/local/bin/toolbox.exe"]
36 changes: 36 additions & 0 deletions hack/toolbox/manifests/Dockerfile.heavy
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:20.04
RUN apt-get update
RUN apt-get install -y \
python3 \
python \
nmap \
iptables \
ebtables \
sudo \
iproute2 \
curl \
wget \
axel \
jq \
ssh \
traceroute \
iputils-ping \
net-tools \
dnsutils \
bridge-utils \
netcat \
ncat \
ssh \
tcpdump \
vim \
emacs \
nano
RUN wget -qO- https://golang.org/dl/go1.14.6.linux-amd64.tar.gz | tar zxf - -C /usr/lib/
ENV PATH="/usr/lib/go/bin/:${PATH}"
ENV GOROOT="/usr/lib/go"
ENV GOPATH="/root/go"
ENV PATH="/root/go/bin/:${PATH}"
ADD ./server.go /app/
WORKDIR /app
RUN go build -o main .
CMD ["./main"]
91 changes: 91 additions & 0 deletions hack/toolbox/manifests/agents.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: agent-pod-8085-tcp-host
labels:
app: agent-pod-8085-tcp-host
spec:
replicas: 1
selector:
matchLabels:
app: agent-pod-8085-tcp-host

template:
metadata:
labels:
app: agent-pod-8085-tcp-host
spec:
nodeSelector:
beta.kubernetes.io/os: linux
kubernetes.io/role: agent
hostNetwork: true
containers:
- name: agent-pod-8085-tcp-host
image: acnpublic.azurecr.io/toolbox:latest
env:
- name: TCP_PORT
value: "8085"
- name: UDP_PORT
value: "8086"
ports:
- containerPort: 8085
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: agent-pod-8085-tcp
labels:
app: agent-pod-8085-tcp
spec:
replicas: 1
selector:
matchLabels:
app: agent-pod-8085-tcp
template:
metadata:
labels:
app: agent-pod-8085-tcp
spec:
nodeSelector:
beta.kubernetes.io/os: linux
kubernetes.io/role: agent
containers:
- name: agent-pod-8085-tcp
image: acnpublic.azurecr.io/toolbox:latest
env:
- name: TCP_PORT
value: "8085"
- name: UDP_PORT
value: "8086"
ports:
- containerPort: 8085
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: agent-pod-8086-udp
labels:
app: agent-pod-8086-udp
spec:
replicas: 1
selector:
matchLabels:
app: agent-pod-8086-udp
template:
metadata:
labels:
app: agent-pod-8086-udp
spec:
nodeSelector:
beta.kubernetes.io/os: linux
kubernetes.io/role: agent
containers:
- name: agent-pod-8086-udp
image: acnpublic.azurecr.io/toolbox:latest
env:
- name: TCP_PORT
value: "8085"
- name: UDP_PORT
value: "8086"
ports:
- containerPort: 8086
57 changes: 57 additions & 0 deletions hack/toolbox/manifests/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: azure-npm
namespace: kube-system
labels:
app: azure-npm
addonmanager.kubernetes.io/mode: EnsureExists
spec:
selector:
matchLabels:
k8s-app: azure-npm
template:
metadata:
labels:
k8s-app: azure-npm
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ""
spec:
priorityClassName: system-node-critical
tolerations:
- operator: "Exists"
effect: NoExecute
- operator: "Exists"
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
nodeSelector:
beta.kubernetes.io/os: linux
kubernetes.io/role: agent
containers:
- name: azure-npm
image: mcr.microsoft.com/containernetworking/azure-npm:v1.0.33
securityContext:
privileged: true
env:
- name: HOSTNAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
volumeMounts:
- name: xtables-lock
mountPath: /run/xtables.lock
- name: log
mountPath: /var/log
hostNetwork: true
volumes:
- name: log
hostPath:
path: /var/log
type: Directory
- name: xtables-lock
hostPath:
path: /run/xtables.lock
type: File
serviceAccountName: azure-npm
113 changes: 113 additions & 0 deletions hack/toolbox/manifests/master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: master-pod-8085-tcp-host
labels:
app: master-pod-8085-tcp-host
spec:
replicas: 1
selector:
matchLabels:
app: master-pod-8085-tcp-host

template:
metadata:
labels:
app: master-pod-8085-tcp-host
spec:
nodeSelector:
beta.kubernetes.io/os: linux
kubernetes.io/role: master
hostNetwork: true
tolerations:
- operator: "Exists"
effect: NoExecute
- operator: "Exists"
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
containers:
- name: master-pod-8085-tcp-host
image: acnpublic.azurecr.io/toolbox:latest
env:
- name: TCP_PORT
value: "8085"
- name: UDP_PORT
value: "8086"
ports:
- containerPort: 8085
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: master-pod-8085-tcp
labels:
app: master-pod-8085-tcp
spec:
replicas: 1
selector:
matchLabels:
app: master-pod-8085-tcp

template:
metadata:
labels:
app: master-pod-8085-tcp
spec:
nodeSelector:
beta.kubernetes.io/os: linux
kubernetes.io/role: master
tolerations:
- operator: "Exists"
effect: NoExecute
- operator: "Exists"
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
containers:
- name: master-pod-8085-tcp
image: acnpublic.azurecr.io/toolbox:latest
env:
- name: TCP_PORT
value: "8085"
- name: UDP_PORT
value: "8086"
ports:
- containerPort: 8085
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: master-pod-8086-udp
labels:
app: master-pod-8086-udp
spec:
replicas: 1
selector:
matchLabels:
app: master-pod-8086-udp
template:
metadata:
labels:
app: master-pod-8086-udp
spec:
nodeSelector:
beta.kubernetes.io/os: linux
kubernetes.io/role: master
tolerations:
- operator: "Exists"
effect: NoExecute
- operator: "Exists"
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
containers:
- name: master-pod-udp
image: acnpublic.azurecr.io/toolbox:latest
env:
- name: TCP_PORT
value: "8085"
- name: UDP_PORT
value: "8086"
ports:
- containerPort: 8086
56 changes: 56 additions & 0 deletions hack/toolbox/manifests/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
apiVersion: v1
kind: Service
metadata:
name: agent-pod-8085-tcp-ipv4
spec:
ipFamily: IPv4
type: LoadBalancer
selector:
app: agent-pod-8085-tcp
ports:
- protocol: TCP
port: 8085
targetPort: 8085
---
apiVersion: v1
kind: Service
metadata:
name: agent-pod-8086-udp-ipv4
spec:
type: LoadBalancer
ipFamily: IPv4
selector:
app: agent-pod-8086-udp
ports:
- protocol: UDP
port: 8086
targetPort: 8086
---
apiVersion: v1
kind: Service
metadata:
name: agent-pod-8085-tcp-ipv6
spec:
ipFamily: IPv6
type: LoadBalancer
selector:
app: agent-pod-8085-tcp
ports:
- protocol: TCP
port: 8085
targetPort: 8085
---
apiVersion: v1
kind: Service
metadata:
name: agent-pod-8086-udp-ipv6
spec:
type: LoadBalancer
ipFamily: IPv6
selector:
app: agent-pod-8086-udp
ports:
- protocol: UDP
port: 8086
targetPort: 8086
Loading