Skip to content

add reconcile-sccs command, create missing SCCs on server start - #5606

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
pweil-:reconcile-scc
Nov 4, 2015
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
pweil-:reconcile-scc

Conversation

@pweil-

@pweil- pweil- commented Nov 2, 2015

Copy link
Copy Markdown

Add a command to reconcile cluster bootstrap SCCs with existing SCCs. I think this should be considered for a low risk addition. Still testing it out but first pass seems to work.

@liggitt @deads2k @smarterclayton

Comment thread pkg/cmd/admin/policy/reconcile_sccs.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this needs more switches, since this object combines grants and bindings. I would expect to be able to reconcile the following things independently:

  1. SCC definitions
  2. SCC priorities
  3. SCC subjects, additive only
  4. SCC subjects, replace

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the things a cluster admin is likely to change are the priorities and users/groups... we need to make it possible to reset those without making it the default

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see also diagnostics/cluster/{roles,rolebindings}.go

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

SCC subjects, replace

this one is a little tricky. We use the ensure method to craft additional SA user names to add to the SCC and replacing the groups/users would squash that. I'll see if there is a good way to do it. The other pieces seem easy to add flags for.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I mean replacing what they have, in the case where they want to reset to defaults

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yep, understood. The problem is here https://github.com/pweil-/origin/blob/6f86f784806558c188170ac235a994d3482c02f5/pkg/cmd/server/origin/ensure.go#L165-165. I can't just use what is in the default SCCs from bootstrap because we manipulate it with settings from the MasterConfig when installing defaults. I'll look for a better way to do it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we need to be able to use this command on existing clusters to get SCCs in the shape we expect them. whatever inputs the ensure function uses to calculate default SCCs also needs to be inputs to this tool

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the PV controller service account will be another likely addition to that list

@pweil-

pweil- commented Nov 2, 2015

Copy link
Copy Markdown
Author

updated to use set methods and added flags for union and definitions. Still todo is priorities and getting the full config with additional service accounts

Comment thread pkg/cmd/admin/policy/reconcile_sccs.go Outdated

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

typo

@liggitt liggitt self-assigned this Nov 3, 2015
@pweil-
pweil- force-pushed the reconcile-scc branch 3 times, most recently from 7ccd224 to 8c24d75 Compare November 4, 2015 03:11
@pweil-

pweil- commented Nov 4, 2015

Copy link
Copy Markdown
Author

@liggitt I picked in the minimal commit needed to get priorities in here, you can ignore the upstream commit. I was able to get away with some small refactorings rather than requiring the master config as input.

I want to do some more thorough testing tomorrow but I have pretty good unit tests for the compute method. PTAL

@pweil-
pweil- force-pushed the reconcile-scc branch 2 times, most recently from c426789 to 4e9f3c1 Compare November 4, 2015 03:28
@pweil-

pweil- commented Nov 4, 2015

Copy link
Copy Markdown
Author

rebased since priorities just merged

@liggitt liggitt modified the milestone: 1.1.0 Nov 4, 2015
@pweil-
pweil- force-pushed the reconcile-scc branch 2 times, most recently from cb4b7f1 to 94feaab Compare November 4, 2015 13:25
@pweil-

pweil- commented Nov 4, 2015

Copy link
Copy Markdown
Author

@liggitt updated and squashed

  1. always reconcile definitions
  2. better ns name
  3. pass ns to GetBoostrapSCCAccess and have it add the builder /cc @markturansky
  4. move back to policy subcommand thanks to ⬆️
  5. have additive-only control unioning groups, users, and preserve existing priorities

Will create a bugzilla to get QE eyes on this

Edit: https://bugzilla.redhat.com/show_bug.cgi?id=1277986

@pweil-

pweil- commented Nov 4, 2015

Copy link
Copy Markdown
Author

[test]

@smarterclayton smarterclayton added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 4, 2015
@pweil-

pweil- commented Nov 4, 2015

Copy link
Copy Markdown
Author

I will need to rebase when #5465 goes in, it was just tagged

Comment thread pkg/cmd/admin/policy/reconcile_sccs.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sort.StringSlice(...).Sort()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed

@liggitt

liggitt commented Nov 4, 2015

Copy link
Copy Markdown
Contributor

exercise in test/cmd/admin.sh

delete a core scc and make sure reconcile recreates it (when --confirm) is passed

oc delete scc/restricted
[ ! "$(oc get scc/restricted)" ]
oadm policy reconcile-sccs
[ ! "$(oc get scc/restricted)" ]
oadm policy reconcile-sccs --confirm
oc get scc/restricted

add a custom user to a core scc and make sure reconcile does not remove it:

oadm policy add-scc-to-user restricted my-restricted-user
[ "$(oc get scc/restricted -o yaml | grep my-restricted-user)" ]
oadm policy reconcile-sccs --confirm
[ "$(oc get scc/restricted -o yaml | grep my-restricted-user)" ]
oadm policy reconcile-sccs --additive-only=false
[ ! "$(oc get scc/restricted -o yaml | grep my-restricted-user)" ]

delete a core user or group from a core scc and make sure reconcile readds it:

oadm policy remove-scc-from-group restricted system:authenticated
[ ! "$(oc get scc/restricted -o yaml | grep system:authenticated)" ]
oadm policy reconcile-sccs --confirm
[ "$(oc get scc/restricted -o yaml | grep system:authenticated)" ]

@pweil-

pweil- commented Nov 4, 2015

Copy link
Copy Markdown
Author

rebased

@markturansky - please double check the pv controller scc (moved into securitycontextconstraints.go)

@liggitt added your snippets to test-cmd.sh, thanks for providing them

Comment thread pkg/cmd/admin/policy/reconcile_sccs.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

duplicate help

@pweil-

pweil- commented Nov 4, 2015

Copy link
Copy Markdown
Author

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to c6cb469

@liggitt

liggitt commented Nov 4, 2015

Copy link
Copy Markdown
Contributor

LGTM

@liggitt liggitt added the lgtm Indicates that a PR is ready to be merged. label Nov 4, 2015
@liggitt liggitt changed the title add reconcile-scc command add reconcile-scc command, create missing SCCs on server start Nov 4, 2015
@liggitt liggitt changed the title add reconcile-scc command, create missing SCCs on server start add reconcile-sccs command, create missing SCCs on server start Nov 4, 2015
@smarterclayton

Copy link
Copy Markdown
Contributor

[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6904/) (Image: devenv-rhel7_2638)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to c6cb469

@openshift-bot

Copy link
Copy Markdown
Contributor

openshift-bot pushed a commit that referenced this pull request Nov 4, 2015
@openshift-bot
openshift-bot merged commit 60781e3 into openshift:master Nov 4, 2015
@coveralls

coveralls commented Aug 31, 2017 •

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling c6cb469 on pweil-:reconcile-scc into ** on openshift:master**.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. priority/P1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants