-
Notifications
You must be signed in to change notification settings - Fork 155
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
Do not set default namespace #1246
Do not set default namespace #1246
Conversation
@@ -67,7 +66,7 @@ func (crs *kubeops) Exec(ctx context.Context, tp param.TemplateParams, args map[ | |||
if err := Arg(args, KubeOpsOperationArg, &op); err != nil { | |||
return nil, err | |||
} | |||
if err := OptArg(args, KubeOpsNamespaceArg, &namespace, metav1.NamespaceDefault); err != nil { | |||
if err := OptArg(args, KubeOpsNamespaceArg, &namespace, nil); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PrasadG193 What do you think? Is there a better way to handle non-namespaced resources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passing default
namespace is a bit confusing for cluster scoped resources. I think empty string would also work. I will let Prasad approve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The safest way I can think of is having an additional arg through which we can decide if the resource is cluster scoped.
Another approach I can think of is running discovery and checking if the passed resource is cluster scoped and ignoring namespace in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In k8s cluster scoped resources are created simply without specifying a namespace. There is no explicit argument in the yaml. Handling this different in Kanister feels a bit confusing.
Latter approach should throw an error when specifying an namespace on a cluster scoped resource. Otherwise it would be quite confusing cause of the magic happening in the background.
@muffl0n Sorry for the delay; we didn't forget about this PR 🙂. The team has been discussing about the scope and purpose of the Can you tell us more about what you are trying to accomplish? If it is just to delete |
No worries and thank you for your feedback! In my blueprints, I mainly use VolumeSnapshots and heavily rely on the resources used in GCP like creating mysql backups with "gcloud sql backup". As I also want to use the backup from one environment to do a restore in another (e.g. when doing a sync from prod to qa), I have to transfer the data to the other cluster/project.
Now my restore just has to create the VolumeSnapshot (and VolumeSnapshotContent from above "handle") so that my StatefulSets can pick those as a datasource for their PVCs. Long story short: As I have to create the
I think there would need to be functions like "CreateVolumeSnapshotFromContent" and "DeleteVolumeSnapshotContent". I'm still not sure if this is enough and maybe even a bit too special. |
This allows kubeops to delete objects that do not have a namespace, like VolumeSnapshotContent or PersistentVolume
972486d
to
d5a3aa6
Compare
Superseded by #1282. |
Change Overview
Currently, it is not possible to delete objects that do not have a namespace, like VolumeSnapshotContent or PersistentVolume.
My blueprint:
This PR removes the setting of a default namespace, which allows these kind of operations.
Unfortunately, removing this default behaviour feels pretty dangerous, cause other users might already rely on that.
Thread in Slack: https://kanisterio.slack.com/archives/C85C8V22J/p1643919326058139
Pull request type
Please check the type of change your PR introduces:
Issues
Test Plan