Skip to content

Commit

Permalink
validate disable security
Browse files Browse the repository at this point in the history
Signed-off-by: SK Ali Arman <[email protected]>
  • Loading branch information
sheikh-arman committed Sep 10, 2024
1 parent 0a3c137 commit 084b268
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apis/kubedb/v1alpha2/clickhouse_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ func (c *ClickHouse) ValidateCreateOrUpdate() error {
}
}

if c.Spec.DisableSecurity {
if c.Spec.AuthSecret != nil {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("authSecret"),
c.Name,
"authSecret should be nil when security is disabled"))
return apierrors.NewInvalid(schema.GroupKind{Group: "ClickHouse.kubedb.com", Kind: "ClickHouse"}, c.Name, allErr)
}
}

if c.Spec.ClusterTopology != nil {
clusterName := map[string]bool{}
clusters := c.Spec.ClusterTopology.Cluster
Expand Down
21 changes: 21 additions & 0 deletions apis/kubedb/v1alpha2/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions apis/kubedb/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 084b268

Please sign in to comment.