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

CFE-1133: Watch Infrastructure and update AWS tags #137

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

chiragkyal
Copy link
Member

@chiragkyal chiragkyal commented Sep 24, 2024

This PR adds support for AWS user tags specified in the platform status. Tags can be managed centrally in the PlatformStatus and have them automatically applied to resources managed by the ALBC.

  • Adds a watch on the Infrastructure object to detect changes in the platformStatus.AWS.ResourceTags field.
  • Merges tags from both the AWSLoadBalancerController.Spec.AdditionalResourceTags and the PlatformStatus.AWS.ResourceTags into a single list, prioritizing tags from the operator spec.
  • Ensures that the combined tag list does not exceed the maximum allowed limit of 24 tags for the ALBC's --default-tags argument.

Implements CFE-1133

@openshift-ci-robot
Copy link

openshift-ci-robot commented Sep 24, 2024

@chiragkyal: This pull request references CFE-1133 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Sep 24, 2024
@openshift-ci openshift-ci bot requested review from alebedev87 and miheer September 24, 2024 08:13
@chiragkyal chiragkyal force-pushed the aws-tags branch 3 times, most recently from 3d5641f to f413d74 Compare September 25, 2024 09:29
@chiragkyal
Copy link
Member Author

/test images

@chiragkyal
Copy link
Member Author

/retest-required

@chiragkyal
Copy link
Member Author

/test all

@openshift-ci-robot
Copy link

openshift-ci-robot commented Sep 30, 2024

@chiragkyal: This pull request references CFE-1133 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

This PR adds support for AWS user tags specified in the platform status. Tags can be managed centrally in the PlatformStatus and have them automatically applied to resources managed by the ALBC.

  • Adds a watch on the Infrastructure object to detect changes in the platformStatus.AWS.ResourceTags field.
  • Merges tags from both the AWSLoadBalancerController.Spec.AdditionalResourceTags and the PlatformStatus.AWS.ResourceTags into a single list, prioritizing tags from the operator spec.
  • Ensures that the combined tag list does not exceed the maximum allowed limit of 24 tags for the ALBC's --default-tags argument.

Implements CFE-1133

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@chiragkyal chiragkyal changed the title CFE-1133: [WIP] Watch infrastructure and update AWS tags CFE-1133: Watch Infrastructure and update AWS tags Sep 30, 2024
@chiragkyal chiragkyal force-pushed the aws-tags branch 2 times, most recently from c177a9c to 48c649a Compare October 1, 2024 06:34
@chiragkyal
Copy link
Member Author

/retest-required

@chiragkyal
Copy link
Member Author

/retest

@chiragkyal
Copy link
Member Author

/assign @alebedev87

@chiragkyal
Copy link
Member Author

/retest

@chiragkyal
Copy link
Member Author

/retest-required

@chiragkyal chiragkyal force-pushed the aws-tags branch 2 times, most recently from 54edf38 to 650dd1b Compare November 5, 2024 08:19
@chiragkyal
Copy link
Member Author

/retest-required

- Added watch on Infrastructure object to detect changes in PlatformStatus.AWS.ResourceTags.
- Merged tags from AWSLoadBalancerController.Spec.AdditionalResourceTags and PlatformStatus.AWS.ResourceTags, prioritizing operator spec tags.

Signed-off-by: chiragkyal <[email protected]>
Signed-off-by: chiragkyal <[email protected]>
Signed-off-by: chiragkyal <[email protected]>
@chiragkyal
Copy link
Member Author

/test e2e-aws-proxy-operator

@chiragkyal
Copy link
Member Author

/test e2e-aws-rosa-operator

2 similar comments
@chiragkyal
Copy link
Member Author

/test e2e-aws-rosa-operator

@chiragkyal
Copy link
Member Author

/test e2e-aws-rosa-operator

@chiragkyal
Copy link
Member Author

@alebedev87 It Looks like the e2e-aws-rosa-operator is failing with something new, which seems unrelated to this PR. Any idea why it's complaining ?

An error occurred (WAFNonexistentItemException) when calling the GetWebACL operation: AWS WAF couldn’t perform the operation because your resource doesn’t exist.
{"component":"entrypoint","error":"wrapped process failed: exit status 254","file":"sigs.k8s.io/prow/pkg/entrypoint/run.go:84","func":"sigs.k8s.io/prow/pkg/entrypoint.Options.internalRun","level":"error","msg":"Error executing test process","severity":"error","time":"2024-12-12T07:24:42Z"}

