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

add system:image-auditor #8455

Merged
merged 1 commit into from
Apr 12, 2016
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
1 change: 1 addition & 0 deletions pkg/cmd/server/bootstrappolicy/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const (
RegistryViewerRoleName = "registry-viewer"
RegistryEditorRoleName = "registry-editor"

ImageAuditorRoleName = "system:image-auditor"
ImagePullerRoleName = "system:image-puller"
ImagePusherRoleName = "system:image-pusher"
ImageBuilderRoleName = "system:image-builder"
Expand Down
13 changes: 13 additions & 0 deletions pkg/cmd/server/bootstrappolicy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/openshift/origin/pkg/api"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
imageapi "github.com/openshift/origin/pkg/image/api"
)

func GetBootstrapOpenshiftRoles(openshiftNamespace string) []authorizationapi.Role {
Expand Down Expand Up @@ -302,6 +303,18 @@ func GetBootstrapClusterRoles() []authorizationapi.ClusterRole {
},
},
},
{
ObjectMeta: kapi.ObjectMeta{
Name: ImageAuditorRoleName,
},
Rules: []authorizationapi.PolicyRule{
{
APIGroups: []string{imageapi.GroupName},
Verbs: sets.NewString("get", "list", "watch", "patch", "update"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I would not expect an auditor role to have any write permissions. Is there a different name we could use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would not expect an auditor role to have any write permissions. Is there a different name we could use?

This is a thing that vets images to indicate whether they're good or bad. Alternate name suggestions welcome. I thought of this one and image-inspector, but thought that auditor was seemed like a better fit.

Resources: sets.NewString("images"),
},
},
},
{
ObjectMeta: kapi.ObjectMeta{
Name: ImagePullerRoleName,
Expand Down
17 changes: 17 additions & 0 deletions test/fixtures/bootstrappolicy/bootstrap_cluster_roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,23 @@ items:
resources: []
verbs:
- get
- apiVersion: v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: system:image-auditor
rules:
- apiGroups:
- ""
attributeRestrictions: null
resources:
- images
verbs:
- get
- list
- patch
- update
- watch
- apiVersion: v1
kind: ClusterRole
metadata:
Expand Down