what does "preferences: {}" in ~/.kube/config do? what does "preferences: {}" in ~/.kube/config do? kubernetes kubernetes

what does "preferences: {}" in ~/.kube/config do?


Interesting question. Looking at the source code here https://github.com/kubernetes/client-go/blob/d412730e5f0160f6dc0a83459c14b05df8ea56fb/tools/clientcmd/api/v1/types.go it seems that preferences is used for ”holding general information to be use for cli interactions”. It can hold two config parameters: colors(boolean) and extensions(array of extension descriptor objects). There was also this comment here: https://github.com/kubernetes/client-go/blob/228dada99554f2e0f7ef07e24f2a4a88c0e448bb/tools/clientcmd/config.go saying: ” Preferences and CurrentContext should always be set in the default destination file. Since we can't distinguish between empty and missing values (no nil strings), we're forced have separate handling for them.”

So, as I understand, preferences is there because it is required not be nil and technically it’s impossible to distinguish empty and missing values. Does this answer your question?