Skip to content

Commit 30325c8

Browse files
authored
Merge pull request #1187 from FabrizioCafolla/main
(feat) add devcontainer and vscode settings
2 parents b9f8166 + b84bf4e commit 30325c8

3 files changed

Lines changed: 69 additions & 0 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04
2+
3+
ENV WORKDIR="/home/vscode/add-controller"
4+
5+
WORKDIR ${WORKDIR}
6+
7+
COPY . .
8+
9+
ARG ARCH
10+
11+
ARG GO_VERSION
12+
RUN export ARCH=${ARCH:-$(dpkg --print-architecture)} && \
13+
curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz" | tar -C /usr/local -xzf - && \
14+
echo 'export PATH=$PATH:/usr/local/go/bin:/home/vscode/go/bin' >> /home/vscode/.bashrc
15+
16+
ENV PATH="${PATH}:/usr/local/go/bin:/home/vscode/go/bin"
17+
ENV GOPATH="/home/vscode/go"
18+
ENV GOROOT="/usr/local/go"
19+
20+
RUN make tools
21+
ENV PATH="${PATH}:/home/vscode/project-sveltos/hack/tools/bin"
22+
23+
ARG KUBECTX_VERSION
24+
RUN export ARCH=${ARCH:-$(dpkg --print-architecture)} && \
25+
echo "Installing kubectx version ${KUBECTX_VERSION}..." && \
26+
curl -sLo /usr/local/bin/kubectx https://github.com/ahmetb/kubectx/releases/download/v${KUBECTX_VERSION}/kubectx && \
27+
chmod +x /usr/local/bin/kubectx
28+
29+
ARG SVELTOSCTL_VERSION
30+
RUN export ARCH=${ARCH:-$(dpkg --print-architecture)} && \
31+
echo "Installing svletosctl version ${SVELTOSCTL_VERSION}..." && \
32+
curl -sLo /usr/local/bin/sveltosctl https://github.com/projectsveltos/sveltosctl/releases/download/v${SVELTOSCTL_VERSION}/sveltosctl-linux-${ARCH} && \
33+
chmod +x /usr/local/bin/sveltosctl
34+

.devcontainer/devcontainer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "Project Sveltos",
3+
"containerEnv": {
4+
"KUBECONFIG": "/vscode/.kube/config",
5+
"WORKDIR": "${localWorkspaceFolder}"
6+
},
7+
"build": {
8+
"dockerfile": "${localWorkspaceFolder}/.devcontainer/Dockerfile",
9+
"context": "${localWorkspaceFolder}",
10+
"args": {
11+
"GO_VERSION": "1.24.1",
12+
"KUBECTX_VERSION": "0.9.5",
13+
"SVELTOSCTL_VERSION": "0.53.0"
14+
}
15+
},
16+
"workspaceFolder": "${localWorkspaceFolder}",
17+
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind",
18+
"mounts": [
19+
"source=${localWorkspaceFolder}/test/.kube,target=/vscode/.kube,type=bind"
20+
],
21+
"runArgs": [],
22+
"features": {
23+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
24+
},
25+
"customizations": {
26+
"vscode": {
27+
"extensions": [],
28+
"settings": {}
29+
}
30+
},
31+
"initializeCommand": "mkdir -p ${localWorkspaceFolder}/test/.kube"
32+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ pkg/drift-detection/drift-detection-manager-in-mgmt-cluster.yaml-e
3434
pkg/drift-detection/drift-detection-manager.yaml-e
3535

3636
version.txt
37+
38+
# Test Kubernetes config files
39+
test/.kube

0 commit comments

Comments
 (0)