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

add support for external-managed-tags & prefer defaultTags #1970

Merged
merged 1 commit into from
May 3, 2021

Conversation

M00nF1sh
Copy link
Collaborator

@M00nF1sh M00nF1sh commented May 3, 2021

This PR contains two changes:

  1. add support for external-managed-tags. Tag keys specified via "--external-managed-tags" will be ignored during tag reconciliation.

    1. If a tag key specified in --external-managed-tags controller-level flag collisions with tags below(used for track the mapping between AWS resources and K8s resources), the controller should error out during start up and exit.
      • elbv2.k8s.aws/cluster
      • ingress.k8s.aws/stack
      • ingress.k8s.aws/resource
      • service.k8s.aws/stack
      • service.k8s.aws/resource
    2. If a tag key specified in both --external-managed-tags controller-level flag and --default-tags controller-level flag, the controller should error out during start up and exit.
    3. If a tag key specified in --external-managed-tags controller-level flag collisions with tags specified via annotation on K8s resources, the controller should refuse to reconcile for that K8s resource and emit error events/logs.
  2. [Behavior change] prefer tag value from defaultTags if there are conflicts of tags specified via "--default-tags" and via annotation on Ingress/Service. (the default Tags is specified by administrator, which should be enforced)

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 3, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: M00nF1sh

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 3, 2021
@k8s-ci-robot k8s-ci-robot requested a review from kishorj May 3, 2021 17:24
@codecov-commenter
Copy link

Codecov Report

Merging #1970 (6b43249) into main (1dc9d88) will decrease coverage by 0.42%.
The diff coverage is 53.01%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1970      +/-   ##
==========================================
- Coverage   48.84%   48.41%   -0.43%     
==========================================
  Files         125      129       +4     
  Lines        6807     6927     +120     
==========================================
+ Hits         3325     3354      +29     
- Misses       3206     3297      +91     
  Partials      276      276              
Impacted Files Coverage Δ
pkg/deploy/ec2/security_group_manager.go 4.65% <0.00%> (-0.12%) ⬇️
pkg/deploy/elbv2/listener_manager.go 1.12% <0.00%> (-0.02%) ⬇️
pkg/deploy/elbv2/listener_rule_manager.go 0.00% <0.00%> (ø)
pkg/deploy/elbv2/load_balancer_manager.go 20.00% <0.00%> (-0.25%) ⬇️
pkg/deploy/elbv2/target_group_manager.go 47.05% <0.00%> (-0.71%) ⬇️
pkg/deploy/stack_deployer.go 0.00% <0.00%> (ø)
pkg/ingress/model_build_listener.go 47.24% <25.00%> (-0.38%) ⬇️
pkg/ingress/model_build_listener_rules.go 44.37% <33.33%> (ø)
pkg/ingress/model_builder.go 62.42% <50.00%> (-0.17%) ⬇️
pkg/config/controller_config.go 47.05% <71.87%> (ø)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1dc9d88...6b43249. Read the comment docs.

@kishorj kishorj added tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. and removed tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. labels May 3, 2021
}

func (cfg *ControllerConfig) validateExternalManagedTagsCollisionWithTrackingTags() error {
trackingTagKeys := sets.NewString(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to have a single source of truth for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense, let me do the change

@@ -7,6 +7,7 @@ import (
"fmt"
"net"
"regexp"
"sigs.k8s.io/aws-load-balancer-controller/pkg/algorithm"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lets group this with the local imports

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kishorj
Copy link
Collaborator

kishorj commented May 3, 2021

/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 3, 2021
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 3, 2021
@kishorj
Copy link
Collaborator

kishorj commented May 3, 2021

/lgtm

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. 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants