Repository navigation
|
If one was to import apiVersion: configsync.gke.io/v1beta1
kind: RootSync
metadata:
name: root-sync
namespace: config-management-system
spec:
git:
auth: none
dir: /root-sync
period: 0s
privateCertSecret: {}
repo: https://github.com/mikebz/kpt-samples.git/root-sync
revision: v6
secretRef: {}
override: {}
sourceType: gitThe reason is because these structs are not declared as pointers: SecretRef SecretReference `json:"secretRef,omitempty"`
...
CACertSecretRef SecretReference `json:"caCertSecretRef,omitempty"`Is there a reason for it? |
Answered by
karlkfi
Oct 18, 2022
Replies: 1 comment 1 reply
|
IIRC, this is related to a Golang JSON bug (golang/go#10648) that ignores omitempty on structs. Since the K8s yaml formatter round trips through json, it picks up this bug and always prints {} for empty structs. Changing the structs to pointers might work around the issue, but it also might break reverse compatibility. |
1 reply
Answer selected by
mikebz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IIRC, this is related to a Golang JSON bug (golang/go#10648) that ignores omitempty on structs. Since the K8s yaml formatter round trips through json, it picks up this bug and always prints {} for empty structs.
Changing the structs to pointers might work around the issue, but it also might break reverse compatibility.