Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Use ownerReference on secrets #45

Open
applejag opened this issue Sep 2, 2022 · 3 comments
Open

Feature: Use ownerReference on secrets #45

applejag opened this issue Sep 2, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@applejag
Copy link

applejag commented Sep 2, 2022

By setting ownerReference on the secrets pointing to the source ClusterSecret Custom Resource adds a coupling that is both useful when just looking at the YAML of a secret, as well as then the operator could offload the deletion of secrets when the parent ClusterSecret is removed to the kubernetes built-in APIs.

The ownerReference field can also be added on existing objects, so the secrets wont have to be recreated when adding this feature, only updated.

@applejag
Copy link
Author

applejag commented Sep 2, 2022

Just found out that ownerReferences can only target stuff in the same namespace.

Which brings up a question, why is the CRD namespaced? All other Kubernetes resources that have the Cluster- prefix are cluster-scoped instead of namespace-scoped. Was this a conscious decision?

@zakkg3
Copy link
Owner

zakkg3 commented Sep 8, 2022

Hi Jillie
Not sure what would the adv to make the CRD cluster scope? security and isolation wise its not the same. do we want that?

@applejag
Copy link
Author

applejag commented Sep 8, 2022

Hmm this made me think.

Pro namespace-scoped:

  • Usage in clusters where e.g teams have their own namespaces and the setup don't let the different teams step on each other's toes. That would require one operator installed per namespace, but at least the RBAC on the service account that ClusterSecret operator uses could be restricted.

Pro cluster-scoped:

  • Supports ownerReferences to offload GC to kubernetes
  • Follows expectation/convention of "ClusterX" resources to be cluster-wide

Yea the security functionality vs conventions is an obvious win to the former.

(Maybe a name such as SyncedSecret could be more appropriate?)

However the namespace-scoped RBAC use case should probably be documented, as I could assume an easy misconfiguration would be to have 1 global ClusterSecret operator, but then try to lock down creation of ClusterSecret CR to the namespaces. The ClusterSecret could then be used to steal secrets from other namespaces you otherwise wouldn't have access to. Having multiple operators running is clunky, but it's as far as I can tell the only option for such a usecase. Would need some way to not make multiple operators step on each other's toes then as well though.

Tricky topic!

@zakkg3 zakkg3 added the enhancement New feature or request label Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants