Skip to content

Lambda controller removing code: block #1402

@bjoernw

Description

@bjoernw

Describe the bug
I have a single Function resource defined (see below). The problem I'm having is that after the function is successfully created the code: block gets removed from the Function object and ArgoCD will show this resource as out-of-sync again. What's the recommended way of indicating there is a new version available? At first I was embedding the gitsha in the zip file name but then learned that the controller doesn't like it when the zip file name changes so I switched to updating the s3ObjectVersion for every new release. Any ideas what causes the code: block to get mutated?

Helm manifest

  apiVersion: lambda.services.k8s.aws/v1alpha1
  kind: Function
  metadata:
    name: REDACTED
  spec:
    code:
      s3Bucket: REDACTED_bucket
      s3Key: REDACTED/REDACTED.zip
      s3ObjectVersion: BYpVrqCPxd6yEZQ.bsZBlLuB9S_creyY
    memorySize: 128
    name: {{ .Release.Name }}
    description: "REDACTED Release: {{ .Values.gitsha }}"
    packageType: Zip
    handler: index.handler
    publish: true
    role: {{ .Values.roleARN }}
    runtime: {{ .Values.runtime }}
    timeout: {{ .Values.timeout }}

Live K8s object post creation:

apiVersion: lambda.services.k8s.aws/v1alpha1
kind: Function
metadata:
  labels:
    argocd.argoproj.io/instance: REDACTED
  name: REDACTED
  namespace: aws-staging
spec:
  architectures:
  - x86_64
  code: {}
  description: 'REDACTED Release: 313d869226b56635b2257116891dbc68a9f82c85'
  handler: index.handler
  memorySize: 128
  name: REDACTED
  packageType: Zip
  publish: true
  role: arn:aws:iam::REDACTED:role/REDACTED-role
  runtime: nodejs16.x
  timeout: 3
  tracingConfig:
    mode: PassThrough
status:
  ackResourceMetadata:
    arn: arn:aws:lambda:us-east-1:REDACTED:function:REDACTED
    ownerAccountID: "REDACTED"
    region: us-east-1
  codeSHA256: OR5V0WC2XajpJ0QR03SphjFMTtisMpqDkUeGtgpIE7A=
  codeSize: 60466309
  conditions:
  - lastTransitionTime: "2022-07-25T23:28:49Z"
    message: Resource synced successfully
    reason: ""
    status: "True"
    type: ACK.ResourceSynced
  lastModified: 2022-07-25T23:28:49.000+0000
  lastUpdateStatus: InProgress
  lastUpdateStatusReason: The function is being created.
  lastUpdateStatusReasonCode: Creating
  revisionID: 8512d1c8-eba7-4730-a5f9-8f37370995e7
  state: Active
  version: $LATEST

Steps to reproduce
Install the above object in a cluster.

Expected outcome
The controller should not edit the code: block of an existing Function object.

Environment
aws eks

  • Kubernetes version: v1.21.12-eks-a64ea69
  • Using EKS (yes/no), if so version?: yes, v1.21.12-eks-a64ea69
  • AWS service targeted (S3, RDS, etc.): Lambda with zip files from s3 using versioning

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions