kubernetes operator, how to hide property value in describe

4/8/2020

I am writing a k8s operator. In my CR file, I want to get password and store it in secret. Everything works fine except this password gets printed on the screen when I describe my object kubectl describe myKind myObject is there any way to hide particular property from spec or at least show *** instead of actual value? just like secret it just shows bytes and not actual value.

Added line before my property // +kubebuilder:validation:Format=password. this add format: password in CRD file but when I describe myObject it still prints all Spec values on the console.

Edit: SO putting more light on this:

my **_types.go snipplet is:

    // DB username
    DbUser string `json:"dbUser,required"`

    // DB password
    // +kubebuilder:validation:Format=password
    DbPassword string `json:"dbPassword,required"`

so I am making k8s secret out of dbUser and dbPassword I have another option to ask users to create a secret as pre-req but I am not happy with that approach.

Thanks in advance.

-- Guru
kubernetes-operator

0 Answers