Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[local.Driver] Replace PutModules and DeleteModules with AddTemplate and RemoveTemplate #171

Closed
willbeason opened this issue Dec 16, 2021 · 2 comments
Assignees

Comments

@willbeason
Copy link
Member

func (d *Driver) AddTemplate(ct *templates.ConstraintTemplate) error
func (d *Driver) RemoveTemplate(ctx context.Context, ct *template.ConstraintTemplate) error

The driver itself should handle extracting libraries from the ConstraintTemplate and naming them - there's no need for Client to have any of this logic. Having Client not care how code from ConstraintTemplates is compiled is essential for us being able to shard ConstraintTemplates into their own environments under the hood.

For RemoveTemplate - note the inclusion of context.Context since this method will later be responsible for removing the corresponding Constraints.

It's fine to this and #170 as two separate PRs or as one PR - whatever works better for you.

@becky-hd
Copy link
Contributor

+1

becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 10, 2022
export local.Driver
set Externs for local.Driver within client.init
move local.Driver PutModules and DeleteModules to private, deleted from drivers interface
remove rego validation in client.CreateCRD

Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 11, 2022
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 11, 2022
Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 11, 2022
Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 11, 2022
… logic from client.CeateCRD (open-policy-agent#171)

Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 11, 2022
export local.Driver
set Externs for local.Driver within client.init
move local.Driver PutModules and DeleteModules to private, deleted from drivers interface
remove rego validation in client.CreateCRD

Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 11, 2022
Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 11, 2022
… logic from client.CeateCRD (open-policy-agent#171)

Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 11, 2022
… logic from client.CeateCRD (open-policy-agent#171)

Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 13, 2022
export local.Driver
set Externs for local.Driver within client.init
move local.Driver PutModules and DeleteModules to private, deleted from drivers interface
remove rego validation in client.CreateCRD

Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 13, 2022
Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 13, 2022
… logic from client.CeateCRD (open-policy-agent#171)

Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 13, 2022
… logic from client.CeateCRD (open-policy-agent#171)

Signed-off-by: Becky Huang <beckyhd@google.com>
becky-hd added a commit to becky-hd/frameworks that referenced this issue Jan 13, 2022
… logic from client.CeateCRD (open-policy-agent#171)

Signed-off-by: Becky Huang <beckyhd@google.com>
willbeason pushed a commit that referenced this issue Jan 14, 2022
* Add AddTemplate and RemoveTemplate interface to driver

Signed-off-by: Becky Huang <beckyhd@google.com>

* Move parsing module logic from local.AddTemplate to MapModules, sharing with client.CreateCRD

Signed-off-by: Becky Huang <beckyhd@google.com>

* refactor local.driver (#171)

export local.Driver
set Externs for local.Driver within client.init
move local.Driver PutModules and DeleteModules to private, deleted from drivers interface
remove rego validation in client.CreateCRD

Signed-off-by: Becky Huang <beckyhd@google.com>

* Add driver.AddTemplate unit tests (#171)

Signed-off-by: Becky Huang <beckyhd@google.com>

* Add client.ValidateConstraintTemplate interface to replace validation logic from client.CeateCRD (#171)

Signed-off-by: Becky Huang <beckyhd@google.com>
@willbeason
Copy link
Member Author

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants