Skip to content
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

unable add annotation use plaintext overide whether annotation fileld is exist or not exist #3923

Open
wu0407 opened this issue Aug 9, 2023 · 2 comments · May be fixed by #3927
Open

unable add annotation use plaintext overide whether annotation fileld is exist or not exist #3923

wu0407 opened this issue Aug 9, 2023 · 2 comments · May be fixed by #3927
Labels
kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@wu0407
Copy link
Contributor

wu0407 commented Aug 9, 2023

What happened:
I want to add annotation to spec.template.metadata.annotation whether annotation fileld is exist, but plaintext overide unable to achieve this goal.

direct add annotation

configuration:

spec:
 overrideRules:
  - overriders:
      plaintext:
      - path: /spec/template/metadata/annotations/test
        operator: add
        value: "test-value"

It is ok on spec.template.metadata.annotations is exist.

                        {"spec": {
				"template": {
					"metadata": {
						"annotations": {
							"c": "d"
						},
						"labels": {
							"a": "b"
						}
					}
				}
			}}

result

                            {"spec": {
				"template": {
					"metadata": {
						"annotations": {
							"c": "d",
                                                        "test": "test-value"
						},
						"labels": {
							"a": "b"
						}
					}
				}
			}}

It is not ok on spec.template.metadata.annotations is not exist.

                        {"spec": {
				"template": {
					"metadata": {
						"labels": {
							"a": "b"
						}
					}
				}
			}}

result:

E0809 07:50:41.625787       1 controller.go:329] "Reconciler error" err="add operation does not apply: doc is missing path: \"/spec/template/metadata/annotations/test\": missing value" controller="resourcebinding" controllerGroup="work.karmada.io" controllerKind="ResourceBinding" ResourceBinding="xxxxx/xxxxx-deployment" namespace="xxxxx" name="xxxx-deployment" reconcileID=b87a1530-c398-4393-82fa-82bef68ac8cb

Another way is add annotation field first, then add annotation. But It is not work.

configuration:

spec:
 overrideRules:
  - overriders:
      plaintext:
      - path: /spec/template/metadata/annotations
        operator: add
        value: {}
      - path: /spec/template/metadata/annotations/test
        operator: add
        value: "test-value"

It is not ok on spec.template.metadata.annotations is exist.

                        {"spec": {
				"template": {
					"metadata": {
						"annotations": {
							"c": "d"
						},
						"labels": {
							"a": "b"
						}
					}
				}
			}}

result

                            {"spec": {
				"template": {
					"metadata": {
						"annotations": {
                                                        "test": "test-value"
						},
						"labels": {
							"a": "b"
						}
					}
				}
			}}

It is ok on spec.template.metadata.annotations is not exist.

                        {"spec": {
				"template": {
					"metadata": {
						"labels": {
							"a": "b"
						}
					}
				}
			}}

result:

{"spec": {
				"template": {
					"metadata": {
						"annotations": {
                                                        "test": "test-value"
						},
						"labels": {
							"a": "b"
						}
					}
				}
			}}

the last method is one deployment one configuration, so inconvenient.

What you expected to happen:
add new annotation successed

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Karmada version:
  • kubectl-karmada or karmadactl version (the result of kubectl-karmada version or karmadactl version):
  • Others:
kubectl karmada version: version.Info{GitVersion:"v1.6.1", GitCommit:"fdc7ac62c70b571d091a795cbe9b9fceac5f1c2c", GitTreeState:"clean", BuildDate:"2023-07-06T03:35:37Z", GoVersion:"go1.20.4", Compiler:"gc", Platform:"linux/amd64"}
@wu0407 wu0407 added the kind/bug Categorizes issue or PR as related to a bug. label Aug 9, 2023
@wu0407 wu0407 changed the title unable add annotation use plaintext overide whether annotation fileld is exist unable add annotation use plaintext overide whether annotation fileld is exist or not exist Aug 9, 2023
@chaunceyjiang
Copy link
Member

I think it meets expectations.
Please refer to RFC 6902

@wu0407
Copy link
Contributor Author

wu0407 commented Aug 9, 2023

Users don't care about this, they need a more user-friendly configuration experience. And previous already fix on LabelAnnotationOverrider #2971

@RainbowMango RainbowMango added this to the v1.8 milestone Aug 15, 2023
@RainbowMango RainbowMango modified the milestones: v1.8, v1.9 Jan 9, 2024
@RainbowMango RainbowMango modified the milestones: v1.9, v1.10 Feb 29, 2024
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.
Projects
None yet
3 participants