tilt-dev / tilt-dev/tilt

using custom_build w/ custom tag + unique helm template data, leads to k8s_yaml orphaned k8s objects

Open
#3,035 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
10.1k
Forks
413
Avg merge
1d 10h
Merged PRs (30d)
6

Description

I am doing something like the following

allow_k8s_contexts('mycluster')

gitCommitId = str(local('git describe --match=NeVeRmAtCh --always --abbrev=7 --dirty')).strip()

# generate yaml, all artifacts will have unique name that contains "appid" set below
templated_yaml = local('helm \
    template \
    --namespace my-apps \
    -f .tilt/chartvalues/myappp/stage/values.yaml \
    --set appid=myapp-{} \
    ./.tilt/appdeploy  \
    '.format(gitCommitId))

custom_build(
    ref='myreg.private.com/my/myapp',
    tag=gitCommitId,
    command='./generate-dockerfile-build-tag-only.sh -t {}'.format(gitCommitId),
    deps=['.'],
) 

k8s_yaml(templated_yaml)

If I do a tilt up I get the app deployed OK

If I change something in my local dir, tilt properly builds and deploys the artifacts that are generated. The names of the artifacts change as they now have "appid" in them which is my commit id.

If I do a tilt down, tilt only deletes the most recent set of k8s_yaml it applied.

None of previous sets it applied are cleaned up, the previous sets are orphaned.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the custom_build and k8s_yaml entry points and their resource lifecycle. Reproduce the sequence with tilt up, a local change, and tilt down using uniquely templated Kubernetes object names; done means tilt down removes all previously applied generated objects, not only the newest set.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, helm, kubernetes
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.