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

Fix apply Action within Example kubectl #1216

Merged
merged 3 commits into from
May 19, 2023

Conversation

j13tw
Copy link
Contributor

@j13tw j13tw commented May 19, 2023

Motivation

Fix the example of kubectl,
When used apply action, it will not inference the metadata.namespace within user provided resource yaml file,
So, it will got the mismatch namespace, error message below here

Error: ApiError: the namespace of the provided object does not match the namespace sent on the request: BadRequest (ErrorResponse { status: "Failure", message: "the namespace of the provided object does not match the namespace sent on the request", reason: "BadRequest", code: 400 })

Exactly says, the Api is link Namespace with default, but deploy resource is used metadata.namespace Field, which designed in yaml file, to deploy/apply resource to target Namespace.

Solution

Adding the namespace with DynamicObject Type Namespace, whole depacked with field metadata.namespace has value Option<String>, use it to inference Api<K> used which namespace.

When user provided yaml file of setting namespace, will used Field of metadate.namespace, if not setting (got None Type) will use thekubectl -n <Namespace> within kubectl APP.

Signed-off-by: ZhengSheng0524 <j13tw@yahoo.com.tw>
@j13tw j13tw changed the title Fix Example kubectl with apply Action Fix apply Action within Example kubectl May 19, 2023
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

Good catch. Thanks for this. Left a small suggestion that i think works.

examples/kubectl.rs Outdated Show resolved Hide resolved
@clux clux added this to the 0.83.0 milestone May 19, 2023
Co-authored-by: Eirik A <sszynrae@gmail.com>
Signed-off-by: Sheng Zheng <s1410432021@nutc.edu.tw>
@codecov
Copy link

codecov bot commented May 19, 2023

Codecov Report

Merging #1216 (f9cdd00) into main (311f588) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1216   +/-   ##
=======================================
  Coverage   73.49%   73.49%           
=======================================
  Files          68       68           
  Lines        5380     5380           
=======================================
  Hits         3954     3954           
  Misses       1426     1426           

Signed-off-by: ZhengSheng0524 <j13tw@yahoo.com.tw>
@clux clux added the changelog-exclude changelog excluded prs label May 19, 2023
@clux clux merged commit 49d33ec into kube-rs:main May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-exclude changelog excluded prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants