Add log statement for when kube cert agent key has been loaded
Because it makes things easier to debug on a real cluster
This commit is contained in:
parent
efaca05999
commit
bdcf468e52
@ -356,6 +356,7 @@ func (c *agentController) loadSigningKey(agentPod *corev1.Pod) error {
|
|||||||
if err := c.dynamicCertProvider.SetCertKeyContent(certPEM, keyPEM); err != nil {
|
if err := c.dynamicCertProvider.SetCertKeyContent(certPEM, keyPEM); err != nil {
|
||||||
return fmt.Errorf("failed to set signing cert/key content from agent pod %s/%s: %w", agentPod.Namespace, agentPod.Name, err)
|
return fmt.Errorf("failed to set signing cert/key content from agent pod %s/%s: %w", agentPod.Namespace, agentPod.Name, err)
|
||||||
}
|
}
|
||||||
|
c.log.Info("successfully loaded signing key from agent pod into cache")
|
||||||
|
|
||||||
// Remember that we've successfully loaded the key from this pod so we can skip the exec+load if nothing has changed.
|
// Remember that we've successfully loaded the key from this pod so we can skip the exec+load if nothing has changed.
|
||||||
c.execCache.Set(agentPod.UID, struct{}{}, 15*time.Minute)
|
c.execCache.Set(agentPod.UID, struct{}{}, 15*time.Minute)
|
||||||
|
@ -920,6 +920,9 @@ func TestAgentController(t *testing.T) {
|
|||||||
wantDistinctErrors: []string{""},
|
wantDistinctErrors: []string{""},
|
||||||
wantAgentDeployment: healthyAgentDeployment,
|
wantAgentDeployment: healthyAgentDeployment,
|
||||||
wantDeploymentActionVerbs: []string{"list", "watch"},
|
wantDeploymentActionVerbs: []string{"list", "watch"},
|
||||||
|
wantDistinctLogs: []string{
|
||||||
|
`kube-cert-agent-controller "level"=0 "msg"="successfully loaded signing key from agent pod into cache"`,
|
||||||
|
},
|
||||||
wantStrategy: &configv1alpha1.CredentialIssuerStrategy{
|
wantStrategy: &configv1alpha1.CredentialIssuerStrategy{
|
||||||
Type: configv1alpha1.KubeClusterSigningCertificateStrategyType,
|
Type: configv1alpha1.KubeClusterSigningCertificateStrategyType,
|
||||||
Status: configv1alpha1.SuccessStrategyStatus,
|
Status: configv1alpha1.SuccessStrategyStatus,
|
||||||
@ -951,6 +954,9 @@ func TestAgentController(t *testing.T) {
|
|||||||
wantDistinctErrors: []string{""},
|
wantDistinctErrors: []string{""},
|
||||||
wantAgentDeployment: healthyAgentDeployment,
|
wantAgentDeployment: healthyAgentDeployment,
|
||||||
wantDeploymentActionVerbs: []string{"list", "watch"},
|
wantDeploymentActionVerbs: []string{"list", "watch"},
|
||||||
|
wantDistinctLogs: []string{
|
||||||
|
`kube-cert-agent-controller "level"=0 "msg"="successfully loaded signing key from agent pod into cache"`,
|
||||||
|
},
|
||||||
wantStrategy: &configv1alpha1.CredentialIssuerStrategy{
|
wantStrategy: &configv1alpha1.CredentialIssuerStrategy{
|
||||||
Type: configv1alpha1.KubeClusterSigningCertificateStrategyType,
|
Type: configv1alpha1.KubeClusterSigningCertificateStrategyType,
|
||||||
Status: configv1alpha1.SuccessStrategyStatus,
|
Status: configv1alpha1.SuccessStrategyStatus,
|
||||||
|
Loading…
Reference in New Issue
Block a user