-
Notifications
You must be signed in to change notification settings - Fork 521
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
k8s static pods support #1317
k8s static pods support #1317
Conversation
0ad2507
to
1a4fb2c
Compare
This comment has been minimized.
This comment has been minimized.
571d157
to
c5ee2a4
Compare
c5ee2a4
to
fda4739
Compare
Push above adds some documentation to the settings section of the top-level README. |
fda4739
to
e3e9e1a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 🎉
Just out of curiosity and may not be relevant at all to the changes.
I was wondering what would happen if someone sends incorrect manifest file ? I think Kubernetes would not launch a pod for it. However, how can someone debug such cases.
If a user sends a poorly formatted manifest file, kubelet would just ignore that manifest. To debug, by virtue of not seeing the pod come up, the user would need to recheck their manifest. If they would like to see kubelet's log, then they'd have to go through logdog. |
I'll remove the conditional compilation from ecs-settings-applier and do the same for it in |
a4b0608
to
ccd6d3c
Compare
Push above addresses #1317 (comment) |
ccd6d3c
to
a247105
Compare
Push above rebases onto develop to fix merging conflicts. |
b95fbf2
to
8542789
Compare
8542789
to
d409af8
Compare
d409af8adac486f904bc4216bdf8328fa2a31bb9 adds the migration for migrating the new static-pods settings. Tested the migration and it works as expected on downgrades and upgrades. |
"static-pods", | ||
"pluto" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Not now, but I wonder if there's a k8s.spec
and k8s
package for these in our future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or a k8s-release
- but pluto
is AWS-specific where static-pods
is not.
Makefile.toml
Outdated
# Exclude Kubernetes specific packages from being built if the variant isn't Kubernetes specific | ||
if ! echo "${VARIANT}" | grep -q "k8s"; then | ||
EXCLUDE="--exclude static-pods pluto" | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels so far away from other conditionals. :(
I think this also means that I can no longer run:
cd sources
export VARIANT=aws-ecs-1 && cargo build
Which makes me sad (and might have IDE ramifications, not sure). Are we sure this is how we want to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There has to be a conditional somewhere for this unit test task to work. Either we continue conditionally compiling variant specific binaries, or we do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I realize that's the problem we're solving for. With ecs-settings-applier, the build.rs exports a cfg and the 'guts' are not compiled unless its ecs.
The problem with your approach is that the rust workspace is no longer usable on its own and we're moving toward a reliance on the makefile for things to work at all.
Both solutions are undesirable, so I'm not demanding a change here, but inviting discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for jumping in between the conversation.
cd sources
export VARIANT=aws-ecs-1 && cargo build
@webern Why won't this work ? This conditional is not inside sources
dir packages right ? Not able to figure out how it affects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that the reason @etungsten added this to the makefile is because the pluto
and static-pods
packages will fail to compile unless the model
package is set to use k8s
settings. If we try to compile the workspace for ECS, the model
will have the wrongs structs and our build will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically tasks.unit-tests
will fail because it just compiles everything in the workspace with the same VARIANT env var.
Regarding the cd sources; export VARIANT=aws-ecs-1 && cargo build
use case. I feel like that's somewhat unusual. What reasons are there for people wanting to build the entire workspace without going through the Makefile? I would understand if people wanted to build specific workspace components for testing or w.e. But if they want to build everything in the workspace for use, shouldn't they just go through building the OS package via the Makefile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with your original conditional compilation for static-pods if it makes the overall workspace easier to build. I like the property that these crates can be built without bringing the entire build system to bear.
I'd prefer to get to the point where the entire sources tree can be built for each model simultaneously, and although the Makefile.toml
workaround doesn't preclude that, it may invite us to continue segmenting the tree in ad-hoc ways rather than driving toward that goal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use the workspace without bringing the build system to bear all the time. I'm not sure how to describe the use case, but having a workspace that can't be compiled with cargo build
or cargo test
seems to defeat the purpose of a workspace. Right now the only "gotchya" is that the VARIANT
env is needed, and the error messages document this very well (I often forget, read the error then export a VARIANT).
I think the options are:
- Merge this as is with the
Makefile.toml
changes, and no longer can wecargo build
the workspace (without adding the--exclude
statements depending onVARIANT
), or - Change to the
cfg
solution that we used withecs-settings-applier
so that we can always build all of the workspace, but the incompatible code is 'commented out'.
@bcressey are you saying that you choose #1
and that, because the workspace no longer builds, we may be more motivated to fix it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll revert back to conditionally compiling static-pods since that's what people seem to prefer so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bcressey are you saying that you choose
#1
and that, because the workspace no longer builds, we may be more motivated to fix it?
No, I was agreeing with you and I prefer #2
.
d409af8
to
8ea2514
Compare
Push above addresses @webern 's comment #1317 (comment) Revamps arg parsing error handling. Still works as expected:
|
sources/api/static-pods/src/main.rs
Outdated
ensure!( | ||
code.is_success(), | ||
error::APIResponse { | ||
method, | ||
uri, | ||
code, | ||
response_body, | ||
} | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you actually need this? Both apiclient::raw_request
and schnauzer::get_settings
(through schnauzer::get_json
) have this check already
8ea2514
to
e7c7518
Compare
Push above addresses @samuelkarp @arnaldo2792's comment. Things still work as expected. |
e7c7518
to
21484b0
Compare
Push above sheds a few unnecessary imports. |
Adds a set of new settings for managing k8s static pods. Adds a new binary helper to manage k8s static pod manifests.
Specify pod manifest path in kubelet config for all kubernetes variants.
We only need to build pluto for kubernetes variants
Adds a new migration for new k8s static-pods settings
21484b0
to
de6926b
Compare
Push above reverts back to conditionally compiling static-pods based on the VARIANT env var. Drops changes to tasks.unit-tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happier with the cfg approach than the Makefile approach for conditional compilation, but I'll survive either way :)
Issue number:
N/A
Description of changes:
Testing done:
Verified that buildsys does not build the package for non-k8s variants.
Build aws-k8s-1.15, aws-k8s-1.16, aws-k8s-1.17, aws-k8s-1.18, aws-k8s-1.19 images and launched instances for all of them
Kubelet started up fine.
Then I specified a static pod that ran nginx on port 80 with host networking:
The base64 blob decodes to the following:
Observed that the manifest gets created successfully in the pod manifest path:
Then curling localhost:80 from within the admin container I can see nginx is running as expected:
Checking pods via kubectl, I can see mirror pod entries in the k8s API:
Disabling the static pod by setting
enabled
tofalse
also works as expected. The manifest file gets correctly deleted.Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.