Inject kube-apiserver pods trust stores with trusted ca bundle#552
Conversation
|
/retest |
16308a2 to
e65e1a5
Compare
|
In order for this to work correctly, we'll have to add the injected cm somewhere into https://github.com/openshift/cluster-kube-apiserver-operator/blob/master/pkg/operator/starter.go#L180. We'll need to get a CM with the proper key there somewhere, possibly adding a CM apply from the targetconfigcontroller that'll read it from the CM that's being injected 🤔 |
e65e1a5 to
75b7a0c
Compare
3f78b39 to
bb80690
Compare
|
This need e2e test. |
bb80690 to
1cccaa2
Compare
|
You can't wire file watchdog to kube api server pod, because when the configmap change, the watchdog will deliberately kill all 3 api servers immediately (to restart them). I think we need to roll new revision when the config map change. To do that you need to add the configmap with proxy CA into |
1cccaa2 to
eeadf44
Compare
|
@mfojtik: seeing the issue I was mentioning earlier that prevents kube-apiserver pods from running: |
eeadf44 to
9a4c590
Compare
pkg/operator/starter.go
Outdated
| {Name: "sa-token-signing-certs"}, | ||
|
|
||
| // this is a copy of trusted-ca-bundle CM but with key modified to "tls-ca-bundle.pem" so that we can mount it the way we need | ||
| {Name: "trusted-ca-bundle"}, |
There was a problem hiding this comment.
I think you need this in CertConfigMaps /cc @deads2k
There was a problem hiding this comment.
I guess you're right, in the logs, I can see that the dirs created are:
"/etc/kubernetes/static-pod-resources/kube-apiserver-certs/configmaps/client-ca"
but on the other hand also
"/etc/kubernetes/static-pod-resources/kube-apiserver-pod-2/configmaps/trusted-ca-bundle"
which would explain why the Directory hostMount assumption fails, I'll move this to the CertConfigMaps then.
| name: cert-dir | ||
| - mountPath: /var/log/kube-apiserver | ||
| name: audit-dir | ||
| - mountPath: /etc/pki/ca-trust/extracted/pem/ |
There was a problem hiding this comment.
is this overriding existing directory? in case there is no trusted-ca-bundle config map, we erase that dir?
There was a problem hiding this comment.
(i wonder if this should be handled in the installer pod controller)
There was a problem hiding this comment.
That's a good point, I think the hostPath directory will only appear once the appropriate CM exists. I guess setting type: Directory for the matching volume might solve the problem of the hostPath directory not existing.
There was a problem hiding this comment.
@danehans I don't think there is a way how that could work here
There was a problem hiding this comment.
Nvm, we found a way around it to make it optional
9a4c590 to
f8bac6d
Compare
|
/test e2e-aws |
|
Shared upstream. |
|
/hold |
f8bac6d to
c104bee
Compare
|
The dir check in hostPath seemed to have failed, I wonder if removing revision from the path will help |
|
/retest |
c104bee to
8dba95a
Compare
|
Pods are still getting stuck in unitialized on the mount, it would appear the directory just does not appear... |
3087341 to
5c67756
Compare
ce6cd93 to
86b7dc9
Compare
|
/retest |
|
/retest |
ce683a2 to
2b4ad94
Compare
Adds the trusted store injection and a watchdog that will restart the kube-apiserver process on the trusted CA bundle change.
2b4ad94 to
afc2bbe
Compare
| return resourceapply.ApplyConfigMap(client, recorder, requiredConfigMap) | ||
| } | ||
|
|
||
| func ensureKubeAPIServerTrustedCA(client coreclientv1.CoreV1Interface, recorder events.Recorder) error { |
There was a problem hiding this comment.
I do believe these should have comments describing their purpose.
|
/lgtm I don't like the bash in the pod spec, but for can't think of simpler solution for now (we can improve this in future). |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mfojtik, stlaz The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/test e2e-aws-upgrade |
Adds the trusted store injection and a watchdog that will restart
the kube-apiserver process on the trusted CA bundle change.