Skip to content

Use a dagger core command as readiness probe - #8219

Merged
matipan merged 3 commits into
dagger:mainfrom
matipan:helm-engine-healthcheck
Aug 27, 2024
Merged

matipan merged 3 commits into
dagger:mainfrom
matipan:helm-engine-healthcheck

Conversation

@matipan

@matipan matipan commented Aug 23, 2024 •

Copy link
Copy Markdown
Contributor

Since #6100 (comment) that using buildctl as the healthcheck for the engine is essentially a no-op. There is an on-going discussion here of what the ideal healthcheck for the engine would be, we haven't yet reached a conclusion but now that we have the dagger CLI in the engine image and the core subcommand we can use something more suitable on our helm chart. I don't think this should be considered as "the way" to check for engine readiness, but its the best I could come up with and what we were doing was already broken.

Internally we were doing something similar to this already, but taking care of downloading the CLI and using dagger query. Now with the CLI in the engine image and the core subcommand we can simplify it and officially release it here.

There were many possible dagger core commands I could use. I chose one that would force the engine to do work but not depend on external registry or networks.

- sh
- -exc
- |-
dagger core container with-new-file --contents "We are ready" --path "/tmp/ready" file --path "/tmp/ready" contents

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great, much needed change!

Instead of using dagger core which is unstable and likely to change - see #8135 - I propose that we use this command instead: echo "{ directory { id } }" | dagger query

FTR:

❯ echo "{ directory { id } }" | time dagger query
Setup tracing at https://dagger.cloud/traces/setup. To hide: export SHUTUP=1

✔ connect 0.7s
✔ cache request: mkfile /schema.json 0.0s
✔ load cache: mkfile /schema.json 0.0s
✔ cache request: blob://sha256:b618d3d179857032b7a416ad037342be687116289c0fd1cc8b4a39a9f2d65d4e 0.0s
✔ load cache: blob://sha256:b618d3d179857032b7a416ad037342be687116289c0fd1cc8b4a39a9f2d65d4e 0.0s
✔ moduleSource(refString: "."): ModuleSource! 0.0s
✔ ModuleSource.kind: ModuleSourceKind! 0.0s
✔ directory: Directory! 0.0s

{
    "directory": {
        "id": "ChV4eGgzOmMwMmVlMmZiODlhYjRmMDQSSgoVeHhoMzpjMDJlZTJmYjg5YWI0ZjA0EjESDQoJRGlyZWN0b3J5GAEaCWRpcmVjdG9yeUoVeHhoMzpjMDJlZTJmYjg5YWI0ZjA0"
    }
}
dagger query  0.16s user 0.14s system 20% cpu 1.492 total

After dagger core stabilises, we can easily switch to it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add to this - we don't even need to do a full operation at all, we could just do { version } as a query. We're really just interested if the dagger server is running at all, I don't think we need to simulate an operation here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea, I like that!

@gerhard gerhard added this to the v0.12.6 milestone Aug 27, 2024

@gerhard gerhard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 🚀

@jedevc

jedevc commented Aug 27, 2024

Copy link
Copy Markdown
Contributor

Potentially worth a changelog entry? Up to ya 🎉

matipan and others added 3 commits August 27, 2024 15:01
Nice idea Justin 👍

Signed-off-by: Gerhard Lazu <[email protected]>
Signed-off-by: Matias Pan <[email protected]>
@matipan
matipan force-pushed the helm-engine-healthcheck branch from 3caa232 to 50a6f28 Compare August 27, 2024 18:01
@matipan
matipan merged commit 5bb9540 into dagger:main Aug 27, 2024
@matipan
matipan deleted the helm-engine-healthcheck branch August 27, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants