@@ -14,6 +14,7 @@ import (
14
14
"github.com/openshift/cluster-kube-apiserver-operator/bindata"
15
15
"github.com/openshift/cluster-kube-apiserver-operator/pkg/operator/operatorclient"
16
16
"github.com/openshift/library-go/pkg/controller/factory"
17
+ "github.com/openshift/library-go/pkg/operator/certrotation"
17
18
"github.com/openshift/library-go/pkg/operator/events"
18
19
"github.com/openshift/library-go/pkg/operator/resource/resourceapply"
19
20
"github.com/openshift/library-go/pkg/operator/resource/resourceread"
@@ -29,10 +30,10 @@ const workQueueKey = "key"
29
30
type NodeKubeconfigController struct {
30
31
operatorClient v1helpers.StaticPodOperatorClient
31
32
32
- kubeClient kubernetes.Interface
33
- configMapLister corev1listers.ConfigMapLister
34
- secretLister corev1listers.SecretLister
35
- infrastuctureLister configv1listers.InfrastructureLister
33
+ kubeClient kubernetes.Interface
34
+ configMapLister corev1listers.ConfigMapLister
35
+ secretLister corev1listers.SecretLister
36
+ infrastructureLister configv1listers.InfrastructureLister
36
37
}
37
38
38
39
func NewNodeKubeconfigController (
@@ -43,11 +44,11 @@ func NewNodeKubeconfigController(
43
44
eventRecorder events.Recorder ,
44
45
) factory.Controller {
45
46
c := & NodeKubeconfigController {
46
- operatorClient : operatorClient ,
47
- kubeClient : kubeClient ,
48
- configMapLister : kubeInformersForNamespaces .ConfigMapLister (),
49
- secretLister : kubeInformersForNamespaces .SecretLister (),
50
- infrastuctureLister : infrastuctureInformer .Lister (),
47
+ operatorClient : operatorClient ,
48
+ kubeClient : kubeClient ,
49
+ configMapLister : kubeInformersForNamespaces .ConfigMapLister (),
50
+ secretLister : kubeInformersForNamespaces .SecretLister (),
51
+ infrastructureLister : infrastuctureInformer .Lister (),
51
52
}
52
53
53
54
return factory .New ().WithInformers (
@@ -85,7 +86,7 @@ func (c NodeKubeconfigController) sync(ctx context.Context, syncContext factory.
85
86
c .kubeClient .CoreV1 (),
86
87
c .secretLister ,
87
88
c .configMapLister ,
88
- c .infrastuctureLister ,
89
+ c .infrastructureLister ,
89
90
syncContext .Recorder (),
90
91
)
91
92
if err != nil {
@@ -152,6 +153,13 @@ func ensureNodeKubeconfigs(ctx context.Context, client coreclientv1.CoreV1Interf
152
153
requiredSecret .Annotations = map [string ]string {}
153
154
}
154
155
requiredSecret .Annotations [annotations .OpenShiftComponent ] = "kube-apiserver"
156
+ // Copy not-before/not-after annotations from systemAdminClientCert
157
+ if len (systemAdminCredsSecret .Annotations [certrotation .CertificateNotBeforeAnnotation ]) > 0 {
158
+ requiredSecret .Annotations [certrotation .CertificateNotBeforeAnnotation ] = systemAdminCredsSecret .Annotations [certrotation .CertificateNotBeforeAnnotation ]
159
+ }
160
+ if len (systemAdminCredsSecret .Annotations [certrotation .CertificateNotAfterAnnotation ]) > 0 {
161
+ requiredSecret .Annotations [certrotation .CertificateNotAfterAnnotation ] = systemAdminCredsSecret .Annotations [certrotation .CertificateNotAfterAnnotation ]
162
+ }
155
163
156
164
_ , _ , err = resourceapply .ApplySecret (ctx , client , recorder , requiredSecret )
157
165
if err != nil {
0 commit comments