Skip to content

Commit

Permalink
Merge pull request #14323 from smarterclayton/give_users_optimized_build
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored May 25, 2017
2 parents df5a465 + 5ea255f commit 5ef63e6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/server/bootstrappolicy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func GetOpenshiftBootstrapClusterRoles() []authorizationapi.ClusterRole {
},
},
Rules: []authorizationapi.PolicyRule{
authorizationapi.NewRule("create").Groups(buildGroup, legacyBuildGroup).Resources(authorizationapi.DockerBuildResource).RuleOrDie(),
authorizationapi.NewRule("create").Groups(buildGroup, legacyBuildGroup).Resources(authorizationapi.DockerBuildResource, authorizationapi.OptimizedDockerBuildResource).RuleOrDie(),
},
},
{
Expand Down
26 changes: 1 addition & 25 deletions test/extended/builds/optimized.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"

kapierrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
e2e "k8s.io/kubernetes/test/e2e/framework"

Expand All @@ -34,7 +33,7 @@ USER 1001
oc.SetOutputDir(exutil.TestContext.OutputDir)
})

g.It("should succeed as an admin [Conformance]", func() {
g.It("should succeed [Conformance]", func() {
g.By("creating a build directly")
build, err := oc.AdminClient().Builds(oc.Namespace()).Create(&buildapi.Build{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -74,27 +73,4 @@ USER 1001
o.Expect(s).To(o.ContainSubstring("Build complete, no image push requested"))
e2e.Logf("Build logs:\n%s", result)
})

g.It("should fail as a normal user [Conformance]", func() {
g.By("creating a build directly")
_, err := oc.Client().Builds(oc.Namespace()).Create(&buildapi.Build{
ObjectMeta: metav1.ObjectMeta{
Name: "optimized",
},
Spec: buildapi.BuildSpec{
CommonSpec: buildapi.CommonSpec{
Source: buildapi.BuildSource{
Dockerfile: &testDockerfile,
},
Strategy: buildapi.BuildStrategy{
DockerStrategy: &buildapi.DockerBuildStrategy{
ImageOptimizationPolicy: &skipLayers,
},
},
},
},
})
o.Expect(err).To(o.HaveOccurred())
o.Expect(kapierrs.IsForbidden(err)).To(o.BeTrue(), "Unexpected error: %v", err)
})
})
1 change: 1 addition & 0 deletions test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ items:
attributeRestrictions: null
resources:
- builds/docker
- builds/optimizeddocker
verbs:
- create
- apiVersion: v1
Expand Down

0 comments on commit 5ef63e6

Please sign in to comment.