-
Notifications
You must be signed in to change notification settings - Fork 239
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
Add CA bundle injector #274
Add CA bundle injector #274
Conversation
pkg/controller/configmapcainjector/configmapcainjector_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/configmapcainjector/configmapcainjector_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/configmapcainjector/configmapcainjector_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/configmapcainjector/configmapcainjector_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/configmapcainjector/configmapcainjector_controller.go
Outdated
Show resolved
Hide resolved
func (r *ReconcileConfigMapInjector) Reconcile(request reconcile.Request) (reconcile.Result, error) { | ||
log.Printf("Reconciling update for ca-certs from %s/%s\n", request.Name, request.Namespace) | ||
|
||
combinedCAbundleConfigMap := &corev1.ConfigMap{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to refrain from referencing the trusted ca bundle by different names such as combined, merged, etc. to avoid confusion. I would like to standardize with trustedCABundle
+ whatever
representing the trusted ca bundle (i.e. combined user/system bundle) and additionalTrustBundle
+ whatever
representing the user-provided bundle. trustBundle
can be used to represent a generic trust bundle, not additionalTrustBundle
or trustedCABundle
specific. I'll make sure my PR's follow the same naming convention.
pkg/controller/configmapcainjector/configmapcainjector_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/configmapcainjector/configmapcainjector_controller.go
Outdated
Show resolved
Hide resolved
pkg/names/names.go
Outdated
const TRUST_BUNDLE_CONFIGMAP_ANNOTATION = "config.openshift.io/inject-trusted-cabundle" | ||
|
||
// Proxy returns the namespaced name of the proxy | ||
// object named "cluster" in namespace "openshift-config-managed". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proxy "cluster' resided in the default ns, not the "openshift-config-managed" ns. cc @squeed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't reside in any namespace, it's a cluster scoped resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JacobTanenbaum this is a doc bug that was fixed in https://github.com/openshift/cluster-network-operator/pull/245/files#diff-dc24d687a587f957b553ce29a8dfaff8R40-R46. Rebase your PR from latest master since PR has merged to fix this bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bparees what is the difference? I thought default, cluster-scoped and non-namespaced are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default
is an actual namespace you can go look at on a cluster
oc get sa -n default
NAME SECRETS AGE
builder 2 124m
default 2 130m
deployer 2 124m
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bparees thanks for the clarification.
pkg/names/names.go
Outdated
|
||
// TrustBundleConfigMap returns the namespaced name of the ConfigMap | ||
// containing the merged user/system trust bundle. | ||
func TrustBundleConfigMap() types.NamespacedName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/TrustBundleConfigMap/TrustedCABundleConfigMap/
pkg/names/names.go
Outdated
|
||
// TRUST_BUNDLE_CONFIGMAP is the name of the ConfigMap | ||
// containing the combined user/system trust bundle. | ||
const TRUST_BUNDLE_CONFIGMAP = "trusted-ca-bundle" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/TRUST_BUNDLE_CONFIGMAP/TRUSTED_CA_BUNDLE_CONFIGMAP/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're likely to have multiple different trust bundles. Let's add proxy to this name so that we can distinguish. We can always provide combinations at some point, but we cannot resplit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ended up on this name because the thinking (as driven by @smarterclayton) was that ultimately we would want this to be the mechanism for providing the canonical "CAs to trust" to things on the cluster that wanted to be told what to trust. e.g. if an admin wanted to entirely replace the system trust bundle, this would eventually be that admin-provided bundle. (today it aggregates in system, but at some point we might make it optional to not do that).
So given that target use, i'm reluctant to put proxy back in the name of this thing. But i'm not sure how to reconcile that w/ your goal of "there might be many CA bundles".
I suppose if we ever reach the world I described above, we could introduce "trusted-ca-bundle" as a thing at that point in time, so I guess i'm ok w/ the proposed rename.
tldr: we started out including proxy in the name, i'm ok going back to it I guess.
But this probably also means you're not going to like the label name that we've socialized for people to put on their configmaps (that gets the CAs injected into the CM). So we better settle on that asap as we're causing downstream teams churn every time we change direction on it (we already moved them from annotations to labels).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smarterclayton is going to weigh in on this, please don't rename anything yet.
pkg/names/names.go
Outdated
// TRUST_BUNDLE_CONFIGMAP_NS is the namespace that hosts the | ||
// ADDL_TRUST_BUNDLE_CONFIGMAP and TRUST_BUNDLE_CONFIGMAP | ||
// ConfigMaps. | ||
const TRUST_BUNDLE_CONFIGMAP_NS = "openshift-config-managed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/TRUST_BUNDLE_CONFIGMAP_NS/TRUSTED_CA_BUNDLE_CONFIGMAP_NS/
pkg/names/names.go
Outdated
|
||
// TRUST_BUNDLE_CONFIGMAP_ANNOTATION is the name of the annotation that | ||
// determines whether or not to inject the combined ca certificate | ||
const TRUST_BUNDLE_CONFIGMAP_ANNOTATION = "config.openshift.io/inject-trusted-cabundle" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/TRUST_BUNDLE_CONFIGMAP_ANNOTATION/TRUSTED_CA_BUNDLE_CONFIGMAP_ANNOTATION/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @deads2k is going to suggest this name include proxy for the same reasons he mentioned in another PR (that we might have other bundles to inject in the future). but i'll let him comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and @smarterclayton since we went down this path somewhat at your behest, if you do not think we should be anticipating multiple bundles, would also like to hear from you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smarterclayton is going to weigh in on this, please don't rename anything yet.
|
||
func newReconciler(mgr manager.Manager, status *statusmanager.StatusManager) reconcile.Reconciler { | ||
if err := configv1.Install(mgr.GetScheme()); err != nil { | ||
return &ReconcileConfigMapInjector{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be return nil
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe even "bubble-up" the error returned by Install()
So, a question - by making this reliant on an annotation, it means that we always need to watch all configmaps forever. This could easily result in scaling issues, since our client will have every configmap in cache. Can we make this a label? While the operator-framework doesn't currently support label-selected watches, the underlying client machinery certainly does. That will help us down-the-line. @enj as the maintainer of the service-ca-controller (which does a similar thing), what do you think? |
82cd104
to
3520332
Compare
I think this is ready to merge - with one question: is the validation cherry-picked from #271 still correct? |
I'll approve this - @danehans, can you give it the final lgtm? |
This adds the ability to inject a combined CA bundle into configmaps that are setup to want them
3520332
to
e4e10d7
Compare
/lgtm |
@JacobTanenbaum this PR makes an api call to get the trust bundle configmap for every configmap injection request. See if you can improve in a future PR by adding |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bparees, danehans, JacobTanenbaum, squeed 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:
Approvers can indicate their approval by writing |
/hold |
holding in case squashing is in order or other housekeeping. |
That should be cached, so I'm not so concerned about that. |
Looks fine to me, commit-wise |
/woof |
In response to this:
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. |
Is there any documentation about how this should be used from user point of view? |
…e} log inversion Typo from e4e10d7 (Adds a CA bundle injector, 2019-08-06, openshift#274).
This adds the ability to inject a combined CA bundle into configmaps that are setup to want them
JIRA SDN-496
PTAL @danehans