-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: draft ValidatorManager class
- Loading branch information
Showing
3 changed files
with
38 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {MonokleValidator} from "@monokle/validation"; | ||
import {PolicyManager} from "./policy-manager"; | ||
|
||
export class ValidatorManager { | ||
private _validators = new Map<string, MonokleValidator>(); // Map<policyName, validator> | ||
|
||
constructor( | ||
private readonly _policyManager: PolicyManager, | ||
) { | ||
// @TODO implement this._policyManager.on(policyUpdated, this._reloadValidator) | ||
// We should preload configuration here instead of in getMatchingValidators since | ||
// it would affect performance of the admission webhook response time | ||
} | ||
|
||
getMatchingValidators(): MonokleValidator[] { | ||
const matchingPolicies = this._policyManager.getMatchingPolicies(); | ||
|
||
if (matchingPolicies.length === 0) { | ||
return []; | ||
} | ||
|
||
// @TODO | ||
return []; | ||
} | ||
} |