forked from harrytucker/cactuar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
65 lines (53 loc) · 2.07 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
NAME := "controller"
ORG := "kube-rs"
VERSION := `git rev-parse HEAD`
SEMVER_VERSION := `grep version Cargo.toml | awk -F"\"" '{print $2}' | head -n 1`
default:
@just --list --unsorted --color=always | rg -v " default"
# generate and install crd into the cluster
install-crd:
cargo run --bin crdgen > yaml/crd.yaml
kubectl apply -f yaml/crd.yaml
# run with opentelemetry
run-telemetry:
OPENTELEMETRY_ENDPOINT_URL=https://0.0.0.0:55680 RUST_LOG=info,kube=debug,controller=debug cargo run --features=telemetry
# run without opentelemetry
run:
RUST_LOG=info,kube=debug,controller=debug cargo run
# compile for musl (for docker image)
compile features="":
#!/usr/bin/env bash
docker run --rm \
-v cargo-cache:/root/.cargo \
-v $PWD:/volume \
-w /volume \
-t clux/muslrust:stable \
cargo build --release --features={{features}} --bin controller
cp target/x86_64-unknown-linux-musl/release/controller .
# docker build (requires compile step first)
build:
docker build -t {{ORG}}/{{NAME}}:{{VERSION}} .
# retag the current git versioned docker tag as latest, and publish both
tag-latest:
docker tag {{ORG}}/{{NAME}}:{{VERSION}} {{ORG}}/{{NAME}}:latest
docker push {{ORG}}/{{NAME}}:{{VERSION}}
docker push {{ORG}}/{{NAME}}:latest
# retag the current git versioned docker tag as the current semver and publish
tag-semver:
#!/usr/bin/env bash
if curl -sSL https://registry.hub.docker.com/v1/ORGsitories/{{ORG}}/{{NAME}}/tags | jq -r ".[].name" | grep -q {{SEMVER_VERSION}}; then
echo "Tag {{SEMVER_VERSION}} already exists - not publishing"
else
docker tag {{ORG}}/{{NAME}}:{{VERSION}} {{ORG}}/{{NAME}}:{{SEMVER_VERSION}} .
docker push {{ORG}}/{{NAME}}:{{SEMVER_VERSION}}
fi
# local helpers for debugging traces
# forward grpc otel port from svc/promstack-tempo in monitoring
forward-tempo:
kubectl port-forward -n monitoring svc/promstack-tempo 55680:55680
# forward http port from svc/promstack-grafana in monitoring
forward-grafana:
kubectl port-forward -n monitoring svc/promstack-grafana 8000:80
# mode: makefile
# End:
# vim: set ft=make :