onepassword-operator icon indicating copy to clipboard operation
onepassword-operator copied to clipboard

[Feature Request] Enable creating multiple 1Password secrets using deployment annotations

Open edif2008 opened this issue 2 years ago • 3 comments

Summary

It would be great to be able to create multiple secrets from 1Password using annotations.

This is based on this customer's feedback.

This attempt doesn't work since the map keys have to be unique.

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    operator.1password.io/item-path: "vaults/test-k8s-cluster/items/nine-nine-test-secret"
    operator.1password.io/item-name: "nine-nine-test-secret"
    operator.1password.io/item-path: "vaults/test-k8s-cluster/items/demo-micro-configuration"
    operator.1password.io/item-name: "demo-micro-configuration"

Use cases

A deployment may need secrets that are stored in multiple 1Password items. To have the scope narrowed down, one would prefer to provide the secrets needed for a deployment as annotations.

Is there a workaround to accomplish this today?

Create the secrets using OnePasswordItem resources instead.

edif2008 avatar May 26 '23 12:05 edif2008

I have come across the same issue and was contemplating whether it is correct to aggregate all deployment credentials into a single secret. IMO, it is a better practice to split secrets based on single use.

A suggested solution would be to append a suffix the annotation, something like:

metadata:
  annotations:
    operator.1password.io/item-path/0: "vaults/test-k8s-cluster/items/nine-nine-test-secret"
    operator.1password.io/item-name/0: "nine-nine-test-secret"
    operator.1password.io/item-path/1: "vaults/test-k8s-cluster/items/demo-micro-configuration"
    operator.1password.io/item-name/1: "demo-micro-configuration"

bdsoha avatar Sep 28 '23 05:09 bdsoha

An even less verbose option would be to include the item name in the key:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment-example
  annotations:
    operator.1password.io/item-path/SECRET_NAME1: "vaults/VAULT/items/ITEM1"
    operator.1password.io/item-path/SECRET_NAME2: "vaults/VAULT/items/ITEM2"
    operator.1password.io/item-path/SECRET_NAME3: "vaults/VAULT/items/ITEM3"

andreasgrob avatar Nov 28 '23 13:11 andreasgrob

Hey folks! 👋 Thank you so much for providing additional usage examples. We really appreciate it. 😄

I do see the value of enabling multiple secrets to be consumed by a single application through annotation, so it is something worth looking into.

I don't have any timelines when the team will look into this, but in the meantime, you're more than welcome to contribute to this if you'd like and have the time. 😊

I will keep you posted when there's any progress on this from my team, though.

edif2008 avatar Nov 30 '23 11:11 edif2008