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

Maybe make-so the Tiltfile automatically retrieves the ip-address of the k8s node, for use as load-balancer external-ip #268

Closed
Venryx opened this issue Mar 12, 2024 · 3 comments
Assignees

Comments

@Venryx
Copy link
Collaborator

Venryx commented Mar 12, 2024

No description provided.

@maparent maparent self-assigned this Mar 12, 2024
@maparent
Copy link
Collaborator

From the command line, we can get all the nodes with kubectl get node -A, and then use the node pool's name as an argument in in
kubectl get node <node-pool-name> -o=json | jq '.status.addresses[] | if .type == "InternalIP" then .address else empty end '
So let's see if we can do the same within tilt.

@Venryx
Copy link
Collaborator Author

Venryx commented Mar 12, 2024

Tilt-files can run local commands using the local function: https://docs.tilt.dev/api.html#api.local

As for extracting the specific address field desired, a cross-platform alternative to jq could be the -o jsonpath k8s flag: https://kubernetes.io/docs/reference/kubectl/jsonpath/

@Venryx
Copy link
Collaborator Author

Venryx commented Mar 12, 2024

And for inserting that address into the node_port_service.yaml file, you can use the custom ReadFileWithReplacements function. Example here:

k8s_yaml(ReadFileWithReplacements('../Packages/app-server/deployment.yaml', {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants