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

KubeClient & Core Data Protection #94

Closed
rriverak opened this issue Sep 13, 2019 · 16 comments
Closed

KubeClient & Core Data Protection #94

rriverak opened this issue Sep 13, 2019 · 16 comments

Comments

@rriverak
Copy link

Hey, thank you for this very handy client!
I currently have the need to enable Data Protection in my distributed dotnet application(s).

I would like to use native Kubernetes Secrets for this.
A third-party Secret-Vault like HashiCorp Vault seems oversized to me.
In my opinion, this scenario can be covered by Kubernetes alone.

A Package based on KubeClient.Extensions.Configuration could do that safely and quickly.

I think we just need some GlueCode between DataProtection and KubeClient.

services.AddDataProtection()
// Get Key-Signing Certificate from a Kuberenetes Secret
.ProtectKeysWithKubernetesSecret(...)
// Store signed Rotated-Keys in a Kubernetes Secret
.PersistKeysToKubernetesSecret(...)

It would then end in an KubeClient.Extensions.DataProtection package.

How can I contribute something like that?
or do you see something like this outside of this project?

@tintoy
Copy link
Owner

tintoy commented Sep 13, 2019

Hi - this sounds like a great idea :)

I’m happy for you to open a PR if you would like to have a go at this (and am happy to help out if there’s anywhere you get stuck that I actually know something about).

@tintoy
Copy link
Owner

tintoy commented Sep 13, 2019

If you’re not sure how to start I could create a branch and sketch out the project structure so you could drop your code in)...

@rriverak
Copy link
Author

Hey, thanks for the very fast answer :)
I would first write a small application and test the procedure in minikube.

If this works as expected, I will transfer it to a netstandard2.0 library.
After or during that, I would contact you again to get a branch and sketch out the project structure.

Many thanks!

@rriverak
Copy link
Author

Soo, after the first few test..
I would not build ontop of KubeClient.Extensions.Configuration package..
The Idea was to hook the secret loading implementation but theres I see no clean way outside of IConfiguration...

The real Proleme here is that the IConfiguration contains the plain DataProtection Keys over the hole runtime and this could be a bad idea ;)

For now, I start the implementation with the pure KubeClient and request / create / update the Secret directly...

@rriverak
Copy link
Author

That seems to work well now.

Here is my test repository:
https://github.com/rriverak/KubeClient.Extensions.DataProtection

@tintoy
Copy link
Owner

tintoy commented Sep 13, 2019

Wow - you work fast :)

I'm happy to handle this 1 of 2 ways (although feel free to suggest something else if you have other preferences):

  1. I can pull your code into this repository and get it released and published along the rest of KubeClient (I'll add you as a repo contributor so you can help maintain it).
  2. I can help you set up CI to get your package built and published from your own repo in a way that's similar/compatible to how it's done for KubeClient (you'll decide when you want to release new versions of you your package). Given the way KubeClient was designed and built, this is also a totally valid way to release additional functionality for it.

@rriverak
Copy link
Author

I'm a fan of monorepos ;-)
I would be very happy to see my code in the KubeClient repository :)

@tintoy
Copy link
Owner

tintoy commented Sep 13, 2019

Ok, I’ll have a go at integrating your code this weekend on a branch and get you do do a review when it’s ready. How’s that sound?

@tintoy
Copy link
Owner

tintoy commented Sep 14, 2019

What version of ASP.NET Core are you expecting to target? This will affect the library’s TargetFramework (I think 3.x, for example, only supports netcoreapp from memory but I could be mistaken - I’m on my phone at the moment).

@tintoy
Copy link
Owner

tintoy commented Sep 14, 2019

(technically netstandard2.1 but we’ll have to multi-target if you want to support ASP.NET Core 2.x as well)

@rriverak
Copy link
Author

I think it's good to support .NET Core 2.2.
After all, there is an LTS release for .NET Core 2.2.

The target of Microsoft.AspNetCore.DataProtection 2.2.x is netstandard2.0.
I think we can follow that for now.

In 3.0.0-preview9 they target both netstandard2.0;netcoreapp3.0

@tintoy
Copy link
Owner

tintoy commented Sep 14, 2019

Good-o, I’ll get started on this first thing tomorrow (it’s 10pm here).

@rriverak
Copy link
Author

many thanks for your effort!
I have no time pressure on this topic. :)

tintoy added a commit that referenced this issue Sep 15, 2019
This code has been ported from https://github.com/rriverak/KubeClient.Extensions.DataProtection (thanks, @rriverak!).
Note that, at this, stage, it is a work in progress (we need to decide on strategies for thread-safety and handling of common error conditions (such as the underlying Secret being deleted).

Relates to #94.
tintoy added a commit that referenced this issue Sep 15, 2019
@tintoy
Copy link
Owner

tintoy commented Oct 4, 2019

Sorry this has taken so long, work’s been a bit crazy!

I’m going to try to get this finished off over the weekend.

@tintoy
Copy link
Owner

tintoy commented Oct 5, 2019

Ok - I've published a build of the new package to the dev package feed (https://www.myget.org/F/dotnet-kube-client/api/v3/index.json).

Would you mind trying out the package and letting me know if it works for you? You're looking for KubeClient.Extensions.DataProtection, version 2.4.0-data-protection0006.

@tintoy
Copy link
Owner

tintoy commented May 19, 2024

And, years later, this has finally been implemented; sorry it took so long 🙂

Published as KubeClient.Extensions.DataProtection v2.5.8.

@tintoy tintoy closed this as completed May 19, 2024
@tintoy tintoy mentioned this issue Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants