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

Image change trigger must be able to create all build types #14792

Merged
merged 1 commit into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/cmd/server/bootstrappolicy/controller_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
rbac "k8s.io/kubernetes/pkg/apis/rbac"

authorizationapi "github.com/openshift/origin/pkg/authorization/apis/authorization"
)

const saRolePrefix = "system:openshift:controller:"
Expand Down Expand Up @@ -165,6 +167,15 @@ func init() {
rbac.NewRule("get", "update").Groups(batchGroup).Resources("cronjobs").RuleOrDie(),
rbac.NewRule("get", "update").Groups(deployGroup, legacyDeployGroup).Resources("deploymentconfigs").RuleOrDie(),
rbac.NewRule("create").Groups(buildGroup, legacyBuildGroup).Resources("buildconfigs/instantiate").RuleOrDie(),
// trigger controller must be able to modify these build types
// TODO: move to a new custom binding that can be removed separately from end user access?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're ok to add these powers here. The image trigger controller logically requires these to do its job.

rbac.NewRule("create").Groups(buildGroup, legacyBuildGroup).Resources(
authorizationapi.SourceBuildResource,
authorizationapi.DockerBuildResource,
authorizationapi.OptimizedDockerBuildResource,
authorizationapi.JenkinsPipelineBuildResource,
).RuleOrDie(),

eventsRule(),
},
})
Expand Down
11 changes: 11 additions & 0 deletions test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3493,6 +3493,17 @@ items:
- buildconfigs/instantiate
verbs:
- create
- apiGroups:
- ""
- build.openshift.io
attributeRestrictions: null
resources:
- builds/docker
- builds/jenkinspipeline
- builds/optimizeddocker
- builds/source
verbs:
- create
- apiGroups:
- ""
attributeRestrictions: null
Expand Down