Skip to content
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

test: k8s justfile and fixes #2073

Merged
merged 1 commit into from
Jul 15, 2024
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
3 changes: 3 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ PROTOS_OUT := "backend/protos/xyz/block/ftl/v1/console/console.pb.go backend/pro
_help:
@just -l

k8s command="_help" *args="":
just deployment/{{command}} {{args}}

# Run errtrace on Go files to add stacks
errtrace:
git ls-files -z -- '*.go' | grep -zv /_ | xargs -0 errtrace -w && go mod tidy
Expand Down
32 changes: 32 additions & 0 deletions deployment/Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
_help:
@just -l

deploy:
kubectl kustomize --load-restrictor=LoadRestrictionsNone | kubectl apply -f -

delete:
kubectl kustomize --load-restrictor=LoadRestrictionsNone | kubectl delete -f -

delete-db:
kubectl delete pvc postgres-db-ftl-pg-cluster-1-0

events:
kubectl get events -w

ps:
kubectl get deployment,pod,statefulset,svc,configmap,pv,pvc,ingress -o wide

logs *args:
kubectl logs -f {{args}}

exec pod *args:
kubectl exec -t {{pod}} -- {{args}}

enter pod *args="bash":
kubectl exec -it {{pod}} -- {{args}}

psql:
just enter statefulset.apps/ftl-pg-cluster-1 env PGPASSWORD=secret psql -U postgres ftl

ftl-status:
just exec deployment/ftl-controller ./ftl status
20 changes: 0 additions & 20 deletions deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,6 @@ info: Listening on http://0.0.0.0:8892
info: Starting DB listener
```

## To deploy a local ftl-controller or ftl-runner image

Build the image locally:

```
make docker-controller
```

Tag the image for the local registry:

```
docker tag ftl0/ftl-controller:latest localhost:5000/ftl-controller
```

Push the image to the local registry:

```
docker push localhost:5000/ftl-controller
```

## Debugging

To exec into the k3d node:
Expand Down
3 changes: 2 additions & 1 deletion deployment/db-migrate/kustomization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ resources:
configMapGenerator:
- name: ftl-db-migrate-config
files:
- schema/001_init.sql
- schema/20231103205514_init.sql
- schema/20240704103403_create_module_secrets.sql
47 changes: 27 additions & 20 deletions deployment/ftl-controller/ftl-controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ spec:
fieldPath: status.podIP
- name: FTL_CONTROLLER_DSN
value: "postgres://ftl-pg-cluster/ftl?sslmode=disable&user=postgres&password=secret"
- name: FTL_CONTROLLER_INGRESS_BIND
value: "http://$(MY_POD_IP):8891"
- name: FTL_CONTROLLER_BIND
value: "http://$(MY_POD_IP):8892"
- name: FTL_CONTROLLER_ADVERTISE
value: ""
ports:
- containerPort: 8891
- containerPort: 8892
readinessProbe:
httpGet:
Expand All @@ -48,9 +51,13 @@ metadata:
name: ftl-controller
spec:
ports:
- name: 80-8892
port: 80
- name: ingress
protocol: TCP
port: 8891
targetPort: 8891
- name: controller
protocol: TCP
port: 8892
targetPort: 8892
selector:
app: ftl-controller
Expand All @@ -67,21 +74,21 @@ spec:
# name: ftl-controller
# minReplicas: 1
# maxReplicas: 10
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ftl-controller
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ftl-controller
port:
number: 80
#---
#apiVersion: networking.k8s.io/v1
#kind: Ingress
#metadata:
# name: ftl-controller
# annotations:
# ingress.kubernetes.io/ssl-redirect: "false"
#spec:
# rules:
# - http:
# paths:
# - path: /
# pathType: Prefix
# backend:
# service:
# name: ftl-controller
# port:
# number: 8892
Loading