aws-controllers-k8s / community

AWS Controllers for Kubernetes (ACK) is a project enabling you to manage AWS services from Kubernetes
https://aws-controllers-k8s.github.io/community/
Apache License 2.0
2.41k stars 254 forks source link

SNS Topic resource remains healthy after spec.name is changed #2196

Open daniduhnev1 opened 1 week ago

daniduhnev1 commented 1 week ago

Describe the bug

We have observed that changing the spec.name of a resource such as an SNS topic has no effect on the resource. The topic name in AWS is not changed - this is expected as the topic name is immutable. But the k8s topic resource remains in a healthy state. For example, if the description of a “faulty” topic resource is edited, then the change is also seen on AWS. Is this behaviour expected? I believe a better behaviour here is for the resource to fail with a message saying that the spec.name is an immutable field so ACK cannot implement the change of name of the topic on AWS.

Steps to reproduce

Run kubectl apply to create an example topic:

apiVersion: sns.services.k8s.aws/v1alpha1
kind: Topic
metadata:
  name: my-ack-topic
spec:
  displayName: "Test topic"
  name: my-ack-topic

Run kubectl edit and change spec.name to something different such as my-ack-topic-edited. Resource remains as my-ack-topic on AWS as the name of a topic is immutable. However, the ACK Kubernetes resource remains healthy. If for example, spec.displayName is then changed to something different such as "Test topic edited", the description on AWS will be updated.

Expected outcome

The expected behaviour will be for the Kubernetes resource to error with a message saying that "the topic name cannot be updated because it is an immutable field".

Environment

candonov commented 3 days ago

@a-hilaly, I was able to reproduce this with the latest sns controller 1.0.14 version.

a-hilaly commented 1 day ago

@daniduhnev1 @candonov this is fixed in the latest version of sns-controller. Now the controller treats spec.name as an immutable field, and will set a Terminal condition if a user modifies the field