Skip to content

Commit 893c4cc

Browse files
committed
Warn folks to update pending_eligible_endpoints.yaml
1 parent 00e71d5 commit 893c4cc

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

experiment/audit/audit_log_parser.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,36 @@ def main():
998998
write_results(endpoint_counts, operation_samples, stats, swagger_mapper, args.output, args.sort,
999999
ineligible_endpoints, pending_eligible_endpoints, args.audit_operations_json)
10001000

1001+
warn_on_pending_operations(args, endpoint_counts, pending_eligible_endpoints)
1002+
1003+
1004+
def warn_on_pending_operations(args, endpoint_counts, pending_eligible_endpoints):
1005+
# Check if any pending eligible endpoints are already being exercised in audit logs
1006+
exercised_pending_eligible = []
1007+
for operation in pending_eligible_endpoints:
1008+
if operation in endpoint_counts:
1009+
exercised_pending_eligible.append((operation, endpoint_counts[operation]))
1010+
if exercised_pending_eligible:
1011+
print("\nERROR: Found pending eligible endpoints that are already being exercised in audit logs!")
1012+
print("=" * 80)
1013+
print("The following operations are marked as 'pending eligible' but are actually being used:")
1014+
print()
1015+
for operation, count in sorted(exercised_pending_eligible, key=lambda x: x[0]):
1016+
print(f" {operation} | {count} calls")
1017+
print()
1018+
print(f"Total exercised pending eligible operations: {len(exercised_pending_eligible)}")
1019+
print()
1020+
print("ACTION REQUIRED:")
1021+
print("Please update the pending_eligible_endpoints.yaml file to remove these operations")
1022+
print("since they are now being actively tested in the audit logs.")
1023+
if args.pending_eligible_endpoints_url:
1024+
print(f"File location: {args.pending_eligible_endpoints_url}")
1025+
else:
1026+
print(
1027+
"Default file: https://raw.githubusercontent.com/kubernetes/kubernetes/refs/heads/master/test/conformance/testdata/pending_eligible_endpoints.yaml")
1028+
print()
1029+
sys.exit(1)
1030+
10011031

10021032
if __name__ == '__main__':
10031033
main()

0 commit comments

Comments
 (0)