cockroachdb/cockroach-operator

Cannot delete ingress.ui's annotations once created

开放

#927 创建于 2022年8月13日

 (1 条评论) (0 个反应) (0 位负责人)Go (103 个派生)auto 404
buggood first issue

仓库指标

星标
 (318 个星标)
PR 合并指标
 (平均合并 12天 20小时) (30 天内合并 5 个 PR)

描述

What version of operator are you using? commit 561cf47d783c368fd8795acb82a5a39099a35984 (HEAD -> master)

What operating system and processor architecture are you using (kubectl version)? Ubuntu. 20.04

What did you do?

We are trying to delete the annotations of the ingress.ui by setting the ingress.ui.annotations to null I first deployed the operator using the example yaml file and crd yaml file. Then I created the cluster by applying the following custom resource file:

apiVersion: crdb.cockroachlabs.com/v1alpha1
kind: CrdbCluster
metadata:
  name: test-cluster
spec:
  additionalLabels:
    crdb: is-cool
  dataStore:
    pvc:
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
        volumeMode: Filesystem
  image:
    name: cockroachdb/cockroach:v21.2.10
  ingress:
    ui:
      annotations:
        mykey: myvalue
      host: localhost
  nodes: 3
  resources:
    limits:
      cpu: 2
      memory: 2Gi
    requests:
      cpu: 100m
      memory: 1Gi
  tlsEnabled: true

(All files were applied using kubectl apply -f <filename> -n cockroach-operator-system)

Then I deleted the ingress.ui.annotation field (basically, deleting "annotations"), as follows:

apiVersion: crdb.cockroachlabs.com/v1alpha1
kind: CrdbCluster
metadata:
  name: test-cluster
spec:
  additionalLabels:
    crdb: is-cool
  dataStore:
    pvc:
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
        volumeMode: Filesystem
  image:
    name: cockroachdb/cockroach:v21.2.10
  ingress:
    ui:
      annotations: null
      host: localhost
  nodes: 3
  resources:
    limits:
      cpu: 2
      memory: 2Gi
    requests:
      cpu: 100m
      memory: 1Gi
  tlsEnabled: true

What did you expect to see and what did you see instead?

I expect to see annotations being deleted, but they are still present.

Root cause The way annotations are updated is merging new annotations into old ones, as this function suggests. However, when a field is deleted (i.e. being changed to null), the key and value pair will not show up in the new annotations, resulting in the old annotations leaving unchanged.

贡献者指南