-
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: git The 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? |
Beta Was this translation helpful? Give feedback.
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. |
Beta Was this translation helpful? Give feedback.
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.