Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Support false values in configuration file - #161

Merged
k8s-ci-robot merged 1 commit into
kubernetes-client:masterfrom
ganchurin:issue-954
Sep 24, 2019
Merged

k8s-ci-robot merged 1 commit into
kubernetes-client:masterfrom
ganchurin:issue-954

Conversation

@ganchurin

Copy link
Copy Markdown
Contributor

The purpose of this changes is to fix the issue: kubernetes-client/python#954

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @ganchurin!

It looks like this is your first PR to kubernetes-client/python-base 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-client/python-base has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 18, 2019
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 18, 2019
@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #161 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #161   +/-   ##
=======================================
  Coverage   93.56%   93.56%           
=======================================
  Files          13       13           
  Lines        1384     1384           
=======================================
  Hits         1295     1295           
  Misses         89       89
Impacted Files Coverage Δ
config/kube_config_test.py 95.19% <ø> (ø) ⬆️
config/kube_config.py 88.15% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5092d96...03e347a. Read the comment docs.

@ganchurin

Copy link
Copy Markdown
Contributor Author

/assign @yliaog

"server": TEST_SSL_HOST,
"certificate-authority-data":
TEST_CERTIFICATE_AUTH_BASE64,
"insecure-skip-tls-verify": False,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/False/"false" in consistent with the test case below

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@roycaihw Thanks for the suggestion! I've just tried to replace False with "false" and faced an issue - the unit test fails. I think the cause is in how "insecure-skip-tls-verify" property is handled in kube_config.py (https://github.com/kubernetes-client/python-base/blob/master/config/kube_config.py#L443). The code by the link casts a string to a boolean. Both "true" and "false" are casted to True. What do you think if I replace "true" with True in the older test?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"true" and "false" are the original values in kubeconfig yaml files (e.g. insecure-skip-tls-verify: false). The test cases are testing values stored in the KubeConfigLoader object.

Could you verify what's the behavior in the yaml loader? Does it load "false" into a boolean False, or does it keep the string value "false"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I verified the behavior on the configuration file which has the following lines:

clusters:
- cluster:
    insecure-skip-tls-verify: false

The following code snippet was used for the verification:

import yaml

with open(<PATH_TO_CONFIG>) as f:
    config = yaml.safe_load(f)
    print config (**breakpoint was set here**)

Debug showed the following value for the property:
'insecure-skip-tls-verify' (4523129968) = {bool} False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. Let's use True and False in the test cases then

@roycaihw

Copy link
Copy Markdown
Member

/lgtm
/approve

Thanks @ganchurin!

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 21, 2019
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ganchurin, roycaihw

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 21, 2019
@ganchurin

Copy link
Copy Markdown
Contributor Author

/retest

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

@ganchurin: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ganchurin

Copy link
Copy Markdown
Contributor Author

@roycaihw Could you please help me a bit? Some tests have failed after my update to the branch. I'm not sure that they relate to the scope of work. And I can't restart test run. Thanks in advance!

@micw523

micw523 commented Sep 21, 2019

Copy link
Copy Markdown
Contributor

/ok-to-test
???? What’s happening here? I didn’t remember we required ok to test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Sep 21, 2019
@micw523

micw523 commented Sep 21, 2019

Copy link
Copy Markdown
Contributor

The Travis CI is showing a ton of 404 and other errors. Try looking at the log - it is available.

@ganchurin

Copy link
Copy Markdown
Contributor Author

/retest

@ganchurin

Copy link
Copy Markdown
Contributor Author

@micw523 Thank you! I've taken a look.

I've noticed that the same tests fail in the latest build of "kubernetes-client/python" repository: https://travis-ci.org/kubernetes-client/python/builds/587650221

As for my pull request, previously the pull request had passed successfully. The single difference between successful and failed attempts is one line in unit tests that works fine for me locally. Thus I tend thinking that the issue is in "kubernetes-client/python" repository.

@micw523

micw523 commented Sep 21, 2019

Copy link
Copy Markdown
Contributor

The most recent build in k8s-python passed; I'm restarting your build to see if the test fail is a flake.

@ganchurin

Copy link
Copy Markdown
Contributor Author

@micw523 Sorry if I'm wrong - I was looking for builds here: https://travis-ci.org/kubernetes-client/python/builds. And the latest build is red.

@roycaihw

Copy link
Copy Markdown
Member

Test failure tracked in kubernetes-client/python#963. Let's fix the CI first and then merge this PR

@k8s-ci-robot
k8s-ci-robot merged commit c700068 into kubernetes-client:master Sep 24, 2019
@ganchurin
ganchurin deleted the issue-954 branch September 24, 2019 23:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants