Skip to content

Allow setting volumes:["none"] to disallow all volume types in SCC - #14625

Merged
smarterclayton merged 2 commits into
openshift:masterfrom
liggitt:scc-volumes
Jun 16, 2017
Merged

smarterclayton merged 2 commits into
openshift:masterfrom
liggitt:scc-volumes

Conversation

@liggitt

@liggitt liggitt commented Jun 14, 2017 •

Copy link
Copy Markdown
Contributor

xref #13419

When reading old SCC objects, we default volumes: null to mean volumes: [*] for backwards compatibility.

If you wanted to disallow all volumes, previously you would specify volumes: []. Once we switch to storing in protobuf, [] will no longer be stored, which means we would default back to [*] the next time we read the object from etcd.

Given that an SCC that disallows all volumes is not usable (since all pods have a secret volume), my main concern is ensuring a previously useless SCC stored in etcd doesn't suddenly become a very permissive SCC.

This PR:

  • defaults an SCC with volumes: [] to volumes: [none] (so it can be persisted regardless of storage type and not escalate to allow all volumes on next read)
  • validates that an SCC that specifies volumes: [none] doesn't allow any other volume types

@liggitt

liggitt commented Jun 14, 2017

Copy link
Copy Markdown
Contributor Author

[test]

@liggitt

liggitt commented Jun 14, 2017

Copy link
Copy Markdown
Contributor Author

cc @openshift/api-review @ironcladlou @smarterclayton

@deads2k

deads2k commented Jun 14, 2017

Copy link
Copy Markdown
Contributor

looks reasonable to me

@smarterclayton

smarterclayton commented Jun 14, 2017 •

Copy link
Copy Markdown
Contributor

LGTM, API changes are ok (i briefly contemplated None but if anyone adds a formal none volume type I'll shoot them).

@smarterclayton

smarterclayton commented Jun 14, 2017 via email

Copy link
Copy Markdown
Contributor

@openshift-bot

openshift-bot commented Jun 14, 2017 •

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge Waiting: You are in the build queue at position: 5

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 4b85a5a

@liggitt

liggitt commented Jun 14, 2017

Copy link
Copy Markdown
Contributor Author

forgot I have to regenerate API docs, will update. hope I make it before I reach the head of the merge queue

@liggitt

liggitt commented Jun 14, 2017

Copy link
Copy Markdown
Contributor Author

this is the reason we want to run oadm migrate storage prior to an etcd v3 upgrade

etcd v3 upgrade doesn't do json -> proto, does it? the next time the json is read from etcd v3, this would do the conversion properly

@smarterclayton

smarterclayton commented Jun 14, 2017 via email

Copy link
Copy Markdown
Contributor

@liggitt

liggitt commented Jun 14, 2017

Copy link
Copy Markdown
Contributor Author

actually, an old API server fed volumes: ["none"] would also disallow all volume types, which is unexpectedly compatible

@liggitt

liggitt commented Jun 14, 2017

Copy link
Copy Markdown
Contributor Author

@smarterclayton

smarterclayton commented Jun 14, 2017 via email

Copy link
Copy Markdown
Contributor

@liggitt

liggitt commented Jun 14, 2017

Copy link
Copy Markdown
Contributor Author

does red travis block merge?

@smarterclayton

smarterclayton commented Jun 14, 2017 via email

Copy link
Copy Markdown
Contributor

@liggitt liggitt modified the milestone: 3.6.0 Jun 14, 2017
@stevekuznetsov

Copy link
Copy Markdown
Contributor

We definitely do run that in the check job -- before we jump into hack/env and run the tests:

+ RESTORE_AND_VERIFY_GODEPS=1
+ make verify-commits -j
hack/verify-upstream-commits.sh
[WARNING] No compiled `commitchecker` binary was found. Attempting to build one using:
[WARNING]   $ hack/build-go.sh tools/rebasehelpers/commitchecker
++ Building go targets for linux/amd64: tools/rebasehelpers/commitchecker
/data/src/github.com/openshift/origin/hack/build-go.sh took 14 seconds
===== Verifying UPSTREAM Commits =====
SUCCESS: All commits are valid.

Is that checker broken?

@liggitt

liggitt commented Jun 14, 2017

Copy link
Copy Markdown
Contributor Author

Is that checker broken?

It turned Travis red, so I don't think so

@stevekuznetsov

Copy link
Copy Markdown
Contributor

Once we've got the right git state we run:

# run commitchecker outside release container as it needs
# access to git; also explicitly force godeps verification
branch="$( git rev-parse --abbrev-ref --symbolic-full-name HEAD )"
if [[ "${branch}" == "master" ]]; then
  RESTORE_AND_VERIFY_GODEPS=1 make verify-commits -j
fi

OS_BUILD_ENV_PRESERVE=_output/scripts hack/env TEST_KUBE='true' JUNIT_REPORT='true' make check -j -k

@stevekuznetsov

Copy link
Copy Markdown
Contributor

@liggitt do you have a git reflog to show us the history of this branch? It looks like Travis recorded the commit it merged as 2db9358 and our Jenkins CI says 793f7b1

@stevekuznetsov

Copy link
Copy Markdown
Contributor

Nevermind... Travis was pointing at the merge commit but nevertheless had 793f7b1

We should probably create logging for commitchecker so we can debug post-facto

@stevekuznetsov

Copy link
Copy Markdown
Contributor

@liggitt would appreciate it if you could push that bad ref up as a new PR for repro

@smarterclayton

Copy link
Copy Markdown
Contributor

[test]

}
if hasNone {
allErrs = append(allErrs, field.Invalid(field.NewPath("volumes"), scc.Volumes,
"if 'none' is specified, no other values are allowed"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If you inline this to the if, it will be possible to use field.Index() to complain on particular element.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we need a test for that?

if len(scc.Volumes) > 1 {
hasNone := false
for _, fsType := range scc.Volumes {
if fsType == api.FSTypeNone {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is it possible that user specify 'None' or 'NONE'? Would it work?

@php-coder

Copy link
Copy Markdown

Does Kubernetes has the same issue? Are they going to do the same?

@liggitt

liggitt commented Jun 15, 2017

Copy link
Copy Markdown
Contributor Author

Does Kubernetes has the same issue? Are they going to do the same?

They do not, because the first version of PSP had the Volumes field, so they don't have to default nil to mean "allow all"


default:
// defaults the volume slice of the SCC.
// In order to support old clients the boolean fields will always take precedence.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In order to support old clients the boolean fields will always take precedence.

About what "boolean fields" this comment is talking? Does it mean AllowHostDirVolumePlugin?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes

@php-coder

Copy link
Copy Markdown

It would be good to also ignore this new value when we're comparing SCCs to sort them by priority:

case kapi.FSTypeSecret, kapi.FSTypeConfigMap,
kapi.FSTypeEmptyDir, kapi.FSTypeDownwardAPI:

@liggitt

liggitt commented Jun 15, 2017

Copy link
Copy Markdown
Contributor Author

updated byrestrictions, will hold for move of scc types to origin package

@deads2k

deads2k commented Jun 16, 2017

Copy link
Copy Markdown
Contributor

Chances of my pull testing green today are low. Go ahead and merege, but remind me that I need to mess with this.

@liggitt

liggitt commented Jun 16, 2017

Copy link
Copy Markdown
Contributor Author

[merge][severity:blocker]

@smarterclayton

Copy link
Copy Markdown
Contributor

[test]

1 similar comment
@smarterclayton

Copy link
Copy Markdown
Contributor

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 2136bfc

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/2335/) (Base Commit: ee67917) (PR Branch Commit: 2136bfc)

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