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

releng: Enable elevated privileges for Release Managers on SIG Release GCP projects #434

Merged
merged 2 commits into from
Oct 30, 2019

Conversation

justaugustus
Copy link
Member

@justaugustus justaugustus commented Oct 28, 2019

  • Add groups to delegate IAM access to Release Managers

    • k8s-infra-release-admins@: Partial Admin
    • k8s-infra-release-editors@: Editor
    • k8s-infra-release-viewers@: Viewer
  • Add ensure-release-projects to grant rights to Release Managers
    Establishes rights to GCS, GCB, and KMS for Release Managers

Required for prototyping build/stage/release process on k8s-infra (kubernetes/release#911).

/assign @dims @thockin @cblecker
cc: @kubernetes/sig-release-admins @kubernetes/release-engineering
/sig release
/area release-eng

@k8s-ci-robot k8s-ci-robot added the sig/release Categorizes an issue or PR as relevant to SIG Release. label Oct 28, 2019
@k8s-ci-robot
Copy link
Contributor

@justaugustus: The label(s) area/release-eng cannot be applied. These labels are supported: api-review, community/discussion, community/maintenance, community/question, cuj/build-train-deploy, cuj/multi-user, platform/aws, platform/azure, platform/gcp, platform/minikube, platform/other

In response to this:

  • Add release-managers-admins@ group

Grants elevated privileges to SIG Release GCP projects.
Currently, this is restricted to SIG Release Chairs.

  • Enable reconciliation of Release Manager groups
  • Add ensure-release-projects to grant rights to Release Managers

Establishes rights to GCS, GCB, and KMS for Release Managers

  • Admins: release-managers-admins@
  • Writers: release-managers-private@
  • Viewers: release-managers@

Required for prototyping build/stage/release process on k8s-infra (#911).

/assign @dims @thockin @cblecker
cc: @kubernetes/sig-release-admins @kubernetes/release-engineering
/sig release
/area release-eng

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 28, 2019
@cblecker
Copy link
Member

/hold
Explicit hold for review.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 28, 2019
Copy link

@hoegaarden hoegaarden left a comment

Choose a reason for hiding this comment

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

Some nits and questions, but generally /lgtm.

Comment on lines 27 to 33
function usage() {
echo "usage: $0 [repo...]" > /dev/stderr
echo "example:" > /dev/stderr
echo " $0 # do all staging repos" > /dev/stderr
echo " $0 coredns # just do one" > /dev/stderr
echo > /dev/stderr
}

Choose a reason for hiding this comment

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

When/how/where would that be called?

Copy link
Member

Choose a reason for hiding this comment

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

it serves as docs, at least :)

WRITERS="release-managers-private@kubernetes.io"
VIEWERS="release-managers@kubernetes.io"

for REPO; do

Choose a reason for hiding this comment

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

TIL: you can omit the in WORDS ...

From help for:

for: for NAME [in WORDS ... ] ; do COMMANDS; done
[...]
If in WORDS ...;' is not present, then in "$@"' is assumed.
[...]

How would you feel about changing that to explicitly use $@ for clarity?

for REPO in "$@"; do
  ...
done

I would even go further and do

for REPO in "${@:-${PROJECTS[@]}}"; do
  ...
done

instead of doing the set -- ... and overriding global state. But that is not that easy to read/understand if you are not used to reading stuff like that and probably more importantly it is just my personal preference.

Copy link
Member

Choose a reason for hiding this comment

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

Once I learned to embrace "$@" I started to prefer the simpler syntax, and this PR follows wstablished patterns

color 3 "Configuring: ${REPO}"

# The GCP project name.
PROJECT="${REPO}"

Choose a reason for hiding this comment

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

Can we maybe just use PROJECT instead of REPO? As far as I can tell, we never use REPO further down, so can we just do for PROJECT ...?

Copy link
Member

Choose a reason for hiding this comment

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

yes, the loop can be for PROJECT - "repo" is a holdover from the script he copied, I assume :)

# $1: The GCP project
# $2: The group email
function empower_group_for_kms() {
if [ $# -lt 2 -o -z "$1" -o -z "$2" ]; then

Choose a reason for hiding this comment

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

Should we make that stricter by doing something like the below?

if [ $# -ne 2 -o -z "$1" -o -z "$2" ]; then

I saw, that other funcs here allow additional arguments, but that might just be a c&p "issue" from cases where additional optional arguments are allowed (e.g. empower_group_to_gcr or empower_gcr_admins).

Copy link
Member

Choose a reason for hiding this comment

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

this is probably a good idea, but I'm OK to let this PR go in and fix it up across the board.

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

Mostly I question the overall factoring - these don't feel like "staging" and "prod" projects (in the sense that we have scripts that exist) any more. Maybe they need to be totally distinct (removed from other scripts) and even renamed?

echo "usage: $0 [repo...]" > /dev/stderr
echo "example:" > /dev/stderr
echo " $0 # do all staging repos" > /dev/stderr
echo " $0 coredns # just do one" > /dev/stderr
Copy link
Member

Choose a reason for hiding this comment

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

change "coredns" to a real (or realer-looking) example?

set -- "${PROJECTS[@]}"
fi

ADMINS="release-managers-admins@kubernetes.io"
Copy link
Member

Choose a reason for hiding this comment

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

Casually looking at this, the distinctions are not clear. Why are release-managers just viewers? Do we need to rename groups? Can this be solved with docs here? Why do we need 3 distinct groups?

Copy link
Member Author

Choose a reason for hiding this comment

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

Here's what each group would do:

  • release-managers@: Includes all Release Managers (including Release Manager Associates), so this needs to be least-privilege (allow Associates to view, but not create, edit, delete)
  • release-managers-private@: Only includes Patch Release Team, Branch Managers, Build Admins, SIG Chairs (the set of users we want working on GCP, so we need edit here)
  • release-managers-admins@: Only includes SIG Release Chairs and grants additional access to administer KMS (limited set of users, security event mitigation, key mgmt (store GitHub tokens, deb/rpm signing key))

Copy link
Member

Choose a reason for hiding this comment

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

We should make distinctions here between "Groups that provide IAM roles" and "E-mail distribution lists". I would be concerned with someone getting access to the release artifacts simply because they become a SIG chair and need access to an e-mail list.

Copy link
Member

Choose a reason for hiding this comment

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

I agree with @cblecker - there are the social groups (email) and the permissions groups, and I am not sure they are the same. Should being a SIG-chair automatically grant you access to GCP?


# NB: Please keep this sorted.
PROJECTS=(
k8s-staging-release-test
Copy link
Member

Choose a reason for hiding this comment

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

currently these are covered by the other ensure-* scripts. Should we a) drop them from those, b) add this logic to those, c) refactor to make the overlap clear?

@justaugustus
Copy link
Member Author

@thockin --

Mostly I question the overall factoring - these don't feel like "staging" and "prod" projects (in the sense that we have scripts that exist) any more.

Yeah, totally agreed. This felt awkward to do, as it felt like shimming something into a model it doesn't really fit.
Each of the SIG Release GCP projects are essentially near-prod/prod, as various areas of the project depend on the artifacts:

  • k8s-staging-release-test/ci: Prow/intrepid users testing nightlies
  • k8s-staging-release-test/stage: Validated prior to promotion (but wider area of effect than other staging projects)
  • k8s-release-test-prod/release: All Kubernetes users

I think this projects would be more accurately named:

  • k8s-release-staging
  • k8s-release-prod

Maybe they need to be totally distinct (removed from other scripts) and even renamed?
currently these are covered by the other ensure-* scripts. Should we a) drop them from those, b) add this logic to those, c) refactor to make the overlap clear?

In an ideal world/future refactor, perhaps there could be one script, configure-projects.sh?
It would include three arrays, STAGING_PROJECTS, PROD_PROJECTS, and RELEASE_PROJECTS and maybe ensure behavior/project config/principal access on a set of case statements?

The overlap here is primarily because of copy/pasta.

I think the future should also include yaml config for custom roles, instead of adhoc IAM attaches.

@justaugustus
Copy link
Member Author

(Just also noting that I went the copy/pasta route instead of refactoring because it wouldn't interfere with the other projects.)

@justaugustus
Copy link
Member Author

(@hoegaarden -- I'll come back and address your review once we land on an approach.)

Copy link
Member

@cblecker cblecker left a comment

Choose a reason for hiding this comment

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

Some initial thoughts on direction. These are in addition to @thockin 's other comments.

name: release-managers-admins
description: |-
Grants elevated privileges to SIG Release GCP projects.
Currently, this is restricted to SIG Release Chairs.
Copy link
Member

Choose a reason for hiding this comment

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

I've mentioned this before in other contexts, but tying privileges to "chairpersonship" of a SIG/WG is an anti-pattern we should try to avoid. These privileges should be tied to A) a unique role defined by the SIG (like "Release Admins" or whatever you want to call it) or B) ownership of a subproject, or even C) a list of people who are just "keyholders".

set -- "${PROJECTS[@]}"
fi

ADMINS="release-managers-admins@kubernetes.io"
Copy link
Member

Choose a reason for hiding this comment

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

We should make distinctions here between "Groups that provide IAM roles" and "E-mail distribution lists". I would be concerned with someone getting access to the release artifacts simply because they become a SIG chair and need access to an e-mail list.

groups/groups.yaml Outdated Show resolved Hide resolved
@justaugustus
Copy link
Member Author

@cblecker --

I've mentioned this before in other contexts, but tying privileges to "chairpersonship" of a SIG/WG is an anti-pattern we should try to avoid. These privileges should be tied to A) a unique role defined by the SIG (like "Release Admins" or whatever you want to call it) or B) ownership of a subproject, or even C) a list of people who are just "keyholders".

Yep, yep. I think the last time we chatted about it was here: kubernetes/org#1205 (comment).
SIG Chairs are also Release Engineering subproject owners, so I occasionally interchange the two in documentation. I've updated the verbiage there.

We should make distinctions here between "Groups that provide IAM roles" and "E-mail distribution lists". I would be concerned with someone getting access to the release artifacts simply because they become a SIG chair and need access to an e-mail list.

Combining the two (communication and access) is exactly what we wanted to do for the Release Manager lists. We also moved to kubernetes.io for a more "official" address and more importantly, to get the benefit of being able to manage this access via config/PR.

More details can be found here: kubernetes/sig-release#732

owners:
- caselim@gmail.com
- cmiles@pivotal.io
- saugustus@vmware.com
Copy link
Member

Choose a reason for hiding this comment

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

why are we adding two accounts for Stephen and Tim? This means twice as many credentials that could leak. I'd like to make a policy that we explicitly NOT do this.

# $1: The GCP project
# $2: The group email
function empower_group_for_kms() {
if [ $# -lt 2 -o -z "$1" -o -z "$2" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

this is probably a good idea, but I'm OK to let this PR go in and fix it up across the board.

function usage() {
echo "usage: $0 [repo...]" > /dev/stderr
echo "example:" > /dev/stderr
echo " $0 # do all staging repos" > /dev/stderr
Copy link
Member

Choose a reason for hiding this comment

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

s/staging repos/release projects

Comment on lines 27 to 33
function usage() {
echo "usage: $0 [repo...]" > /dev/stderr
echo "example:" > /dev/stderr
echo " $0 # do all staging repos" > /dev/stderr
echo " $0 coredns # just do one" > /dev/stderr
echo > /dev/stderr
}
Copy link
Member

Choose a reason for hiding this comment

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

it serves as docs, at least :)

set -- "${PROJECTS[@]}"
fi

ADMINS="release-managers-admins@kubernetes.io"
Copy link
Member

Choose a reason for hiding this comment

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

I agree with @cblecker - there are the social groups (email) and the permissions groups, and I am not sure they are the same. Should being a SIG-chair automatically grant you access to GCP?

WRITERS="release-managers-private@kubernetes.io"
VIEWERS="release-managers@kubernetes.io"

for REPO; do
Copy link
Member

Choose a reason for hiding this comment

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

Once I learned to embrace "$@" I started to prefer the simpler syntax, and this PR follows wstablished patterns

color 3 "Configuring: ${REPO}"

# The GCP project name.
PROJECT="${REPO}"
Copy link
Member

Choose a reason for hiding this comment

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

yes, the loop can be for PROJECT - "repo" is a holdover from the script he copied, I assume :)

PROJECT="${REPO}"

# The names of the buckets
STAGING_BUCKET="gs://${PROJECT}" # used by humans
Copy link
Member

Choose a reason for hiding this comment

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

This is the piece I want to discuss most - Do we want these projects "governed" by 2 ensure scripts? This overlaps directly with the other scripts, which means it will drift.

There's a particular set of semantics that we ascribe to a "staging project" and a "prod project". You are adding on to that, clearly, but it's not clear if you are changing more than that. In other words - should we make a clean break and remove these release projects from the other scripts? Or should we build on those?

For example, this script could do something like:

# First ensure that the project is a normal staging project
"${ROOT}/ensure-staging-project.sh" release-test
# Now apply customizations for release staging

If it helps, we can refactor the existing scripts to make this more obvious. I knew this was likely to come up, so we it should not be hard - we left room.

- `k8s-infra-release-admins@`: Partial Admin
- `k8s-infra-release-editors@`: Editor
- `k8s-infra-release-viewers@`: Viewer

Signed-off-by: Stephen Augustus <saugustus@vmware.com>
Establishes rights to GCS, GCB, and KMS for Release Managers

Signed-off-by: Stephen Augustus <saugustus@vmware.com>
@k8s-ci-robot
Copy link
Contributor

@justaugustus: The label(s) area/release-eng cannot be applied. These labels are supported: api-review, community/discussion, community/maintenance, community/question, cuj/build-train-deploy, cuj/multi-user, platform/aws, platform/azure, platform/gcp, platform/minikube, platform/other

In response to this:

  • Add groups to delegate IAM access to Release Managers

  • k8s-infra-release-admins@: Partial Admin

  • k8s-infra-release-editors@: Editor

  • k8s-infra-release-viewers@: Viewer

  • Add ensure-release-projects to grant rights to Release Managers
    Establishes rights to GCS, GCB, and KMS for Release Managers

Required for prototyping build/stage/release process on k8s-infra (#911).

/assign @dims @thockin @cblecker
cc: @kubernetes/sig-release-admins @kubernetes/release-engineering
/sig release
/area release-eng

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

I will look at refactoring the shell code. I have an idea.

@thockin
Copy link
Member

thockin commented Oct 30, 2019

Thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 30, 2019
@k8s-ci-robot
Copy link
Contributor

@justaugustus: The label(s) area/release-eng cannot be applied. These labels are supported: api-review, community/discussion, community/maintenance, community/question, cuj/build-train-deploy, cuj/multi-user, platform/aws, platform/azure, platform/gcp, platform/minikube, platform/other

In response to this:

  • Add groups to delegate IAM access to Release Managers

  • k8s-infra-release-admins@: Partial Admin

  • k8s-infra-release-editors@: Editor

  • k8s-infra-release-viewers@: Viewer

  • Add ensure-release-projects to grant rights to Release Managers
    Establishes rights to GCS, GCB, and KMS for Release Managers

Required for prototyping build/stage/release process on k8s-infra (kubernetes/release#911).

/assign @dims @thockin @cblecker
cc: @kubernetes/sig-release-admins @kubernetes/release-engineering
/sig release
/area release-eng

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@justaugustus
Copy link
Member Author

Awesome. Thanks y'all!
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 30, 2019
@cblecker
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cblecker, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 30, 2019
@k8s-ci-robot k8s-ci-robot merged commit 25889d0 into kubernetes:master Oct 30, 2019
@cblecker
Copy link
Member

Groups have been created.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants