Commit a6f8761
authored
Refactor and uniform tags comparison/update logic (#196)
Fixes aws-controllers-k8s/community#2063
During the early days of ACK, the ec2 controller didn't have a lot of CRDs and most of the work around tag handling was some sort of copy/pasta from resource to resource. Time passed and now ec2-controller has 15 resources each with a slightly different tags handling implementations - making it very hard for us to maintain and bug fix if something goes wrong.
This patch does a few things to simplify the life of an ACK developer:
- Moves a lot of the tags handling logic into a single, simple and maintainable package (`pkg/tags`).
- Rely back on generated tags delta computation (back then this wasn't supported)
- Add type safety around the algorithm that was used to compare two array slices.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent 370b5e1 commit a6f8761
File tree
38 files changed
+309
-1921
lines changed- apis/v1alpha1
- pkg
- resource
- dhcp_options
- elastic_ip_address
- flow_log
- instance
- internet_gateway
- nat_gateway
- network_acl
- route_table
- security_group
- subnet
- transit_gateway
- vpc_endpoint_service_configuration
- vpc_endpoint
- vpc_peering_connection
- vpc
- tags
- templates/hooks
- vpc_endpoint_service_configuration
- vpc_peering_connection
38 files changed
+309
-1921
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
246 | 244 | | |
247 | | - | |
248 | | - | |
249 | 245 | | |
250 | 246 | | |
251 | 247 | | |
| |||
277 | 273 | | |
278 | 274 | | |
279 | 275 | | |
280 | | - | |
281 | | - | |
282 | 276 | | |
283 | | - | |
284 | | - | |
285 | 277 | | |
286 | 278 | | |
287 | 279 | | |
| |||
311 | 303 | | |
312 | 304 | | |
313 | 305 | | |
314 | | - | |
315 | | - | |
316 | 306 | | |
317 | 307 | | |
318 | 308 | | |
319 | 309 | | |
320 | | - | |
321 | | - | |
322 | 310 | | |
323 | 311 | | |
324 | 312 | | |
| |||
348 | 336 | | |
349 | 337 | | |
350 | 338 | | |
351 | | - | |
352 | | - | |
353 | 339 | | |
354 | | - | |
355 | | - | |
356 | 340 | | |
357 | 341 | | |
358 | 342 | | |
| |||
375 | 359 | | |
376 | 360 | | |
377 | 361 | | |
378 | | - | |
379 | | - | |
380 | 362 | | |
381 | 363 | | |
382 | 364 | | |
| |||
395 | 377 | | |
396 | 378 | | |
397 | 379 | | |
398 | | - | |
399 | | - | |
400 | 380 | | |
401 | 381 | | |
402 | 382 | | |
| |||
436 | 416 | | |
437 | 417 | | |
438 | 418 | | |
439 | | - | |
440 | | - | |
441 | 419 | | |
442 | 420 | | |
443 | 421 | | |
444 | 422 | | |
445 | 423 | | |
446 | 424 | | |
447 | | - | |
448 | | - | |
449 | 425 | | |
450 | 426 | | |
451 | 427 | | |
| |||
479 | 455 | | |
480 | 456 | | |
481 | 457 | | |
482 | | - | |
483 | | - | |
484 | 458 | | |
485 | 459 | | |
486 | 460 | | |
| |||
541 | 515 | | |
542 | 516 | | |
543 | 517 | | |
544 | | - | |
545 | | - | |
546 | 518 | | |
547 | 519 | | |
548 | 520 | | |
| |||
573 | 545 | | |
574 | 546 | | |
575 | 547 | | |
576 | | - | |
577 | | - | |
578 | 548 | | |
579 | 549 | | |
580 | 550 | | |
| |||
603 | 573 | | |
604 | 574 | | |
605 | 575 | | |
606 | | - | |
607 | | - | |
608 | 576 | | |
609 | 577 | | |
610 | 578 | | |
| |||
632 | 600 | | |
633 | 601 | | |
634 | 602 | | |
635 | | - | |
636 | | - | |
637 | 603 | | |
638 | 604 | | |
639 | 605 | | |
| |||
682 | 648 | | |
683 | 649 | | |
684 | 650 | | |
685 | | - | |
686 | | - | |
687 | 651 | | |
688 | 652 | | |
689 | 653 | | |
| |||
693 | 657 | | |
694 | 658 | | |
695 | 659 | | |
696 | | - | |
697 | | - | |
698 | 660 | | |
699 | 661 | | |
700 | 662 | | |
| |||
711 | 673 | | |
712 | 674 | | |
713 | 675 | | |
714 | | - | |
715 | | - | |
716 | 676 | | |
717 | 677 | | |
718 | 678 | | |
| |||
722 | 682 | | |
723 | 683 | | |
724 | 684 | | |
725 | | - | |
726 | | - | |
727 | 685 | | |
728 | 686 | | |
729 | 687 | | |
| |||
760 | 718 | | |
761 | 719 | | |
762 | 720 | | |
763 | | - | |
764 | | - | |
765 | 721 | | |
766 | 722 | | |
767 | 723 | | |
768 | 724 | | |
769 | 725 | | |
770 | | - | |
771 | | - | |
772 | 726 | | |
773 | 727 | | |
774 | 728 | | |
| |||
785 | 739 | | |
786 | 740 | | |
787 | 741 | | |
788 | | - | |
789 | | - | |
790 | 742 | | |
791 | 743 | | |
792 | 744 | | |
| |||
816 | 768 | | |
817 | 769 | | |
818 | 770 | | |
819 | | - | |
820 | | - | |
821 | 771 | | |
822 | 772 | | |
823 | 773 | | |
| |||
851 | 801 | | |
852 | 802 | | |
853 | 803 | | |
854 | | - | |
855 | | - | |
856 | 804 | | |
857 | 805 | | |
858 | 806 | | |
859 | 807 | | |
860 | 808 | | |
861 | 809 | | |
862 | | - | |
863 | | - | |
864 | 810 | | |
865 | 811 | | |
866 | 812 | | |
| |||
893 | 839 | | |
894 | 840 | | |
895 | 841 | | |
896 | | - | |
897 | | - | |
898 | 842 | | |
899 | | - | |
900 | | - | |
901 | 843 | | |
902 | 844 | | |
903 | 845 | | |
| |||
0 commit comments