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

Bug 1795035: Give reason for not using cloud provider CA cert #80

Merged
merged 1 commit into from Jan 30, 2020

Conversation

mandre
Copy link
Member

@mandre mandre commented Jan 26, 2020

This makes it easier to debug in case CAPO can't read the CA cert from
the openshift-config/cloud-provider-config configmap.

@mandre
Copy link
Member Author

mandre commented Jan 26, 2020

/bugzilla refresh

@openshift-ci-robot
Copy link

@mandre: This pull request references Bugzilla bug 1795035, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

/bugzilla refresh

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.

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Jan 26, 2020
@@ -185,7 +185,8 @@ func NewInstanceServiceFromMachine(kubeClient kubernetes.Interface, machine *mac
}

cacert, err := getCACertFromConfigmap(kubeClient, "openshift-config", "cloud-provider-config", "ca-bundle.pem")
if err != nil || cacert == "" {
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

watch out: the cacert == "" condition now leads to calling NewInstanceServiceFromCloud with a non-nil argument ([]byte(""), which is a non-nil slice of length zero). In NewInstanceServiceFromCloud, that will trigger the code for adding a new CA

if cert != nil {
certPool, err := x509.SystemCertPool()
if err != nil {
return nil, fmt.Errorf("Create system cert pool failed: %v", err)
}
certPool.AppendCertsFromPEM(cert)
client := http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
RootCAs: certPool,
},
},
}
provider.HTTPClient = client
}

Copy link

@iamemilio iamemilio Jan 27, 2020

Choose a reason for hiding this comment

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

I think the way @mandre sets the warning is correct. Validation should be done here logically:

I also think a separate bz+ pr should handle this though. I'd be ok to lgtm this

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that was intentional. I think we shouldn't do validation on the cert and instead defer to the certPool.AppendCertsFromPEM(cert) call below to know what to do with an empty string.

It should be pretty obvious to debug if the user sets the configmap entry to an empty string by mistake.

Choose a reason for hiding this comment

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

Pierre made a good point in our conversation. The block of code wrapped in the conditional he linked above should only run if there is a cert. By default, we set the cert to "", so this means that this code block always runs by default, which is confusing.

Copy link

@adduarte adduarte Jan 29, 2020

Choose a reason for hiding this comment

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

would it make sense to move the cacert == "" to inside NewInstanceServiceFromCloud?

like so if (cert != nil && cert != ""),
It would catch any calls to the function that pass in a cert = "" condition.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd rather not make any assumption about the value of cert other than it's not nil if certPool.AppendCertsFromPEM(cert) is capable of dealing with it.

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 30, 2020
This makes it easier to debug in case CAPO can't read the CA cert from
the `openshift-config/cloud-provider-config` configmap.
@pierreprinetti
Copy link
Member

/lgtm
/honk

@openshift-ci-robot
Copy link

@pierreprinetti:
goose image

In response to this:

/lgtm
/honk

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.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mandre, pierreprinetti

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [mandre,pierreprinetti]

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

@openshift-merge-robot openshift-merge-robot merged commit ef82ce3 into openshift:master Jan 30, 2020
@openshift-ci-robot
Copy link

@mandre: All pull requests linked via external trackers have merged. Bugzilla bug 1795035 has been moved to the MODIFIED state.

In response to this:

Bug 1795035: Give reason for not using cloud provider CA cert

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.

@openshift-ci-robot
Copy link

@mandre: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-openstack 3641ea3 link /test e2e-openstack

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants