open-policy-agent / gatekeeper

🐊 Gatekeeper - Policy Controller for Kubernetes
https://open-policy-agent.github.io/gatekeeper/
Apache License 2.0
3.61k stars 740 forks source link

Gatekeeper configuration resources should be kind: GatekeeperConfig #681

Open skaven81 opened 4 years ago

skaven81 commented 4 years ago

What steps did you take and what happened: This is similar to #677. The config.gatekeeper.sh CRD creates a resource of kind: Config with singular and plural names config and configs, all of which are overly generic and likely to conflict with other projects that wish to store their configuration in a custom resource.

What did you expect to happen: The config.gatekeeper.sh should use the following names:

  names:
    kind: GatekeeperConfig
    listKind: GatekeeperConfigList
    singular: gatekeeperconfig
    plural: gatekeeperconfigs
    shortNames:
    - gkconfig

This makes it obvious both when looking at kubectl api-resources, and when actually creating or maintaing a YAML file with Gatekeeper configuration inside, that it's associated with the Gatekeeper controller running in the cluster.

Environment:

maxsmythe commented 4 years ago

Naming this config was an attempt to follow the K8s naming conventions:

https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#naming-conventions

FooController is a deprecated kind naming convention. Name the kind after the thing being controlled instead (e.g., Job rather than JobController).

Arguably GatekeeperConfig is just being more descriptive.

From a functional standpoint, there is no risk of conflict as the Gatekeeper Config object is qualified by the gatekeeper.sh domain name.

It should be noted that changing the kind would be a breaking change, which users would need to update their clusters to accommodate.

maxsmythe commented 2 years ago

Some ambivalence at triage: in gatekekeeper-system namespace, so no collisions, on the other hand, using kubectl can be awkward when kinds overlap.

This is an alpha resource, but there would be user effort involved in migrating if we change.

Leaving this open for more people to comment if there is interest.