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

Glob pattern based resource selection #28

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

janosroden
Copy link

@janosroden janosroden commented May 10, 2018

I found kube-backup project as an excellent start to backup my OpenShift cluster and I want to merge back this improvement.
Unfortunately this is a breaking change but I think it worth it.

Changes:

  1. NAMESPACES, GLOBALRESOURCES and RESOURCETYPES are replaced by RESOURCES
  2. Output file name format changed to <resource type>.<name>.yaml

@pieterlange
Copy link
Owner

Thanks for the PR! Looks like a whole bunch of good improvements but i'll need to test them before merging. Have you tested this yourself with git-crypt?

I'm hoping to strike a balance between a nice quick and dirty (but understandable) setup and something more comprehensive like github.com/heptio/ark

@janosroden
Copy link
Author

I didn't tested git-crypt because the changes are unrelated to git. If you already have an environment for that I'd be glad if you try it.

Actually the entire development was against an OpenShift cluster and I had to change a few more things because of that, but the subject of this PR is the resource name collection only. What I want to say is that I didn't setup a minikube, role, binding, cronjob, git-crypt keys, secret and git repo for this.

So again, try it please, I tried only the kubectl commands, they worked fine. Git worked as well except git-crypt. Pretty much the whole script is running now in my OS cluster fine and what I did is replacing 'oc' with 'kubectl' (then try the commands if they behave like oc).

If you try and it fails somehow just let me know and I'll setup the env.

About heptio/ark it's up to you, but honestly I don't really see the point. I need backup for disaster recovery which should occur never or rare and for historical purposes; but not for recover frequently and easily. And copying objects to different environment I would use the original helm package.

@pieterlange
Copy link
Owner

Sorry for letting this linger. I'm gonna make time to fully review this the coming week (starting tomorrow).

@janosroden
Copy link
Author

No problem, take your time :)
Btw in the meantime I changed the job's concurrency policy to Forbid because 30 minutes wasn't enough for the backup and it was killed by the Replace policy. (Due to too many namespaces and resource types.)
"Forbid": forbids concurrent runs, skipping next run if previous run hasn’t finished yet

Actually the whole backup (querying at the first place) is slower than I expected first despite the cache variables. I think it can be speed up running one separate bash process for each resource type and collect the results. In my experiments querying 10 types parallel almost takes the same time as one type.
That could be a subject of another PR in the future. For now at least it isn't slower than yours.

@mumrau
Copy link

mumrau commented Apr 19, 2019

Hey @janosroden and @pieterlange , any news on this getting merged upstream?

I really like this way of declaring resources to be backed-up, most of us kubernetes admins and users would really appreciate being able to declare a bunch of them (like *.istio.io on a global basis), and even * as a whole to simply select them all.

I really like the project as a whole, simple quick and dirty is exactly what many users are looking for, the huge projects backed-up by companies are not my sauce for basic tasks. Just wanted to know what's up here before typing my CRD's out, storing them as ConfigMap and loading it as env variables :)

EDIT: after checking the commits, I see that resources cannot be "glob pattern selected". I think that would be great for operators and other complex meshed resources.

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

Successfully merging this pull request may close these issues.

3 participants