@chiragkyal
Copy link
Member Author

openshift/release#59728 could fix the e2e problem

@alebedev87
Copy link
Contributor

@chiragkyal : Thanks a lot for your work!

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 12, 2024
Copy link
Contributor

openshift-ci bot commented Dec 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alebedev87

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 12, 2024
@alebedev87
Copy link
Contributor

/retest

@Senthamilarasu-STA
Copy link

/label px-approved

@openshift-ci openshift-ci bot added the px-approved Signifies that Product Support has signed off on this PR label Dec 13, 2024
Copy link
Contributor

openshift-ci bot commented Dec 13, 2024

@chiragkyal: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@lihongan
Copy link

lihongan commented Dec 16, 2024

@chiragkyal I'm doing pre-merge test, after updating the resourceTags in infrastructure status, I observed that the controller pod is recreated, it that expected behavior?

aws-load-balancer-controller-cluster-6dd8859687-tzrpv             1/1     Running     0          2s
aws-load-balancer-controller-cluster-8b6c677cc-sz499              0/1     Completed   0          26m

And another finding is: looks it doesn't update the alb.ingress.kubernetes.io/tags annotation (refer to https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.2/guide/ingress/annotations/#resource-tags), it that expected?
cc @alebedev87

@chiragkyal
Copy link
Member Author

Hey, Yeah this is an expected behaviour because updating tags on infrastructure status will change the --default-tags container argument of the controller, necessitating pod recreation.

@chiragkyal
Copy link
Member Author

And another finding is: looks it doesn't update the alb.ingress.kubernetes.io/tags annotation (refer to https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.2/guide/ingress/annotations/#resource-tags), it that expected?

We're feeding the infrastructure tags directly into the --default-tags container arguments and not using alb.ingress.kubernetes.io/tags annotation. So, the annotation not getting updated in the event of updating infrastructure tags is also an expected behaviour. It's similar to what happens if we update the AdditionalResourceTags field.

Users may wish to use this annotation if they want to add more tags.

@lihongan
Copy link

Thank you @chiragkyal and @alebedev87 for the detailed explanations.

I tested this PR and it looks good, after configuring the tags we got

$ aws elbv2 describe-tags --resource-arns "arn:aws:elasticloadbalancing:us-west-1:******:loadbalancer/app/k8s-hongli-ingresst-75f3b8f32d/1be0df7a277bdeab" --output yaml
TagDescriptions:
- ResourceArn: arn:aws:elasticloadbalancing:us-west-1:******:loadbalancer/app/k8s-hongli-ingresst-75f3b8f32d/1be0df7a277bdeab
  Tags:
  - Key: albc                                    <<<--- tags from AWSLoadBalancerController.spec
    Value: albc-tags
  - Key: ingress.k8s.aws/stack
    Value: hongli/ingress-test
  - Key: Owner                                    <<<--- tags from infrastructure.status
    Value: infra-tags
  - Key: ingress.k8s.aws/resource
    Value: LoadBalancer
  - Key: elbv2.k8s.aws/cluster
    Value: ci-ln-22g21zb-76ef8-mf6mh

note: similar tags for targetgroup, listener and listener-rule 

@subhtk
Copy link

subhtk commented Dec 16, 2024

/label docs-approved

@openshift-ci openshift-ci bot added the docs-approved Signifies that Docs has signed off on this PR label Dec 16, 2024
@lihongan
Copy link

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Dec 16, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Dec 16, 2024

@chiragkyal: This pull request references CFE-1133 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set.

In response to this:

This PR adds support for AWS user tags specified in the platform status. Tags can be managed centrally in the PlatformStatus and have them automatically applied to resources managed by the ALBC.

  • Adds a watch on the Infrastructure object to detect changes in the platformStatus.AWS.ResourceTags field.
  • Merges tags from both the AWSLoadBalancerController.Spec.AdditionalResourceTags and the PlatformStatus.AWS.ResourceTags into a single list, prioritizing tags from the operator spec.
  • Ensures that the combined tag list does not exceed the maximum allowed limit of 24 tags for the ALBC's --default-tags argument.

Implements CFE-1133

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-bot openshift-merge-bot bot merged commit 1ac0bcf into openshift:main Dec 16, 2024
10 checks passed
@chiragkyal chiragkyal deleted the aws-tags branch December 16, 2024 09:39
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. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants