Skip to content

Conversation

@danehans
Copy link
Contributor

Adds support for for TLS-based probes for validating a httpsProxy using one or more readinessEndpoints that contain a https scheme.

Requires #271

/assign @squeed @bparees

PTAL at this block and this block. All other changes are due to the #271 dependency.

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 14, 2019
@bparees
Copy link

bparees commented Aug 15, 2019

last 2 commits (the ones that add the probes) lgtm

@danehans danehans force-pushed the ca_bundle_controller_https_readiness branch from 4ffd8e8 to c0dff8d Compare August 15, 2019 21:03
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 15, 2019
@danehans danehans force-pushed the ca_bundle_controller_https_readiness branch from c0dff8d to 00e45e8 Compare August 16, 2019 17:20
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 16, 2019
@danehans danehans force-pushed the ca_bundle_controller_https_readiness branch from 00e45e8 to 9a01682 Compare August 16, 2019 17:23
@danehans danehans changed the title WIP: Adds proxy https readinessEndpoints support Adds proxy https readinessEndpoints support Aug 16, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 2019
@danehans danehans force-pushed the ca_bundle_controller_https_readiness branch 2 times, most recently from 3007873 to 6b52e70 Compare August 16, 2019 17:28
Copy link
Contributor

@knobunc knobunc left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 16, 2019
@danehans danehans force-pushed the ca_bundle_controller_https_readiness branch from 6b52e70 to caa304d Compare August 16, 2019 20:25
func (r *ReconcileProxyConfig) validateTrustedCA(trustedCA string) ([]*x509.Certificate, []byte, []byte, error) {
if len(trustedCA) == 0 {
trustedCA = names.TRUSTED_CA_BUNDLE_CONFIGMAP
}
Copy link

Choose a reason for hiding this comment

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

i think this logic (and the comment above) are still incorrect, per my earlier comment.

If "trustedCA" is empty that means "proxyconfig.trustedca.name" is empty (in other words, the admin has not pointed us to a configmap of user provided CAs).

If that is the case:

  1. there's no point in validating anything
  2. we should be returning the system trust bundle (ie the trust bundle included in our image). Not the openshift-config-managed CM bundle.

There is never a reason to validate the openshift-config-managed CM bundle, as this is controller is itself responsible for producing that CM, so it better be valid for us to have produced it. Furthermore the purpose of the validation we are doing here is to ensure that the CA bundle can be used to talk to the proxy. That needs to happen before we copy any bundles into openshift-config-managed, because once it's in openshift-config-managed, it's going to get injected into the various consumer CMs. So validating openshift-config-managed isn't useful (it's too late).

Copy link
Contributor Author

@danehans danehans Aug 19, 2019

Choose a reason for hiding this comment

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

If "trustedCA" is empty that means "proxyconfig.trustedca.name" is empty (in other words, the admin has not pointed us to a configmap of user provided CAs).

@bparees understood. I'm calling validateTrustedCA() instead of making multiple func calls to get the trusted-ca-bundle configmap, parse the data key into a []byte and then parse the []byte into a []*x509.Certificate that is used as a parameter for the validateReadinessEndpoint() func. Some of the funcs can be improved and renamed to remove the validation prefix, but I would prefer doing that in a follow-on PR at this point.

we should be returning the system trust bundle (ie the trust bundle included in our image). Not the openshift-config-managed CM bundle.

trusted-ca-bundle configmap contains the system trust bundle whether or not trustedCA is set. Even if I used the local system trust bundle, I would have to make multiple calls to read the local trust bundle file, parse the file into a []byte and then parse the []byte into a []*x509.Certificate that is used as a parameter for the validateReadinessEndpoint() func. validateTrustedCA() already does this, so I prefer to use the func for the time being and I can improve how the funcs are composed in a future PR.

I have updated the call to validateTrustedCA() to use "trusted-ca-bundle" and removed:

-       if len(trustedCA) == 0 {
-               trustedCA = names.TRUSTED_CA_BUNDLE_CONFIGMAP
-       }

Copy link

Choose a reason for hiding this comment

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

this logic needs to validate that the set of CAs we are going to publish into trusted-ca-bundle, are sufficient to talk to the proxy in question.

So we cannot use the current set off CAs in trusted-ca-bundle to do that, we need to produce the new bundle (ie "just the system CAs" or "system CAs plus the new user provided CAs") and use that bundle to perform the validation(readiness checks)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need to produce the new bundle (ie "just the system CAs" or "system CAs plus the new user provided CAs") and use that bundle to perform the validation(readiness checks)

@bparees I pushed a new commit that accomplishes this workflow. See this testing doc for details. When proxy.spec.trustedCA is updated, openshift-config-managed/trusted-ca-bundle configmap is updated before proxy config validation (i.e. running readinessEndpoints probes). openshift-config-managed/trusted-ca-bundle will contain the combined user/system bundle if proxy.spec.trustedCA is updated to a configmap with a different user-proivded bundle. openshift-config-managed/trusted-ca-bundle will contain only the system bundle if proxy.spec.trustedCA is empty. The controller will use this bundle for validating the httpsProxy using readinessEndpoints that contain a https scheme. If the https proxy's identity cert has been signed by a ca outside the system trust bundle and proxy.spec.trustedCA is empty, the readiness probe will fail.

@danehans danehans force-pushed the ca_bundle_controller_https_readiness branch from caa304d to da7a44f Compare August 19, 2019 05:10
@danehans danehans force-pushed the ca_bundle_controller_https_readiness branch 2 times, most recently from 3a15440 to efcdf2d Compare August 21, 2019 04:53
@danehans
Copy link
Contributor Author

/test e2e-aws-ovn-kubernetes

@danehans danehans force-pushed the ca_bundle_controller_https_readiness branch from efcdf2d to 8fd3311 Compare August 22, 2019 15:50
@openshift-ci-robot
Copy link
Contributor

@danehans: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-aws-ovn-kubernetes 8fd3311 link /test e2e-aws-ovn-kubernetes

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.

Details

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.

@danehans danehans force-pushed the ca_bundle_controller_https_readiness branch from 8fd3311 to ab80742 Compare August 22, 2019 19:44
@bparees
Copy link

bparees commented Aug 22, 2019

/lgtm

future refactor should:

  1. only generate the proposed bundle a single time (and then pass it to Validate, instead of having Validate construct its own bundle) so that we are actually validating the same bundle we ultimately publish
  2. combine/refactor the two codepaths for "did the proxyconfig change" and "did the configmap change" since both codepaths basically do the same thing, it's just duplicated code.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 22, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, danehans, knobunc

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

@openshift-merge-robot openshift-merge-robot merged commit 98d9bed into openshift:master Aug 22, 2019
@danehans danehans deleted the ca_bundle_controller_https_readiness branch August 22, 2019 22:16
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants