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

audit: refactor for easier local development #2100

Merged
merged 4 commits into from
May 25, 2021

Conversation

spiffxp
Copy link
Member

@spiffxp spiffxp commented May 25, 2021

See individual commits for details. The tl;dr summary is:

  • logging is hopefully a little nicer
  • I can run ./audit-gcp.sh k8s-infra-foo k8s-infra-bar to regenerate audit files just for those projects

/hold
Using this to verify #2099

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 25, 2021
@k8s-ci-robot k8s-ci-robot requested review from dims and thockin May 25, 2021 21:38
@k8s-ci-robot k8s-ci-robot added wg/k8s-infra approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 25, 2021
spiffxp and others added 4 commits May 25, 2021 18:06
mechanical refactor into functions:

- remove_all_gcp_project_audit_files
- audit_gcp_organization
- audit_all_gcp_projects_with_parent_id
- audit_gcp_project
- audit_gcp_project_service
- main

ensure each function removes whichever folder it is about to populate,
instead of deleting everything up front (to support targeted audits),
except for audit_all_gcp_projects_with_parent_id, since it's populating
a flat/non-hiearchical folder that may contain projects with other
parent id's

touch up logging for consistency
- pull in infra/gcp/lib.sh
- use indent for logging instead of manual "###" headers
- drop use of CLOUDSDK_CORE_PROJECT and prefer explicit `--project` flag
- lowercase function-local vars
For faster local dev, `audit-gcp.sh k8s-infra-foo` will delete and
re-export audit files just for the k8s-infra-foo project
This should allow for:

- `bq` to actually work the first time it is used to dump bigquery
  resources
- the `audit-gcp.sh` script to be invokved from anywhere
@spiffxp spiffxp force-pushed the audit-local-dev branch from b4641d8 to bb33137 Compare May 25, 2021 22:07
@spiffxp
Copy link
Member Author

spiffxp commented May 25, 2021

/hold cancel
OK, I'm satisfied with this based on #2029 (comment)

/cc @ameukam @hh

@k8s-ci-robot k8s-ci-robot requested review from ameukam and hh May 25, 2021 22:13
@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 May 25, 2021
@dims
Copy link
Member

dims commented May 25, 2021

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, spiffxp

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 merged commit c8b80ad into kubernetes:main May 25, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone May 25, 2021
@cpanato
Copy link
Member

cpanato commented May 26, 2021

late /lgtm

@spiffxp spiffxp deleted the audit-local-dev branch May 26, 2021 19:58
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. area/audit Audit of project resources, audit followup issues, code in audit/ 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. 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.

4 participants