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

Support kind blacklist in pruned deployments #2551

Merged
merged 1 commit into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions prow/Makefile.gcloud.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ configure-docker: activate-serviceaccount

get%api-resources:
$(eval PRUNE_WL=$(shell KUBECONFIG=$(KUBECONFIG) \
clarketm marked this conversation as resolved.
Show resolved Hide resolved
python3 "$(current_dir)/api-resources.py" \
--delimiter=" " \
--format="--prune-whitelist='%s'" \
--group-blacklist "authentication.k8s.io" "authorization.k8s.io"\
))
python3 "$(current_dir)/api-resources.py" --delimiter=" " --format="--prune-whitelist='%s'" \
))

get%cluster-credentials: save-kubeconfig activate-serviceaccount
gcloud container clusters get-credentials "$(CLUSTER)" --project="$(PROJECT)" --zone="$(ZONE)"
17 changes: 13 additions & 4 deletions prow/api-resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ def fetch_versions():
return {}


def main(delimiter, format, group_blacklist):
def main(delimiter, format, group_blacklist, kind_blacklist):
resources = fetch_resources()
versions = fetch_versions()
group_blacklist = set(group_blacklist)
kind_blacklist = set(kind_blacklist)
r = []

for name, _, group, _, kind in resources:
if group in group_blacklist:
if kind in kind_blacklist or group in group_blacklist:
continue

for version in versions.get(group, []):
Expand All @@ -104,7 +106,7 @@ def main(delimiter, format, group_blacklist):
help="delimiter string for the list of api resources.",
)
parser.add_argument(
"--format", type=str, default="%s", help="format string for each api resources."
"--format", type=str, default="%s", help="format string for each api resource."
)
parser.add_argument(
"--group-blacklist",
Expand All @@ -113,5 +115,12 @@ def main(delimiter, format, group_blacklist):
default=["authentication.k8s.io", "authorization.k8s.io"],
help="set of api groups to blacklist.",
)
parser.add_argument(
"--kind-blacklist",
type=str,
nargs="*",
default=["Binding"],
help="set of api kinds to blacklist.",
)
args = parser.parse_args()
print(main(args.delimiter, args.format, args.group_blacklist))
print(main(args.delimiter, args.format, args.group_blacklist, args.kind_blacklist))