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

Kubernetes-based Runtime Config #122

Merged
merged 8 commits into from
Mar 7, 2024
Merged

Kubernetes-based Runtime Config #122

merged 8 commits into from
Mar 7, 2024

Conversation

endocrimes
Copy link
Contributor

@endocrimes endocrimes commented Mar 4, 2024

closes: #10

@endocrimes endocrimes force-pushed the dani/runtimeconfig branch from 9c2fa74 to 1e12f1e Compare March 6, 2024 12:04
@endocrimes endocrimes changed the title wip: Kubernetes-based Runtime Config Kubernetes-based Runtime Config Mar 6, 2024
@endocrimes endocrimes marked this pull request as ready for review March 6, 2024 14:41
@endocrimes endocrimes requested a review from bacongobbler as a code owner March 6, 2024 16:30
@endocrimes endocrimes force-pushed the dani/runtimeconfig branch 4 times, most recently from da6ac51 to b5c4686 Compare March 6, 2024 18:21
Signed-off-by: Danielle Lancashire <[email protected]>
Signed-off-by: Danielle Lancashire <[email protected]>
This code is... not pleasant.

Runtime Config translation from kubernetes-native api through to
spin-native api is rather complex when accounting for the number of
places secrets and config maps can be referenced.

This commit attempts to at least shove all of the nastier bits into a
single package that can be _mostly_ ignored.

Signed-off-by: Danielle Lancashire <[email protected]>
…ntal exposure harder

Signed-off-by: Danielle Lancashire <[email protected]>
Signed-off-by: Danielle Lancashire <[email protected]>

type SqliteDatabaseConfig struct {
Name string `json:"name"`
Type string `json:"type"`
Copy link
Contributor

Choose a reason for hiding this comment

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

what are valid values for type here? should we validate input? should we omitempty and default to on-disk?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The operator technically doesn't know - because we have no way to discover them from spin. I'd like to avoid defaulting mostly because of that.


type KeyValueStoreConfig struct {
Name string `json:"name"`
Type string `json:"type"`
Copy link
Contributor

Choose a reason for hiding this comment

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

same question as above for type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As above

Copy link
Contributor

@calebschoepp calebschoepp left a comment

Choose a reason for hiding this comment

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

Really nice work

// e.g on-disk or turso.
SqliteDatabases []SqliteDatabaseConfig `json:"sqliteDatabases,omitempty"`

KeyValueStores []KeyValueStoreConfig `json:"keyValueStores,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

This could use a doc comment

Copy link
Contributor

Choose a reason for hiding this comment

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

@endocrimes please followup here in a subsequent PR


KeyValueStores []KeyValueStoreConfig `json:"keyValueStores,omitempty"`

LLMCompute *LLMComputeConfig `json:"llmCompute,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

This could use a doc comment

Copy link
Contributor

Choose a reason for hiding this comment

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

@endocrimes please followup here in a subsequent PR

key: "turso-token"

llmCompute:
type: "remote_http"
Copy link
Contributor

Choose a reason for hiding this comment

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

Will all this runtime config just work out of the box if someone applied this sample? If not I think we should add some comments to explain how someone could apply this sample and use it. I also think we should still keep around a sample that shows loading the runtime config from a secret.

Copy link
Contributor

Choose a reason for hiding this comment

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

@endocrimes please followup here in a subsequent PR

// path = "/mnt/store/redis.db"
//
// To maximize compatibility with different spin options + custom builds, we do
// very little validation of runtime config options in the operator.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for this very thorough comment. This is amazing!


runtimeConfig := app.Spec.RuntimeConfig
if runtimeConfig.LoadFromSecret != "" {
// TODO: Should we block on the runtime config secret for consistency?
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this question

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you provide a wholesale runtime config (LoadFromSecret) should we block on that secret existing, like we do if we render runtime config for you

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah probably, that seems like a good pattern to follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool i'll include that in follow up tomorrow (that was also my preference 😅 )

@calebschoepp calebschoepp self-requested a review March 7, 2024 17:05
Copy link
Contributor

@calebschoepp calebschoepp left a comment

Choose a reason for hiding this comment

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

LGTM! There a couple outstanding concerns, but in an effort to unblock other work for 0.0.1 release this is a good enough start to merge. We can iterate in future PRs.

@calebschoepp calebschoepp merged commit 88ea720 into main Mar 7, 2024
10 checks passed
@calebschoepp calebschoepp deleted the dani/runtimeconfig branch March 7, 2024 17:06
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.

Model Spin RuntimeConfig in the Spin App custom resource
3 participants