frameworks icon indicating copy to clipboard operation
frameworks copied to clipboard

ConstraintTemplate spec.crd.names should following CustomResourceDefinitionNames spec

Open josh-ferrell-sas opened this issue 6 years ago • 3 comments

The OPA Constraint Framework should follow the Kubernetes CustomResourceDefinitionNames spec for Constraint templates to allow specifying plural, singular, shortnames, etc.. without modifying the CRD after the constraint template is created.

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#customresourcedefinitionnames-v1-apiextensions-k8s-io

josh-ferrell-sas avatar Jan 13 '20 14:01 josh-ferrell-sas

Hi!

The ability to have multiple names for a resource was causing problems by making it possible for people to create constraint templates that were in conflict with each other:

https://github.com/open-policy-agent/gatekeeper/issues/156

In the end, we thought it'd be good to make sure only one name can be specified, making it impossible for a user to to thing that create two CRDs with conflicting names or somehow inject the wrong Rego code.

Is there a use case you're looking to support?

maxsmythe avatar Jan 14 '20 20:01 maxsmythe

I can strip out the ability to specify singular and plural name specs but my goal started with being able to specify shortnames so I could get 'ir' instead of 'ingressrestriction'.

josh-ferrell-sas avatar Jan 14 '20 20:01 josh-ferrell-sas

+1 on adding short names.

Lets drop plural and singular. We could also add configurable categories in here (so long as "all" and "constraints" are specified by default per: https://github.com/open-policy-agent/frameworks/pull/65/files

Though the category thing could be saved for later, if preferable.

maxsmythe avatar Jan 14 '20 21:01 maxsmythe