Skip to content

Commit d653c92

Browse files
committed
frr-k8s: Only render ValidatingWebhookConfiguration when CA is available
The ValidatingWebhookConfiguration requires a valid caBundle to verify the webhook's TLS certificate. The caBundle comes from a ConfigMap created by the OperatorPKI controller. On the first reconcile, the OperatorPKI CR is created but the CA ConfigMap doesn't exist yet. If we render the VWC with an empty caBundle, the API server will reject all webhook calls with: x509: certificate signed by unknown authority Fix this by only rendering the VWC when the CA bundle is available. CNO will keep reconciling, and once the OperatorPKI generates the CA ConfigMap, the next reconcile will render the VWC with the correct caBundle. Signed-off-by: Riccardo Ravaioli <rravaiol@redhat.com>
1 parent a0abdd6 commit d653c92

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

bindata/network/frr-k8s/webhook.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ spec:
99
targetPort: webhook
1010
selector:
1111
component: frr-k8s-statuscleaner
12+
{{- if .FRRK8sWebhookCABundle }}
1213
---
1314
apiVersion: admissionregistration.k8s.io/v1
1415
kind: ValidatingWebhookConfiguration
@@ -36,3 +37,4 @@ webhooks:
3637
resources:
3738
- frrconfigurations
3839
sideEffects: None
40+
{{- end }}

pkg/network/render_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,8 @@ func Test_renderAdditionalRoutingCapabilities(t *testing.T) {
638638
},
639639
},
640640
},
641-
want: 21, // 19 original + 2 OperatorPKI (webhook + metrics)
641+
// 19 original + 2 OperatorPKI (webhook + metrics) - 1 VWC (not rendered without CA bundle)
642+
want: 20,
642643
expectedErr: nil,
643644
},
644645
}

0 commit comments

Comments
 (0)