-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add development environment using dev container #90
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked that some make commands work correctly.
LGTM
Makefile
Outdated
@echo "Creating Cluster" | ||
kind create cluster --name ${KIND_CLUSTER_NAME} --image=kindest/node:${K8S_NODE_IMAGE} --config ${KIND_CONFIG_DIR}/cluster.yaml | ||
cp -r ${HOME}/.kube . | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no problem with cp command running in the dev container, but I'm not happy if it runs locally.
Can you make if
depending on whether it's in the dev container?
i think, dev container can set some environment variables from devcontainer.json
.
ex. Create some check variable like IN_DEV_CONTAINER
and check it.
https://code.visualstudio.com/remote/advancedcontainers/environment-variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itiB
I added IN_DEV_CONTAINER
to check whether it's in the dev container.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp
command creates a .kube
directory under the existing .kube
directory, so I changed it to use kind get kubeconfig
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks well:+1:
I make some suggestion comment.
"--name=gatling-operator-dev-container", | ||
"--hostname=gatling-operator-dev-container", | ||
// Set network mode to host to communicate with other containers. | ||
"--network=host" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's necessary to control kind clusters on the host.
"IN_DEV_CONTAINER": "true" | ||
}, | ||
// Restore the local kubectl config to a dev container. | ||
"postStartCommand": "if [ -d ${containerWorkspaceFolder}/.kube ]; then cp -r ${containerWorkspaceFolder}/.kube $HOME/.kube; fi", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restoring the backed-up kubeconfig.
@@ -16,7 +16,7 @@ COPY controllers/ controllers/ | |||
COPY pkg/ pkg/ | |||
|
|||
# Build | |||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go | |||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$(dpkg --print-architecture) go build -a -o manager main.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it available for use in other architectures as well.
@itiB |
Description
Changes
Dockerfile.dev
anddevcontainer.json
to use dev container on Visual Studio Code.Dockerfile
to not be fixed toamd64
.Future plans
buildx
for creating builds that support multiple platforms.References
Notes
keychain
to forward the ssh-agent from my Mac to a dev container.Checklist
Relevant issue #88