Skip to content

Commit 49dc10f

Browse files
authored
Merge pull request #15 from maxdrib/account-domain-webhook
Refactoring account/domain validation webhook logic
2 parents 434cb23 + 60d1c22 commit 49dc10f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/v1alpha3/cloudstackcluster_webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ func (r *CloudStackCluster) ValidateCreate() error {
6262
errorList = append(errorList, field.Forbidden(field.NewPath("spec", "identityRef", "kind"), "must be a Secret"))
6363
}
6464

65-
if (r.Spec.Account == "") != (r.Spec.Domain == "") {
66-
errorList = append(errorList, field.Required(field.NewPath("spec", "account"), "account and domain must be specified together"))
65+
if (r.Spec.Account != "") && (r.Spec.Domain == "") {
66+
errorList = append(errorList, field.Required(field.NewPath("spec", "account"), "specifying account requires additionally specifying domain"))
6767
}
6868

6969
// Zone and Network are required fields

0 commit comments

Comments
 (0)