Skip to content

Commit 682db96

Browse files
committed
feat(controller): validating api server cert sans
Signed-off-by: Dario Tranchitella <[email protected]>
1 parent 3a6326f commit 682db96

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/resources/api_server_certificate.go

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/clastix/kamaji/internal/crypto"
2323
"github.com/clastix/kamaji/internal/kubeadm"
2424
"github.com/clastix/kamaji/internal/utilities"
25+
"github.com/clastix/kamaji/internal/webhook/handlers"
2526
)
2627

2728
type APIServerCertificate struct {
@@ -66,6 +67,10 @@ func (r *APIServerCertificate) GetTmpDirectory() string {
6667
}
6768

6869
func (r *APIServerCertificate) CreateOrUpdate(ctx context.Context, tenantControlPlane *kamajiv1alpha1.TenantControlPlane) (res controllerutil.OperationResult, err error) {
70+
if err = (handlers.TenantControlPlaneCertSANs{}).ValidateCertSANs(tenantControlPlane); err != nil {
71+
return controllerutil.OperationResultNone, err
72+
}
73+
6974
return utilities.CreateOrUpdateWithConflict(ctx, r.Client, r.resource, r.mutate(ctx, tenantControlPlane))
7075
}
7176

0 commit comments

Comments
 (0)