aws-controllers-k8s/community

ACK Lambda and LogGroup Adopted resources default tags not getting updated

swapnachagam opened this issue · 14 comments

Describe the bug
I am trying to adopt the existing Lambda function and LogGroup along with IAM Roles, Policies and s3 Buckets for my project.
All the resources except lambda and loggroup have below default tags added as soon as ACK Controllers adopted them

Expected tags post ACK adoption
services.k8s.aws/controller-version
services.k8s.aws/namespace
 

Steps to reproduce

Manifest of the adopted resource

apiVersion: cloudwatchlogs.services.k8s.aws/v1alpha1
kind: LogGroup
metadata:
  annotations:
    services.k8s.aws/adopted: 'true'
  creationTimestamp: '2024-09-04T13:21:05Z'
  finalizers:
    - finalizers.cloudwatchlogs.services.k8s.aws/LogGroup
  generation: 1
  name: dexp-c-uw2-cloudwatch-to-splunk-test
  namespace: dexp-c-aws-1234567878
  resourceVersion: '1747752'
  uid: e2226e9e-a9ec-46ee-b526-7244f8e501b1
  selfLink: >-
    /apis/cloudwatchlogs.services.k8s.aws/v1alpha1/namespaces/dexp-c-aws-123456788/loggroups/dexp-c-uw2-cloudwatch-to-splunk-test
status:
  ackResourceMetadata:
    arn: >-
      arn:aws:logs:us-west-2:12345678:log-group:/aws/kinesisfirehose/dexp-c-uw2-cloudwatch-to-splunk-test:*
    ownerAccountID: '781371715081'
    region: us-west-2
  conditions:
    - lastTransitionTime: '2024-09-04T13:24:39Z'
      message: Resource synced successfully
      reason: ''
      status: 'True'
      type: ACK.ResourceSynced
  creationTime: 1725456006295
  metricFilterCount: 0
  retentionInDays: 30
  storedBytes: 0
spec:
  name: /aws/kinesisfirehose/dexp-c-uw2-cloudwatch-to-splunk-test
  retentionDays: 30

Expected outcome
Adopted resource should have the default tags.

Environment

  • Kubernetes version
  • 1.28
  • Using EKS (yes/no), if so version? yes
  • AWS service targeted (S3, RDS, etc.) - Log Group and Lambda function

@swapnachagam Hi! I am kindly asking you to add a proper formatting to your issue otherwise it is very difficult to read it. Particularly - indentation of logs and yamls.

sorry i only attached the manifests. I have added the formatting now..

image
Default tags i am expecting for adopted resource.

@swapnachagam Can you please share the manifests of the original manifests of the AoptedResource and the state of the lambda function?

For LogGroups looks like we're missing the tags logic https://github.com/aws-controllers-k8s/cloudwatchlogs-controller/blob/main/pkg/resource/log_group/hook.go

@a-hilaly Please find the manifest for loggroup adopted resource. I will share the lambdaFunction one shortly. I have recreate this.

Yes we don't have tags, can we add the tags to the loggroups and also for lambdaFunctions?

apiVersion: services.k8s.aws/v1alpha1 kind: AdoptedResource metadata: creationTimestamp: '2024-09-04T16:18:30Z' finalizers: - finalizers.services.k8s.aws/AdoptedResource generation: 1 name: dexp-c-uw2-kinesis-firehose-logs-transformer-test namespace: dexp-c-aws-781371715081 resourceVersion: '1770078' uid: 335f7aff-74ed-4679-960e-78e52f1f732b status: conditions: - status: 'True' type: ACK.Adopted spec: aws: nameOrID: /aws/lambda/dexp-c-uw2-KinesisFirehoseCWLogsTransformertest kubernetes: group: cloudwatchlogs.services.k8s.aws kind: LogGroup metadata: name: dexp-c-uw2-kinesis-firehose-logs-transformer-test namespace: dexp-c-aws-781371715081

@swapnachagam again please fix formatting.

Uploading loggroup.txt…

I am not able to fix the formatting but i have attached the logs here as file

apiVersion: services.k8s.aws/v1alpha1
kind: AdoptedResource
metadata:
  creationTimestamp: '2024-09-04T16:18:30Z'
  finalizers:
    - finalizers.services.k8s.aws/AdoptedResource
  generation: 1
  name: dexp-c-uw2-kinesis-firehose-logs-transformer-test
  namespace: dexp-c-aws-781371715081
  resourceVersion: '1770078'
  uid: 335f7aff-74ed-4679-960e-78e52f1f732b
status:
  conditions:
    - status: 'True'
      type: ACK.Adopted
spec:
  aws:
    nameOrID: /aws/lambda/dexp-c-uw2-KinesisFirehoseCWLogsTransformertest
  kubernetes:
    group: cloudwatchlogs.services.k8s.aws
    kind: LogGroup
    metadata:
      name: dexp-c-uw2-kinesis-firehose-logs-transformer-test
      namespace: dexp-c-aws-781371715081

I did it on your behalf :-)

Attaching the lambda adopted resource manifests. Thank you for the above i am still not able to properly format
lambafunction.txt

apiVersion: services.k8s.aws/v1alpha1
kind: AdoptedResource
metadata:
  creationTimestamp: '2024-09-04T16:18:30Z'
  finalizers:
    - finalizers.services.k8s.aws/AdoptedResource
  generation: 1
  name: dexp-c-uw2-kinesis-firehose-logs-transformer-test
  namespace: dexp-c-aws-12345667788
  resourceVersion: '1770078'
  uid: 335f7aff-74ed-4679-960e-78e52f1f732b
status:
  conditions:
    - status: 'True'
      type: ACK.AdoptedResource
spec:
  aws:
    nameOrID: /aws/lambda/dexp-c-uw2-KinesisFirehoseCWLogsTransformertest
  kubernetes:
    group: cloudwatchlogs.services.k8s.aws
    kind: LogGroup
    metadata:
      name: dexp-c-uw2-kinesis-firehose-logs-transformer-test
      namespace: dexp-c-aws-12345667788

One more thing I want to double check if any updates made to the resource after being adapted, will ACK controller keep track of it?

use three

`

signs before and three signs

`

after the text - it is typical markdown.

Can i get an ETA for this issue please?

cc @aws-controllers-k8s/lambda-maintainer

I need an update for LogGroups as tags are not updated for log groups mainly. Lambda seems to be intermittent for me. Thank you

Hi @a-hilaly Can i have some update on this please? Is the tag update done for lambda/log group controllers?