-
-
Notifications
You must be signed in to change notification settings - Fork 301
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
Add a kubectl like example #885
Conversation
For #884 finding lots of little api snags that can be improved. Signed-off-by: clux <sszynrae@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #885 +/- ##
==========================================
+ Coverage 70.35% 70.37% +0.02%
==========================================
Files 62 62
Lines 4264 4264
==========================================
+ Hits 3000 3001 +1
+ Misses 1264 1263 -1
|
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Sorry, I've been sick for the past week and haven't had the energy to look deeper here.. :/ |
Don't worry. This is pretty inconsequential. |
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 push up a branch with suggestions in a moment...
examples/kubectl.rs
Outdated
type KindMap = BTreeMap<String, (ApiResource, ApiCapabilities)>; | ||
async fn discover_valid_inputs(client: Client) -> Result<KindMap> { | ||
let mut kinds = BTreeMap::new(); // valid inputs (keys are plural or kind) | ||
let discovery = Discovery::new(client).run().await?; |
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.
Not specific to this, but looks like Discovery::run
fails if any aggregated service is unavailable, even if it's something relatively inconsequential like metrics.
Kubectl seems to be robust against 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.
kubectl
creates a cache of the discovery results in ~/.kube/cache
. i didn't want to overdo this example though.
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, but even then I think kubectl will just log failures and keep going with the rest. Either way this is more of a kube-client issue than anything related to the kubectl example in particular.
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.
oh, i misunderstood. you're not talking about general failures, but aggregated ones going out to separate services. that might be something we could tweak in the discovery interface in the future, yeah.
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, exactly.
Ok, uploaded my suggestions to kubectl-example...teozkr:kubectl-example-/teozkr-suggestions, feel free to cherry pick or merge as you think makes sense. |
I'd definitely include at least a minor note for this in the changelog, even if it's not something that affects the library crates directly this kind of dynamism is something that we've done a relatively poor job documenting and highlighting in our examples. |
single-use index Signed-off-by: Teo Klestrup Röijezon <teo@nullable.se>
Signed-off-by: Teo Klestrup Röijezon <teo@nullable.se>
Signed-off-by: Teo Klestrup Röijezon <teo@nullable.se>
Signed-off-by: Teo Klestrup Röijezon <teo@nullable.se>
Signed-off-by: Teo Klestrup Röijezon <teo@nullable.se>
kubectl actually gives preference to --all over -n so they can technically be used together Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Have cherry-picked (grabbed all) and updated as much as possible. Ended up reverting the namespace stuff to keep that part smaller (and deal with a kubectl edge case), but kept everything else. Great stuff! I would ideally like to merge #887 first to be able to get deterministic discovery in here. But beyond that, am happy here. Pulled in the big |
FWIW the new resolution should be deterministic without sorting the list, because of the |
Ah, that's true. I missed that part. Looks perfectly equivalent in this case. Happy to merge without it then. |
Hm, might be worth adding a comment calling it out. |
Signed-off-by: clux <sszynrae@gmail.com>
something like this? |
Fun project for #884
Found a couple of minor api snags that can be improved, reported separately in:
NB: This branch does not rely on these PRs (however the behaviour is erratic without the determinism fix).