Skip to content

Commit

Permalink
fix: validate that workers don't get cluster CA key
Browse files Browse the repository at this point in the history
Only the cert should be present on worker nodes, enforce this via
validation.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
(cherry picked from commit c6ad0fc)
  • Loading branch information
smira committed Apr 12, 2024
1 parent 4f7cb9c commit 09ef5b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ func (c *ClusterConfig) Validate(isControlPlane bool) error {
}
}

if c.ClusterCA != nil && !isControlPlane && len(c.ClusterCA.Key) > 0 {
result = multierror.Append(result, errors.New("cluster CA key is not allowed on non-controlplane nodes (.cluster.ca)"))
}

result = multierror.Append(
result,
c.ClusterInlineManifests.Validate(),
Expand Down

0 comments on commit 09ef5b3

Please sign in to comment.