Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
UnicornChance committed Sep 10, 2024
1 parent a11f369 commit 9afa6cd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/pepr/operator/crd/validators/package-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,31 @@ export async function validator(req: PeprValidateRequest<UDSPackage>) {
for (const policy of networkPolicy) {
// If 'remoteGenerated' is set, it cannot be combined with 'remoteNamespace', 'remoteSelector', or 'remoteCidr'.
if (
policy.remoteGenerated && (policy.remoteNamespace || policy.remoteSelector || policy.remoteCidr)
policy.remoteGenerated &&
(policy.remoteNamespace || policy.remoteSelector || policy.remoteCidr)
) {
return req.Deny(
"remoteGenerated cannot be combined with remoteNamespace, remoteSelector, or remoteCidr"
"remoteGenerated cannot be combined with remoteNamespace, remoteSelector, or remoteCidr",
);
}

// If either 'remoteNamespace' or 'remoteSelector' is set, they cannot be combined with 'remoteGenerated' or 'remoteCidr'.
if (
(policy.remoteNamespace || policy.remoteSelector) && (policy.remoteGenerated || policy.remoteCidr)
(policy.remoteNamespace || policy.remoteSelector) &&
(policy.remoteGenerated || policy.remoteCidr)
) {
return req.Deny(
"remoteNamespace and remoteSelector cannot be combined with remoteGenerated or remoteCidr"
"remoteNamespace and remoteSelector cannot be combined with remoteGenerated or remoteCidr",
);
}

// If 'remoteCidr' is set, it cannot be combined with 'remoteGenerated', 'remoteNamespace', or 'remoteSelector'.
if (
policy.remoteCidr && (policy.remoteGenerated || policy.remoteNamespace || policy.remoteSelector)
policy.remoteCidr &&
(policy.remoteGenerated || policy.remoteNamespace || policy.remoteSelector)
) {
return req.Deny(
"remoteCidr cannot be combined with remoteGenerated, remoteNamespace, or remoteSelector"
"remoteCidr cannot be combined with remoteGenerated, remoteNamespace, or remoteSelector",
);
}

Expand Down

0 comments on commit 9afa6cd

Please sign in to comment.