You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add verification for kube-root-ca.crt configmap after cert rotation (openshift#71089)
After rotating the service-network-serving-signer certificate, the new cert
must be reflected in the kube-root-ca.crt configmap in openshift-kube-apiserver
namespace. Testing shows this update can take up to 10 minutes.
This adds a comprehensive checkpoint that:
- Captures the old cert details before rotation
- Verifies the cert has actually been rotated (subject/notBefore changed)
- Waits up to 15 minutes for the new cert to appear in kube-root-ca.crt
- Matches the cert by its full subject string
- Provides detailed diagnostics showing both old and new cert details if check fails
This ensures the fix for OCPBUGS-60045 is working correctly and prevents
potential cluster degradation with x509 errors in kube-apiserver,
kube-controller-manager, and kube-scheduler.
Related to: https://issues.redhat.com/browse/OCPBUGS-60045
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <[email protected]>
Copy file name to clipboardExpand all lines: ci-operator/step-registry/openshift/e2e/test/qe/regenerate-cluster-cert/openshift-e2e-test-qe-regenerate-cluster-cert-commands.sh
echo"Warning: Could not extract service-network-serving-signer cert subject"
128
+
retry_count=$((retry_count +1))
129
+
sleep 10
130
+
continue
131
+
fi
132
+
133
+
# Verify the cert has actually been rotated (subject or notBefore changed)
134
+
if [ "$new_cert_subject"="$old_cert_subject" ] && [ "$new_cert_notbefore"="$old_cert_notbefore" ];then
135
+
retry_count=$((retry_count +1))
136
+
echo"Waiting for service-network-serving-signer cert to be rotated... (attempt $retry_count/$max_retries)"
137
+
sleep 10
138
+
continue
139
+
fi
140
+
141
+
# Extract the subject CN from the new cert to search for it in the configmap
142
+
new_cert_cn=$(echo "$new_cert_subject"| sed -n 's/.*CN[[:space:]]*=[[:space:]]*\([^,]*\).*/\1/p')
143
+
144
+
if [ -z"$new_cert_cn" ];then
145
+
echo"Warning: Could not extract CN from service-network-serving-signer cert"
146
+
retry_count=$((retry_count +1))
147
+
sleep 10
148
+
continue
149
+
fi
150
+
151
+
# Check if the new cert CN is in the kube-root-ca.crt configmap by searching for the CN value
152
+
if oc get cm kube-root-ca.crt -o jsonpath='{.data.ca\.crt}' -n openshift-kube-apiserver 2>/dev/null | openssl crl2pkcs7 -certfile /dev/stdin -nocrl 2>/dev/null | openssl pkcs7 -print_certs -text -in /dev/stdin 2>/dev/null | grep -F "CN=$new_cert_cn";then
153
+
echo"SUCCESS: New service-network-serving-signer cert is included in kube-root-ca.crt configmap"
154
+
echo" New cert: $new_cert_subject, $new_cert_notbefore"
155
+
cert_included=true
156
+
break
157
+
fi
158
+
159
+
retry_count=$((retry_count +1))
160
+
echo"Waiting for new service-network-serving-signer cert to be reflected in kube-root-ca.crt... (attempt $retry_count/$max_retries)"
161
+
echo" New cert: $new_cert_subject, $new_cert_notbefore"
162
+
sleep 10
163
+
done
164
+
165
+
if [ "$cert_included"=false ];then
166
+
echo"ERROR: New service-network-serving-signer cert is NOT included in kube-root-ca.crt configmap in openshift-kube-apiserver namespace after 15 minutes"
167
+
echo"This may cause cluster degradation with x509 errors in kube-apiserver, kube-controller-manager, and kube-scheduler"
0 commit comments