Skip to content

Conversation

@Miciah
Copy link
Contributor

@Miciah Miciah commented May 14, 2020

Create a configmap that is annotated to request injection of the service CA bundle, and configure ingress controller deployments to mount this configmap and use it instead of using the service account token to get the service CA.

  • assets/router/deployment.yaml: Add a volume and volume mount for the new configmap, and set the DEFAULT_DESTINATION_CA_PATH environment variable to configure openshift-router to use the bundle from the configmap.
  • pkg/manifests/bindata.go: Regenerate.
  • pkg/operator/controller/ingress/controller.go (ensureIngressController): Call ensureServiceCAConfigMap once the openshift-ingress namespace has been created and before creating the deployment.
  • pkg/operator/controller/ingress/serviceca_configmap.go: New file.
    (ensureServiceCAConfigMap): New method. Ensure the configmap for the service CA bundle exists.
    (desiredServiceCAConfigMap): New function. Return the desired configmap for the service CA bundle.
    (currentServiceCAConfigMap): New method. Return the current configmap for the service CA bundle.
    (updateServiceCAConfigMap): New method. Update the service CA configmap bundle if the expected annotation is missing.
  • pkg/operator/controller/names.go (ServiceCAConfigMapName): New function. Return the name of the configmap for the service CA bundle.

@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. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. labels May 14, 2020
@openshift-ci-robot
Copy link
Contributor

@Miciah: This pull request references Bugzilla bug 1813894, which is valid. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)
Details

In response to this:

WIP: Bug 1813894: Add configmap for service CA bundle

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 May 14, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 14, 2020
@Miciah Miciah force-pushed the BZ1813894-add-configmap-for-service-CA-bundle branch 2 times, most recently from aed81db to 34bb971 Compare May 17, 2020 17:12
@Miciah
Copy link
Contributor Author

Miciah commented May 18, 2020

/test e2e-aws-operator

/retitle Bug 1813894: Add configmap for service CA bundle

@openshift/openshift-team-network-edge, this is ready for review.

@openshift-ci-robot openshift-ci-robot changed the title WIP: Bug 1813894: Add configmap for service CA bundle Bug 1813894: Add configmap for service CA bundle May 18, 2020
@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 May 18, 2020
// Returns a Boolean indicating whether the configmap was updated, and an error
// value.
func (r *reconciler) updateServiceCAConfigMap(current, desired *corev1.ConfigMap) (bool, error) {
if current.Annotations["service.beta.openshift.io/inject-cabundle"] == "true" {
Copy link
Contributor

Choose a reason for hiding this comment

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

This acts as a gate? Once present we never update - is that the implied semantics? If so, maybe the check should occur by callers of updateServiceCAConfigMap so that update always means update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is pretty much right: cluster-ingress-operator manages the configmap's lifecycle and annotation, and the serving cert signer manages the data. If the configmap's annotation were deleted, cluster-ingress-operator would restore it, but otherwise it should not update the configmap. Would it be best to fold updateServiceCAConfigMap into ensureServiceCAConfigMap?

Copy link
Contributor

Choose a reason for hiding this comment

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

For me this was mostly about the semantics. A function called update... doesn't always update, but only if you peek at its implementation. If it is only called from one place them maybe folding would help.

Copy link
Contributor Author

@Miciah Miciah May 18, 2020

Choose a reason for hiding this comment

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

Here, "update" means "update if needed", and in this particular case, "if needed" means "if the critical annotation is not set properly". It is kind of a degenerate case of a pattern we use elsewhere in the operator, where ensureFoo calls createFoo, deleteFoo, and updateFoo, and updateFoo determines whether update is needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, fine for me. Thanks for explaining the pattern.

Create a configmap that is annotated to request injection of the service CA
bundle, and configure ingress controller deployments to mount this
configmap and use it instead of using the service account token to get the
service CA.

See bug 1813894.

https://bugzilla.redhat.com/show_bug.cgi?id=1813894

* assets/router/deployment.yaml: Add a volume and volume mount for the new
configmap, and set the DEFAULT_DESTINATION_CA_PATH environment variable to
configure openshift-router to use the bundle from the configmap.
* pkg/manifests/bindata.go: Regenerate.
* pkg/operator/controller/ingress/controller.go (ensureIngressController):
Call ensureServiceCAConfigMap once the "openshift-ingress" namespace has
been created and before creating the deployment.
* pkg/operator/controller/ingress/serviceca_configmap.go: New file.
(ensureServiceCAConfigMap): New method.  Ensure the configmap for the
service CA bundle exists.
(desiredServiceCAConfigMap): New function.  Return the desired configmap
for the service CA bundle.
(currentServiceCAConfigMap): New method.  Return the current configmap for
the service CA bundle.
(updateServiceCAConfigMap): New method.  Update the service CA configmap
bundle if the expected annotation is missing.
* pkg/operator/controller/names.go (ServiceCAConfigMapName): New function.
Return the name of the configmap for the service CA bundle.
@Miciah Miciah force-pushed the BZ1813894-add-configmap-for-service-CA-bundle branch from 34bb971 to fa2873f Compare May 18, 2020 18:59
@Miciah
Copy link
Contributor Author

Miciah commented May 18, 2020

/test e2e-aws-upgrade

@danehans
Copy link
Contributor

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danehans, Miciah

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-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 90a7f30 into openshift:master May 20, 2020
@openshift-ci-robot
Copy link
Contributor

@Miciah: Some pull requests linked via external trackers have merged: . The following pull requests linked via external trackers have not merged:

Details

In response to this:

Bug 1813894: Add configmap for service CA bundle

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.

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/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants