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

Scc check only api #8941

Merged
merged 1 commit into from
Jun 3, 2016
Merged

Conversation

sdminonne
Copy link
Contributor

@deads2k ref #8199 and #8776
As discussed here this PR contains API/types only. Thanks to have a look

Main stuff:

  • internal types json tags removed
  • removed v1beta3
  • Added validation for new types and unit tests, and registered

}

// PodSpecReviewResult contains information related the a specifc service account for the requested PodSpec.
type PodSpecReviewResult struct {
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 you can use PodSpecSubjectReviewStatus in place of this type.

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

@deads2k
Copy link
Contributor

deads2k commented May 23, 2016

@openshift/api-review roughly what we talked about here: https://github.com/openshift/origin/pull/8199/files

This is just the types, impl will come separately to make the review a bit easier. It requires some SCC refactors along the way.

@sdminonne
Copy link
Contributor Author

@deads2k thanks waiting for api-review I'm modifying this with your feedback

@sdminonne sdminonne force-pushed the SCC_check_only_API branch from 4f2d020 to 2f4122d Compare May 26, 2016 11:50
@sdminonne
Copy link
Contributor Author

@deads2k commited on top for clarity. PTAL

@deads2k
Copy link
Contributor

deads2k commented May 26, 2016

gofmt hack/verify-gofmt.sh | xargs -n 1 gofmt -s -w

@@ -77,6 +78,9 @@ var resourcesToCheck = map[unversioned.GroupResource]unversioned.GroupKind{
// we choose not to handle in this plugin
var resourcesToIgnore = []unversioned.GroupKind{
extensions.Kind("DaemonSet"),
securityapi.Kind("PodSecurityPolicySelfSubjectReview"), // TODO: should this go through admission?
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, let's run these. The rejection messages will help users figure what's happening to their pods that are being created indirectly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, let's run these. The rejection messages will help users figure what's happening to their pods that are being created indirectly.

I still see this as outstanding. You should just need to provide a way to get the podspec.

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'm going to do. For some reasons I thought this could be done in the next PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK. I'm going to do. For some reasons I thought this could be done in the next PR.

If its small, I'd like it here, if its not, we can defer. Just let me know.

@deads2k
Copy link
Contributor

deads2k commented May 26, 2016

Looks pretty good to me.

@openshift/api-review comments on the types? I think I've talked myself into keep the *SubjectReview checks since there's no other way for a user to figure out if he can create a given pod without trying.

// PodSpec is the PodSpec to check.
PodSpec kapi.PodSpec `json:"podSpec"`

// User is the user you're testing for.
Copy link
Contributor

Choose a reason for hiding this comment

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

Be use to use lower case in the names - since the godoc is used in swagger here, you'll want to refer to the field name as it would be in json. I.e. user is the user you're testing for and if you specify "user" but not "group".

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 (but only for versioned .../v1/types.go).

@sdminonne sdminonne force-pushed the SCC_check_only_API branch from 2f4122d to 0a77a95 Compare May 27, 2016 15:41
@sdminonne
Copy link
Contributor Author

PTAL

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 27, 2016

// PodSecurityPolicyReviewSpec defines specification for PodSecurityPolicyReview
type PodSecurityPolicyReviewSpec struct {
// PodSpec is the PodSpec to check. The ServiceAccountName field is ignored for this check.
Copy link
Contributor

Choose a reason for hiding this comment

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

David and I discussed, I think we're ok on the semantics of:

If ServiceAccountNames is empty, the PodSpec ServiceAccountName is used, unless it's empty, in which case "default" is used instead. If ServiceAccountNames is specified, PodSpec ServiceAccountName is ignored. There should be a way to say "all service accounts", and it should be obvious as it would be fairly common.

Copy link
Contributor

Choose a reason for hiding this comment

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

Update this comment to match the one below for ServiceAccountNames. The ServiceAccountName in the podspec is sometimes used.

@smarterclayton
Copy link
Contributor

Approved with those caveats.

@sdminonne
Copy link
Contributor Author

@smarterclayton sorry only now I realized that I didn't modify the comment.
I'm going to do and I'll squash and rebase.

@sdminonne sdminonne force-pushed the SCC_check_only_API branch from 0a77a95 to d66728a Compare May 30, 2016 21:25
@sdminonne
Copy link
Contributor Author

@deads2k @smarterclayton squashed and rebased

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 30, 2016
@sdminonne sdminonne force-pushed the SCC_check_only_API branch 2 times, most recently from 3d10dd4 to 5500275 Compare May 31, 2016 07:33
@sdminonne
Copy link
Contributor Author

[test]

@sdminonne
Copy link
Contributor Author

Failure not related to my code (pretty sure).

@smarterclayton
Copy link
Contributor

You're hitting a merge queue break caused by today's change from schema1 to schema2 on the Docker hub.

@sdminonne
Copy link
Contributor Author

Thanks Clayton, should I re-run it?

@smarterclayton
Copy link
Contributor

We haven't fixed it yet.

@@ -430,6 +430,7 @@ nodeSelectorLabelBlacklist:
func TestResourcesToCheck(t *testing.T) {
known := knownResourceKinds()
detected := kindsWithPodSpecs()
//t.Errorf("Detected -> %#v", detected)
Copy link
Contributor

Choose a reason for hiding this comment

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

cruft?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry

@deads2k
Copy link
Contributor

deads2k commented Jun 2, 2016

minor comments, update and squash.

@sdminonne sdminonne force-pushed the SCC_check_only_API branch from 5500275 to 10ebc9a Compare June 3, 2016 08:52
@sdminonne
Copy link
Contributor Author

@deads2k

  • cruft removed (sorry again)
  • comments updated
  • admission check not implemented in this PR (working on it).

Hope it's ok.


// ServiceAccountNames is an optional set of ServiceAccounts to run the check with.
// If ServiceAccountNames is empty, the PodSpec ServiceAccountName is used,
// unless it's empty, in which case "default" is used instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

this comment doesn't make a lot of sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Kargakis the idea is (if I'm not wrong)

  1. Look a ServiceAccountNames: if there's some ServiceAccountNames then use them and stop
  2. If ServiceAccountNames it's empty look at the PodSpec.ServiceAccount.
  3. Is PodSpec.ServiceAccount NOT empty? Then use it and stop.
  4. Otherwise use default.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, thanks! I feel that the comment needs to be more clear though.

@sdminonne sdminonne force-pushed the SCC_check_only_API branch from 10ebc9a to c214793 Compare June 3, 2016 12:50
@deads2k
Copy link
Contributor

deads2k commented Jun 3, 2016

lgtm [merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Jun 3, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/4432/) (Image: devenv-rhel7_4312)

@deads2k
Copy link
Contributor

deads2k commented Jun 3, 2016

re[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to c214793

@deads2k
Copy link
Contributor

deads2k commented Jun 3, 2016

yum, re[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to c214793

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/4432/)

@openshift-bot openshift-bot merged commit 5c82a30 into openshift:master Jun 3, 2016
// if ServiceAccountNames is empty, unless the PodSpec.ServiceAccountName is empty,
// in which case "default" is used.
// If ServiceAccountNames is specified, PodSpec.ServiceAccountName is ignored.
PodSpec kapi.PodSpec
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to change this API prior to 1.3 to be PodTemplate, not PodSpec, which fixes our annotation problem and is consistent with all other "template" APIs.

}
}

koCases := map[string]securityapi.PodSecurityPolicySelfSubjectReview{
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 curious what ko means here? Captain Obvious?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's not an OK it's a KO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants