Skip to content

[dynamodb] resource is not synced, when Spec.AttributeDefinitions not sorted by ascii code order in manifest #1599

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

Closed
Julian-Chu opened this issue Dec 19, 2022 · 1 comment
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. service/dynamodb Indicates issues or PRs that are related to dynamodb-controller.

Comments

@Julian-Chu
Copy link

Julian-Chu commented Dec 19, 2022

Describe the bug
when Spec.AttributeDefinitions are not sorted by ascii code, the resource is not synced.

Steps to reproduce

apiVersion: dynamodb.services.k8s.aws/v1alpha1
kind: Table
metadata:
  name: ack-demo
spec:
  keySchema:
    - attributeName: id
      keyType: HASH
    - attributeName: externalId
      keyType: RANGE
  attributeDefinitions:
    - attributeName: id
      attributeType: S
    - attributeName: externalId
      attributeType: S
  provisionedThroughput:
    readCapacityUnits: 1
    writeCapacityUnits: 1
  tableName: "ack-demo-table"

log from controller
2022-12-19T12:32:16.641Z INFO ackrt desired resource state has changed {"account": "*******", "role": "", "region": "eu-west-1", "kind": "Table", "namespace": "default", "name": "ack-demo", "is_adopted": false, "generation": 1, "diff": [{"Path":{"Parts":["Spec","AttributeDefinitions"]},"A":[{"attributeName":"id","attributeType":"S"},{"attributeName":"externalId","attributeType":"S"}],"B":[{"attributeName":"externalId","attributeType":"S"},{"attributeName":"id","attributeType":"S"}]}]}

format json:

{
  "account": "*********",
  "role": "",
  "region": "eu-west-1",
  "kind": "Table",
  "namespace": "default",
  "name": "ack-demo",
  "is_adopted": false,
  "generation": 1,
  "diff": [
    {
      "Path": {
        "Parts": [
          "Spec",
          "AttributeDefinitions"
        ]
      },
      "A": [
        {
          "attributeName": "id",
          "attributeType": "S"
        },
        {
          "attributeName": "externalId",
          "attributeType": "S"
        }
      ],
      "B": [
        {
          "attributeName": "externalId",
          "attributeType": "S"
        },
        {
          "attributeName": "id",
          "attributeType": "S"
        }
      ]
    }
  ]
}

Expected outcome
resource should be synced.

Environment

Kubernetes version: 1.23
EKS: 1.23
AWS service targeted: DynamoDB
DynamoDB controller: 0.1.7

I also see similar issue with GlobalSecondaryIndexes.indexName

@Julian-Chu Julian-Chu changed the title [dynamodb] Spec.AttributeDefinitions must be sorted by ascii code order in manifest [dynamodb] resource is not synced, when Spec.AttributeDefinitions not sorted by ascii code order in manifest Dec 19, 2022
@a-hilaly a-hilaly added kind/bug Categorizes issue or PR as related to a bug. DynamoDB service/dynamodb Indicates issues or PRs that are related to dynamodb-controller. and removed DynamoDB labels Dec 19, 2022
@jljaco jljaco added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Jan 12, 2023
@Julian-Chu
Copy link
Author

I am gonna to pick up this issue.
/assign

ack-prow bot pushed a commit to aws-controllers-k8s/dynamodb-controller that referenced this issue Mar 24, 2023
Issue: aws-controllers-k8s/community#1599

Description of changes:
- ignore default compare function of attribute definitions by update generator.yaml
- implemented custom compare/delta function for attribute definitions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
@jljaco jljaco closed this as completed Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. service/dynamodb Indicates issues or PRs that are related to dynamodb-controller.
Projects
None yet
Development

No branches or pull requests

3 participants