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

klusterlet label syncing does not support numerical strings as the label values (e.g., my-label: "123") #530

Closed
EricaJ6 opened this issue Jun 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@EricaJ6
Copy link

EricaJ6 commented Jun 18, 2024

Describe the bug
We have a label with the string type, but actually a number inside the double quotes as a string. Getting json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string from klusterlet.

To Reproduce
Scenario 1:

  1. Add the label my-label: "123" to klusterlet
  2. In the applied EKS cluster, runningkubectl get klusterlet -o yaml produces following:
  • message: '["klusterlet/managed/klusterlet-registration-serviceaccount.yaml" (string): cannot decode "klusterlet/managed/klusterlet-registration-serviceaccount.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-registration-clusterrole.yaml" (string): cannot decode "klusterlet/managed/klusterlet-registration-clusterrole.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-registration-clusterrole-addon-management.yaml" (string): cannot decode "klusterlet/managed/klusterlet-registration-clusterrole-addon-management.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-registration-clusterrolebinding.yaml" (string): cannot decode "klusterlet/managed/klusterlet-registration-clusterrolebinding.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-registration-clusterrolebinding-addon-management.yaml" (string): cannot decode "klusterlet/managed/klusterlet-registration-clusterrolebinding-addon-management.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-work-serviceaccount.yaml" (string): cannot decode "klusterlet/managed/klusterlet-work-serviceaccount.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-work-clusterrole.yaml" (string): cannot decode "klusterlet/managed/klusterlet-work-clusterrole.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-work-clusterrole-execution.yaml" (string): cannot decode "klusterlet/managed/klusterlet-work-clusterrole-execution.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-work-clusterrolebinding.yaml" (string): cannot decode "klusterlet/managed/klusterlet-work-clusterrolebinding.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-work-clusterrolebinding-aggregate.yaml" (string): cannot decode "klusterlet/managed/klusterlet-work-clusterrolebinding-aggregate.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string, "klusterlet/managed/klusterlet-work-clusterrolebinding-execution-admin.yaml" (string): cannot decode "klusterlet/managed/klusterlet-work-clusterrolebinding-execution-admin.yaml": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string]' reason: ManagedClusterResourceApplyFailed status: "False" type: Applied

  • message: 'Failed to get deployment "open-cluster-management-agent" "klusterlet-agent": deployments.apps "klusterlet-agent" not found' observedGeneration: 1 reason: GetDeploymentFailed status: "False" type: Available

Scenario 2: Then, we tested the integration test in the ocm repo.

  1. Update the labels in klusterlet_test.go to
    Labels: map[string]string{"test": "123", "component": "klusterlet"},
  2. Run the integration test by make test-registration-operator-integration locally

Getting:
E0618 11:37:56.802024 54730 helpers.go:592] failed to generate relatedResource [35 32 ... 93 10], and skip to set into status. json: cannot unmarshal number into Go struct field ObjectMeta.metadata.labels of type string

Expected behavior
Should have create the resources successfully with the labels

Environment:
OCM version: 0.13.3
clusteradm version: 0.8.4
Kubernetes version: v1.28.10

@EricaJ6 EricaJ6 added the bug Something isn't working label Jun 18, 2024
@zhiweiyin318
Copy link
Member

this issue was fixed in release 0.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants