@@ -998,6 +998,36 @@ def main():
998
998
write_results (endpoint_counts , operation_samples , stats , swagger_mapper , args .output , args .sort ,
999
999
ineligible_endpoints , pending_eligible_endpoints , args .audit_operations_json )
1000
1000
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 ("\n ERROR: 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
+
1001
1031
1002
1032
if __name__ == '__main__' :
1003
1033
main ()
0 commit comments