Secret with empty value field

ohrab
ohrab
Community Member

Hi there,

I want to create secret for gitlab registration token, It should has 2 filed mandatory: 1 field with token, another one is empty:

apiVersion: v1
data:
  runner-registration-token: LkjdfsdlfHGDFKhskdfLkjsdflkj=
  runner-token: ""
kind: Secret

When I decode secret it looks like this one:

runner-registration-token: wnR1348lkdj98-JdfgdfghdaMx3tgSdn4c
runner-token:

runner-token value doesn't have even space. I didn't find a way how to add an empty secret to onepassword and reflect it in k8s secret as it should be. When I add 1pass secret with space, it encode space to base64. I've tried to add "" and '', but it also encoded in secret. If I don't provide informaion to value in 1pass secret, it doesn't sync to k8s secret.


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided

Comments

  • Hey @ohrab,

    Currently the 1Password Kubernetes operator ignores all fields that are empty when creating a Kubernetes Secret.
    When you update a 1Password item and empty one of the fields (i.e. the value of the field is an empty string), the operator will update the secret by removing that data from the secret. Therefore, you will not see the runner-token data since it doesn't exist.

    Would you think it would be a good idea to make the operator add all the data from the 1Password Item to the Kubernetes Secret even though it's empty?
    This means that if the item has multiple fields that are empty, the keys will be present when getting the secret and their values will be empty (i.e. the empty string).

  • ohrab
    ohrab
    Community Member

    Hello. Thx for the reply. From my point of view, the operator should add all fields from 1Password, even empty fields. It make sense for some utilities read empty value from secret. If user decide to have empty in 1Password, then it should be reflected in secret.

  • Hey @ohrab,

    Thank you for explaining the use case. I will raise this with my team and discuss how we can include your use case in the way the operator behaves.

    I will come back to you when we release a new version of the operator that can add fields with empty values. 😊

  • ohrab
    ohrab
    Community Member

    Hey @eddy_1P ,

    Thx a lot!

This discussion has been closed.