dragonflydb / dragonflydb/dragonfly-operator
Operator tries to reconcile AWS nlb svc immutable field
- Dominant language
- Go
- Stars
- 357
- Forks
- 111
- PR merge metrics
- No merged PRs in 30d
Description
On an AWS instance, I noticed that my STS wasn't rolling out when changing my dragonflies CRD and saw the following message from the dragonfly operator:
```
2025-08-13T08:09:32Z ERROR failed to reconcile dragonfly resource {"controller": "Dragonfly", "controllerGroup": "dragonflydb.io", "controllerKind": "Dragonfly", "Dragonfly": {"name":"dragonfly-hydra","namespace":"hydra"}, "namespace": "hydra", "name": "dragonfly-hydra", "reconcileID": "3f001e79-0449-47c7-8927-0c27b095d368", "error": "failed to update resource: Service \"dragonfly-hydra\" is invalid: spec.loadBalancerClass: Invalid value: \"null\": may not change once set"}
```
Here is our dragonfly instance definition:
```
apiVersion: dragonflydb.io/v1alpha1
kind: Dragonfly
metadata:
creationTimestamp: "2025-07-15T13:58:40Z"
generation: 10
labels:
app.kubernetes.io/created-by: dragonfly-operator
app.kubernetes.io/instance: dragonfly
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: dragonfly
app.kubernetes.io/part-of: dragonfly-operator
kustomize.toolkit.fluxcd.io/name: dragonfly-hydra
kustomize.toolkit.fluxcd.io/namespace: hydra
name: dragonfly-hydra
namespace: hydra
resourceVersion: "74200740"
uid: f6c4a4f8-2655-4e73-b5a7-521a9d1454ab
spec:
annotations:
ad.datadoghq.com/dragonfly.checks: |
{
"openmetrics": {
"init_config": {},
"instances": [
{
"openmetrics_endpoint": "http://%%host%%:9999/metrics",
"namespace": "dragonfly",
"metrics": ["dragonfly_.*"]
}
]
}
}
args:
- --dbfilename=dragonfly-snapshot
- --maxmemory=40gb
- --cache_mode=false
- --max_client_iobuf_len=200000000
- --tiered_experimental_cooling=false
- --break_replication_on_master_restart=true
- --multi_eval_squash_buffer=102400000
- --conn_use_incoming_cpu=true
authentication:
passwordFromSecret:
key: password
name: dragonfly-hydra
image: docker.dragonflydb.io/dragonflydb/dragonfly:v1.32.0
imagePullPolicy: Always
labels:
scheduling/arch: arm
scheduling/spot-ratio: ondemand
replicas: 2
resources:
limits:
cpu: 4
memory: 10Gi
requests:
cpu: 2
memory: 5Gi
serviceAccountName: dragonfly
serviceSpec:
annotations:
service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: env=.....
service.beta.kubernetes.io/aws-load-balancer-attributes: load_balancing.cross_zone.enabled=false,dns_record.client_routing_policy=availability_zone_affinity
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "60"
service.beta.kubernetes.io/aws-load-balancer-name: paas-prod-hydraredis
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
service.beta.kubernetes.io/aws-load-balancer-scheme: internal
service.beta.kubernetes.io/aws-load-balancer-subnets: private-a,private-b,private-c
service.beta.kubernetes.io/aws-load-balancer-target-group-attributes: preserve_client_ip.enabled=true,stickiness.enabled=true,stickiness.type=source_ip,deregistration_delay.timeout_seconds=0,deregistration_delay.connection_termination.enabled=true
service.beta.kubernetes.io/aws-load-balancer-type: nlb
type: LoadBalancer
snapshot:
cron: 1 2 * * *
dir: s3://prod-dragonfly-backup-eu-west-1-20250806/dragonfly-hydra
status:
phase: ready
```
The load balancer class set by AWS because of the annotation `service.beta.kubernetes.io/aws-load-balancer-type: nlb` is:
```
loadBalancerClass: service.k8s.aws/nlb
```
This should not be a problem as this is AWS that takes care of that and we couldn't change that :/ It is cumbersome to support annotations to be compliant with any cloud provider choice and may this field could be simply ignored then ?
Thanks you.
Contributor guide
Assessment
This issue has not been assessed yet.