Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Allow users to define cluster-scoped BuildTemplates #302

Closed
imjasonh opened this issue Aug 16, 2018 · 8 comments
Closed

Allow users to define cluster-scoped BuildTemplates #302

imjasonh opened this issue Aug 16, 2018 · 8 comments
Assignees

Comments

@imjasonh
Copy link
Member

Some cluster operators might want to provide and manage predefined build templates, available across all namespaces.

We should create a ClusterBuildTemplate resource type which is available cluster-wide.

Questions

  • If a user creates a BuildTemplate in their namespace with a conflicting name with an existing ClusterBuildTemplate should we allow that or reject it?
  • If we allow it, a Build would have to specify template.name: 'some-namespace/the-template' to specify the namespaced template.
  • If we disallow it, creating a new ClusterBuildTemplate would have to look for a conflicting name across all namespaces.

I'm not familiar enough with Kubernetes API ClusterFoo idioms to know which is more consistent, hoping for pointers from those with more experience.

@nader-ziada
Copy link
Member

/assign @pivotal-nader-ziada

@nader-ziada
Copy link
Member

I will work with the following assumptions:

  1. We should reject a BuildTemplate with a conflicting name.
  2. The create ClusterBuildTemplate also should check existing namespaces and give an error on conflict.

This is more in line with the general pattern of Resources not allowed in both Cluster and Namespace scopes

@cppforlife
Copy link

cppforlife commented Aug 20, 2018 via email

@nader-ziada
Copy link
Member

@cppforlife is there a better way to check? I was thinking it would read the list from the cache.

@cppforlife
Copy link

@pivotal-nader-ziada no idea, i was thinking there would be more established way of doing this in kubernetes apis.

i was just looking at how ClusterRole vs Role in kube rbac is referenced (https://kubernetes.io/docs/reference/access-authn-authz/rbac/). looks like they use roleRef that contains kind key which could be ClusterRole or Role. (though they also have apiGroup).

may be adding templateKind: ClusterBuildTemplate | BuildTemplate (default) next to template (which currently specifies name) is better instead of trying to do name check trickery. alternatively can add templateRef that could be used mutually exclusively with template for more advanced cases?

@nader-ziada
Copy link
Member

@cppforlife Thanks, I like the idea of adding the templateKind

@evankanderson
Copy link
Member

evankanderson commented Aug 20, 2018 via email

@nader-ziada
Copy link
Member

Agreed, working on adding a template kind field to the build type instead of checking existing names as per @cppforlife and @evankanderson suggestion

knative-prow-robot pushed a commit that referenced this issue Aug 24, 2018
* add new CRD for cluster build template and update build type to include template kind

* fix template name in e2e test

* make webhook aware of cluster build template

* add clusterbuildtemplate resource to rbac access

* add nonNamespaced tag to codegen of clusterbuildtemplate

* refactor and cleanup based on the review comments
vdemeester pushed a commit to vdemeester/knative-build that referenced this issue Apr 3, 2019
…ive#310)

* add new CRD for cluster build template and update build type to include template kind

* fix template name in e2e test

* make webhook aware of cluster build template

* add clusterbuildtemplate resource to rbac access

* add nonNamespaced tag to codegen of clusterbuildtemplate

* refactor and cleanup based on the review comments
vdemeester pushed a commit to vdemeester/knative-build that referenced this issue Apr 3, 2019
…ive#310)

* add new CRD for cluster build template and update build type to include template kind

* fix template name in e2e test

* make webhook aware of cluster build template

* add clusterbuildtemplate resource to rbac access

* add nonNamespaced tag to codegen of clusterbuildtemplate

* refactor and cleanup based on the review comments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants