mirror of
https://github.com/itzg/mc-router.git
synced 2024-11-21 11:25:41 +01:00
add support for developing in-cluster with Skaffold (#27)
This commit is contained in:
parent
520d0c79da
commit
6bf14043bb
13
README.md
13
README.md
@ -161,6 +161,19 @@ docker run -it --rm \
|
||||
go build ./cmd/mc-router
|
||||
```
|
||||
|
||||
## Skaffold
|
||||
|
||||
For "in-cluster development" it's convenient to use https://skaffold.dev. Any changes to Go source code
|
||||
will trigger a go build, new container image pushed to registry with a new tag, and refresh in Kubernetes
|
||||
with the image tag used in the deployment transparently updated to the new tag and thus new pod created pulling new images:
|
||||
|
||||
skaffold dev
|
||||
|
||||
When using Google Cloud (GCP), first create a _Docker Artifact Registry_,
|
||||
then add the _Artifact Registry Reader_ Role to the _Compute Engine default service account_ of your GKE clusterService Account_ (to avoid error like "container mc-router is waiting to start: ...-docker.pkg.dev/... can't be pulled"),
|
||||
then use e.g. `gcloud auth configure-docker europe-docker.pkg.dev` or equivalent one time (to create a `~/.docker/config.json`),
|
||||
and then use e.g. `--default-repo=europe-docker.pkg.dev/YOUR-PROJECT/YOUR-ARTIFACT-REGISTRY` option for `skaffold dev`.
|
||||
|
||||
## Performing snapshot release with Docker
|
||||
|
||||
```bash
|
||||
|
35
docs/k8s-deployment.yaml
Normal file
35
docs/k8s-deployment.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
# used by ../skaffold.yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
run: mc-router
|
||||
name: mc-router
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
run: mc-router
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
run: mc-router
|
||||
spec:
|
||||
serviceAccountName: mc-router
|
||||
containers:
|
||||
- image: itzg/mc-router:latest
|
||||
name: mc-router
|
||||
args: ["--api-binding", ":8080", "--in-kube-cluster"]
|
||||
ports:
|
||||
- name: proxy
|
||||
containerPort: 25565
|
||||
- name: web
|
||||
containerPort: 8080
|
||||
resources:
|
||||
requests:
|
||||
memory: 50Mi
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: 100Mi
|
||||
cpu: "250m"
|
14
skaffold.yaml
Normal file
14
skaffold.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
apiVersion: skaffold/v2beta26
|
||||
kind: Config
|
||||
metadata:
|
||||
name: mc-router
|
||||
build:
|
||||
artifacts:
|
||||
- image: itzg/mc-router
|
||||
# https://skaffold.dev/docs/pipeline-stages/builders/ko/
|
||||
ko:
|
||||
main: ./cmd/mc-router/
|
||||
deploy:
|
||||
kubectl:
|
||||
manifests:
|
||||
- docs/k8s-deployment.yaml
|
Loading…
Reference in New Issue
Block a user