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

PSP reviews: client #12478

Merged
merged 4 commits into from
Feb 22, 2017
Merged

Conversation

sdminonne
Copy link
Contributor

@soltysh Thanks to have a look. For all-service-accounts flags I'm going to propose a fix for the API (working on it).

Copy link
Contributor

@mfojtik mfojtik left a comment

Choose a reason for hiding this comment

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

CC @openshift/cli-review


func printPspSubjectReview(pspSubjectReview *securityapi.PodSecurityPolicySubjectReview, w io.Writer, options kctl.PrintOptions) error {
if pspSubjectReview.Status.AllowedBy != nil {
if _, err := fmt.Fprintf(w, "%s\n", pspSubjectReview.Status.AllowedBy.Name); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use fmt.Fprinln()


func printPspSelfSubjectReview(pspSelfSubjectReview *securityapi.PodSecurityPolicySelfSubjectReview, w io.Writer, options kctl.PrintOptions) error {
if pspSelfSubjectReview.Status.AllowedBy != nil {
if _, err := fmt.Fprintf(w, "%s\n", pspSelfSubjectReview.Status.AllowedBy.Name); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here.

@@ -1131,3 +1139,36 @@ func printRoleBindingRestrictionList(list *authorizationapi.RoleBindingRestricti
}
return nil
}

//pspReviewColumns = []string{"SERVICE ACCOUNT", "ALLOWED BY"}
Copy link
Contributor

Choose a reason for hiding this comment

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

is this comment related to the function?

return cmd
}

func returnPodTemplateSpec(obj runtime.Object) (*kapi.PodTemplateSpec, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@smarterclayton don't we have this as helper in kube or origin (for things like oc set image)

Copy link
Contributor

Choose a reason for hiding this comment

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

We do - it's on the factory.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's in

func GetPodSpec(obj runtime.Object) (*kapi.PodSpec, *field.Path, error) {
actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@soltysh that func returns a PodSpec while here we need a PodTemplateSpec (with the right meta) In factory as pointed out by @smarterclayton I found this
My only concern is that upstream AttachablePodForObject
invoked here
does not handle batch.CronJob and apps.StatefulSet which I would say it's a bug...
I'm going to submit an upstream PR if you agree.

func NewCmdReview(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
o := &reviewOptions{}
cmd := &cobra.Command{
Use: fmt.Sprintf("%s", name),
Copy link
Contributor

Choose a reason for hiding this comment

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

no need for Sprintf

return fmt.Errorf("unable to find a resource: %v", err)
}
if len(infos) != 1 {
return fmt.Errorf("expected a resource for path: %s", o.Filename)
Copy link
Contributor

Choose a reason for hiding this comment

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

expected a single resource?

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 raised the point int here and we agreed that only one resource should be handled

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm... that's not quite how I'm reading this. I'd say we want to be able to pass a list of resources and handle that. Generally, this entire code should go into Run. Not quite sure what to do with PrintObject, yet, but I'll get to that.

Copy link
Contributor

Choose a reason for hiding this comment

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

What if a user pass a directory with multiple files, we want to handle those.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So we're going to handle -R handling recursion as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's what I understood from the discussion we've had the other day.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I understood exactly the opposite. Only one resource and no -R :)
Anyway, reworking it to have multiple resources.

if err != nil {
return fmt.Errorf("unable to obtain client: %v", err)
}
o.client = oclient
Copy link
Contributor

Choose a reason for hiding this comment

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

o.client, _, err := f.Clients()
if err != nil {}

The Pod is inferred from the PodTemplateSpec in the provided resource.
If no ServiceAccount is provided the ServiceAccount specified in podTemplateSpec.spec.serviceAccountName is used,
unless the podTemplateSpec.spec.serviceAccountName is empty, in which case "default" is used.
If ServiceAccounts are provided the podTemplateSpec.spec.serviceAccountName is ignored.`)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add newline here?


// Related to PodSecurityPolicyReview
var (
reviewLong = templates.LongDesc(`Checks which ServiceAccount can create a Pod.
Copy link
Contributor

Choose a reason for hiding this comment

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

Checks which Service Account can create a Pod

Copy link
Contributor

Choose a reason for hiding this comment

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

Move to separate file, please. And like mentioned before, try to keep the flow similar to how other commands are.

},
}

cmd.Flags().StringVarP(&o.User, "user", "u", o.User, "User")
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add more description to "User"?

@sdminonne
Copy link
Contributor Author

@mfojtik thanks!. Going to wait for Clayton feedback and I'll modify accordingly

@soltysh
Copy link
Contributor

soltysh commented Jan 16, 2017

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

Left you some comments.


// PodSecurityPolicySubjectReview and PodSecurityPolicySelfSubjectReview
var (
subjectReviewLong = templates.LongDesc(`Check whether a User, ServiceAccount, Group can create a Pod.
Copy link
Contributor

Choose a reason for hiding this comment

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

a User, ServiceAcount, or a Group...

// PodSecurityPolicySubjectReview and PodSecurityPolicySelfSubjectReview
var (
subjectReviewLong = templates.LongDesc(`Check whether a User, ServiceAccount, Group can create a Pod.
If "User" is specified but not "Group", the it is interpreted as "What if User were not member of any groups".
Copy link
Contributor

Choose a reason for hiding this comment

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

theit is interpreted as "What if User is not a member of any group"

and I wouldn't quote User nor Group.

var (
subjectReviewLong = templates.LongDesc(`Check whether a User, ServiceAccount, Group can create a Pod.
If "User" is specified but not "Group", the it is interpreted as "What if User were not member of any groups".
If "User" and "Groups" are empty, then the check is performed using *only* the ServiceAccountName in the PodTemplateSpec`)
Copy link
Contributor

Choose a reason for hiding this comment

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

If User and Group is empty, the check is ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw. iirc from the discussion we've had in the trello, not specifying user nor group would result in SelfSubjectReview, which means against current user, has something changed here?

return nil
}

func NewCmdSubjectReview(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
Copy link
Contributor

Choose a reason for hiding this comment

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

<me ranting>
It's nice and readable to have the NewCmd* function right after *Options structure.
</me ranting>

kcmdutil.CheckErr(kcmdutil.UsageError(cmd, err.Error()))
}
err := o.Run(out)
kcmdutil.CheckErr(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

The body of this method should go towards:

kcmdutil.CheckErr(opts.Complete(f, cmd, args, out))
kcmdutil.CheckErr(opts.Validate())
kcmdutil.CheckErr(opts.Run())

Not sure if you need Validate, yet ;)


response, err := o.client.PodSecurityPolicyReviews(o.Namespace).Create(review)
if err != nil {
return fmt.Errorf("unable to compute PSP rviews: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: reviews, beside use full name Pod Security Policy Review

if err != nil {
return fmt.Errorf("unable to find a resource: %v", err)
}
if len(infos) != 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same limitation, we don't want to have.

func NewCmdSubjectReview(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
o := &subjectReviewOptions{}
cmd := &cobra.Command{
Use: fmt.Sprintf("%s", name),
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here about not using Sprintf.

Long: reviewLong,
Example: fmt.Sprintf(reviewExamples, fullName),
Run: func(cmd *cobra.Command, args []string) {
if err := o.Complete(f, args, cmd); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Now I can say validate is not needed, but the shape here should be:

kcmdutil.CheckErr(opts.Complete(f, cmd, args, out))
kcmdutil.CheckErr(opts.Run())

return cmd
}

func returnPodTemplateSpec(obj runtime.Object) (*kapi.PodTemplateSpec, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's in

func GetPodSpec(obj runtime.Object) (*kapi.PodSpec, *field.Path, error) {
actually.

@sdminonne
Copy link
Contributor Author

@soltysh @mfojtik two commits one for each review. No generated code (anyway this must be squashed).
PTAL

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

My comments apply to both commands, if mentioned only in one file :)

@@ -1131,3 +1139,34 @@ func printRoleBindingRestrictionList(list *authorizationapi.RoleBindingRestricti
}
return nil
}

func printPspReview(pspreview *securityapi.PodSecurityPolicyReview, w io.Writer, options kctl.PrintOptions) error {
for _, allowedSA := range pspreview.Status.AllowedServiceAccounts {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're not allowed, we need to say so. This applies to all three printPsp* methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

btw. name methods, printPSPReview*, PSP here is an acronym, so it should be spelled like one.

securityapi "github.com/openshift/origin/pkg/security/api"
)

// Related to PodSecurityPolicyReview
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment not needed, since you split that to separate files.

securityapi "github.com/openshift/origin/pkg/security/api"
)

// PodSecurityPolicySubjectReview and PodSecurityPolicySelfSubjectReview
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, not needed.

var (
reviewLong = templates.LongDesc(`Checks which Service Account can create a Pod.
The Pod is inferred from the PodTemplateSpec in the provided resource.
If no Service Account is provided the Service Account specified in podTemplateSpec.spec.serviceAccountName is used,
Copy link
Contributor

Choose a reason for hiding this comment

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

If not Service Account is provided the one specified in ...

Copy link
Contributor

Choose a reason for hiding this comment

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

unless the podTemplateSpec.spec.serviceAccoutName it is empty, ...

Infos()
if err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

That block should be moved to Run, not needed here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or change it to return you just the builder object.

if err != nil {
return err
}
o.printer = kubectl.NewVersionedPrinter(p, kapi.Scheme, version)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we need this block. If you care about raw output you can always hit the endpoint by yourself. This is a convenience command, that gives you nice output. Similarly to how oc import-image works. In that case just go with the describer and you'll be good.

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw. you're missing the actual implementation of a PSP* describers in https://github.com/openshift/origin/blob/master/pkg/cmd/cli/describe/describer.go

@sdminonne
Copy link
Contributor Author

@soltysh thanks for the review! PTAL

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

Some minor nits in the form but most importantly I'm missing tests for this in test-cmd.sh. Make sure to have a few positive tests and negative, where you're trying to check an object that does not have PodTemplate.

ServiceAccountNames []string

//AllServiceAccounts bool TODO: defines a way in the API to defines all service accounts
approximatePodTemplateForObject func(runtime.Object) (*kapi.PodTemplateSpec, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

I like to have the options nicely sorted external values, set by users (ServiceAccountNames, FilenameOptions in your case) and internal values. Reads better :-)

FilenameOptions resource.FilenameOptions
User string
Groups []string
ServiceAccount string
Copy link
Contributor

Choose a reason for hiding this comment

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

Same wrt to options.

},
}

usage := "Filename, directory, or URL to a file identifying the resource to get from a server."
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for value, just put into below function.

}

switch {
case len(userOrSA) > 0 || len(o.Groups) > 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

I doubt you'll be doing both at the same time, either you do specify user and/or group or you don't and invoke self check. I'd split that into two methods one for each check. The code for the two can be shared start from line 148 until 154. The only difference will be setting .spec.User and/or .spec.Groups fields and the actual client calls. Printing should be shared as well.

kcmdutil.AddFilenameOptionFlags(cmd, &o.FilenameOptions, usage)

cmd.Flags().StringSliceVarP(&o.ServiceAccountNames, "serviceaccounts", "s", o.ServiceAccountNames, "List of ServiceAccount names, comma separated")
// TODO: defines a way in the API to defines all service accounts: removing omitempty for PodSecurityPolicyReviewSpec.ServiceAccountNames?
Copy link
Contributor

Choose a reason for hiding this comment

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

You're missing kcmdutil.AddPrinterFlags(cmd).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right

@soltysh
Copy link
Contributor

soltysh commented Jan 26, 2017

This doesn't seem to work as I expect:

$ oc policy review -f job.yaml
error:  "hello" cannot create pod: User "test-admin" cannot list all pods in the cluster
$ oc policy subject-review -f job.yaml
error:  "hello" cannot create pod: User "test-admin" cannot list all pods in the cluster

It looks from --loglevel=8 that it's trying to GET https://localhost:8443/api/v1/pods?labelSelector=%3Cnull%3E which it obviously fails to do.

@soltysh
Copy link
Contributor

soltysh commented Jan 26, 2017

When I run this from cluster admin, I got this instead:

error:  "hello" cannot create pod: found '<', expected: !, identifier, or 'end of string'

My job.yaml for tests is:

apiVersion: batch/v1
kind: Job
metadata:
  name: hello
spec:
  template:
    metadata:
      name: hello
    spec:
      containers:
      - name: hello
        image: python:3.5.1
        command: ["python", "-c", "print('Hello world!')"]
      restartPolicy: Never

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

Some more comments.

)

var (
subjectReviewLong = templates.LongDesc(`Check whether a User, Service Account or a Group can create a Pod.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a word or two that it returns a list of SCC that will allow creating those. I've struggled for a second what's the return value 😉

FilenameOptions resource.FilenameOptions
ServiceAccountNames []string

//AllServiceAccounts bool TODO: defines a way in the API to defines all service accounts
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, this is should be no more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

going to write a PR to remove in APIs as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

API agreed, here should be removed within this PR.


cmd.Flags().StringSliceVarP(&o.ServiceAccountNames, "serviceaccounts", "s", o.ServiceAccountNames, "List of ServiceAccount names, comma separated")
// TODO: defines a way in the API to defines all service accounts: removing omitempty for PodSecurityPolicyReviewSpec.ServiceAccountNames?
//cmd.Flags().BoolVar(&o.AllServiceAccounts, "allserviceaccounts", false, "If true, all accessible service accounts will be considered")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same - remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same

}

func (o *reviewOptions) Complete(f *clientcmd.Factory, args []string, cmd *cobra.Command, out io.Writer) error {
if len(args) == 0 && len(o.FilenameOptions.Filenames) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

You need something like that in subject_review.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:\ ok, thanks


func printPSPReview(pspreview *securityapi.PodSecurityPolicyReview, w io.Writer, options kctl.PrintOptions) error {
for _, allowedSA := range pspreview.Status.AllowedServiceAccounts {
allowedByName := "Not allowed"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe <none> rather than 'Not allowed', so it's easier to spot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

return err
}
} else {
if _, err := fmt.Fprintln(w, "Not allowed"); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same <none> here and below. @fabianofranz wdyt?

os::cmd::expect_success_and_text 'oc policy subject-review -z default -g system:authenticated -f ${OS_ROOT}/test/testdata/job.yaml' 'restricted'
os::cmd::expect_success 'oc create -f ${OS_ROOT}/test/testdata/scc_lax.yaml'
os::cmd::expect_success "oc login -u bob -p bob"
os::cmd::expect_success_and_text 'oc policy review -f ./test/testdata/job.yaml --no-headers=true' 'default lax'
Copy link
Contributor

Choose a reason for hiding this comment

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

Use ${OS_ROOT}/test/testdata/job.yaml

os::cmd::expect_success "oc login -u bob -p bob"
os::cmd::expect_success_and_text 'oc policy review -f ./test/testdata/job.yaml --no-headers=true' 'default lax'
os::cmd::expect_success "oc login -u system:admin -n '${project}'"
os::cmd::expect_success 'oc delete project bob'
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice if you could use different resources for each test, iow. job, deployment, just pod, etc.

@sdminonne
Copy link
Contributor Author

[test]

@soltysh
Copy link
Contributor

soltysh commented Feb 3, 2017

This LGTM, thank you Dario!

Now we need @openshift/cli-review approval for the cli part and @pweil- sign off, if we want to merge this for 1.5

@sdminonne
Copy link
Contributor Author

@soltysh added code to verify statefulSet with volumeClaimTemplates.
cmd/policy.sh updated with an example of unsupported type

@pweil-
Copy link
Contributor

pweil- commented Feb 7, 2017

bump @openshift/cli-review

Copy link
Contributor

@pweil- pweil- left a comment

Choose a reason for hiding this comment

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

Also, please check godoc on all public methods.

`)
)

const ReviewRecommendedName = "review"
Copy link
Contributor

Choose a reason for hiding this comment

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

these names may be confusing. Should we prefix with psp or scc (or register with both)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree it would be good to prefix them with either, although I am not sure which prefix would best help describe this

Copy link
Contributor

Choose a reason for hiding this comment

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

psp may be confusing until it's turned on in OpenShift. I'd go with scc if we go with any prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified both to scc-review and scc-subject-review.
Data strcture changed as well

@@ -97,6 +97,31 @@ os::cmd::expect_success_and_not_text 'oc policy can-i --list --groups system:una
os::cmd::expect_success_and_not_text 'oc policy can-i --list --user harold --groups system:authenticated' 'get update.*imagestreams/layers'
os::cmd::expect_success_and_text 'oc policy can-i --list --user harold --groups system:authenticated' 'create get.*buildconfigs/webhooks'

os::cmd::expect_failure_and_text 'oc policy subject-review -f ${OS_ROOT}/test/testdata/pspreview_unsupported_statefulset.yaml' 'error: StatefulSet "rd" with spec.volumeClaimTemplates currently not supported.'
Copy link
Contributor

Choose a reason for hiding this comment

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

add tests for invalid input that is checked by Complete

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@juanvallejo
Copy link
Contributor

juanvallejo commented Feb 7, 2017

A few comments from @pweil- , but other than that this LGTM from a cli perspective

ContinueOnError().
Flatten().
Do().
Infos()
Copy link
Contributor

@juanvallejo juanvallejo Feb 7, 2017

Choose a reason for hiding this comment

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

Although I would not be opposed if not done this way, having this block return a resource.Result, and then using the result's .Visitor(func...) to iterate through each info would match how this is done in other commands.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@sdminonne
Copy link
Contributor Author

@pweil- @juanvallejo thanks for the feedback, I'm modifying.

@sdminonne
Copy link
Contributor Author

No squash and no code generated. As soon you're OK I'll follow up.

@soltysh
Copy link
Contributor

soltysh commented Feb 8, 2017

@pweil- oh well, I'm getting old 😝

@sdminonne
Copy link
Contributor Author

[test]

@soltysh
Copy link
Contributor

soltysh commented Feb 9, 2017

@pweil- mering or leaving out for now?

@pweil-
Copy link
Contributor

pweil- commented Feb 9, 2017

double checking priority of this with PM since it is low risk (new commands). My recommendation though is that we get this in a fork ami so it can be tested and merge to master AFTER the 3.5 cut.

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

Comments from https://bugzilla.redhat.com/show_bug.cgi?id=1421570 and https://bugzilla.redhat.com/show_bug.cgi?id=1421616 needs addressing. One I've pointed above. The other is about printing resource file name or resource name (depending on what's doable) before printing the actual result of the check. This applies to both commands.

},
}

cmd.Flags().StringSliceVarP(&o.ServiceAccountNames, "serviceaccounts", "s", o.ServiceAccountNames, "List of ServiceAccount names, comma separated")
Copy link
Contributor

Choose a reason for hiding this comment

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

Shorthand should be -z to be consistent with other commands where serviceaccounts are specified.

@soltysh
Copy link
Contributor

soltysh commented Feb 15, 2017

I'm taking back my LGTM, until comments from BZ are fixed.

@sdminonne sdminonne force-pushed the SCC_check_client branch 2 times, most recently from 6ffc033 to eabb7e4 Compare February 17, 2017 11:02
@sdminonne
Copy link
Contributor Author

@soltysh PTAL

@soltysh
Copy link
Contributor

soltysh commented Feb 17, 2017

Flake #11452.

[test]

@soltysh
Copy link
Contributor

soltysh commented Feb 17, 2017

Actually that was #12995 and it happened again. I'm not gonna re-kick it.

@soltysh
Copy link
Contributor

soltysh commented Feb 17, 2017

This looks LGTM.

@soltysh
Copy link
Contributor

soltysh commented Feb 20, 2017

I'm re-running tests to get a clean pass. Previously it was flake #12995.

[test]

@soltysh
Copy link
Contributor

soltysh commented Feb 21, 2017

@smarterclayton this will be merged when last issues is address, @sdminonne is currently working on a fix. Additionally, this will be cherry-picked into 1.5 release. So I'm removing your merge tag for now.

@sdminonne
Copy link
Contributor Author

@soltysh: PTAL

@soltysh
Copy link
Contributor

soltysh commented Feb 21, 2017

This LGTM. I'm spinning fork_ami and let qa test it.

@soltysh
Copy link
Contributor

soltysh commented Feb 21, 2017

Flake #9490.

re-[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 20bcb5d

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/400/) (Base Commit: 2d20080)

@soltysh
Copy link
Contributor

soltysh commented Feb 22, 2017

Based on qa approval, and verbal approval from @pweil- and @mfojtik

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 20bcb5d

@openshift-bot
Copy link
Contributor

openshift-bot commented Feb 22, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/415/) (Base Commit: 0ea6f5d) (Image: devenv-rhel7_5954)

@openshift-bot openshift-bot merged commit 9f27ffa into openshift:master Feb 22, 2017
@soltysh soltysh mentioned this pull request Feb 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants