-
Notifications
You must be signed in to change notification settings - Fork 222
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
FLI Issue 3222: Import issue when --address and --drop is used #3530
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3530 +/- ##
==========================================
- Coverage 64.17% 64.08% -0.09%
==========================================
Files 169 169
Lines 16917 16942 +25
==========================================
+ Hits 10856 10858 +2
- Misses 5378 5401 +23
Partials 683 683
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@devumesh Thank you for your contribution! Please be patient as it will take some discussion. @GeorgeMac @markphelps could you please take a look on this? As it's a new API endpoint I would like to hear your thoughts on it. I believe the RBAC, audit and observability could be affected by this. Maybe we could do it differently and allow force wdyt? |
Hey @devumesh thanks for taking this on! Great points raised @erka too!
That is right. We will need to implement the Line 502 in d05a775
Example: Lines 112 to 114 in d05a775
Effectively, we would need to add to this file ☝️ something like: func (req *DeleteAllNamespacesRequest) Request() []Request {
return []Request{NewRequest(ResourceNamespace, ActionDelete)}
} Here I have said the requester needs to be able to delete any namespace in order for this to be authorized (notice there is no resource key). I believe by implementing this one function that
Could you speak to this a bit more @erka ? I am not sure I quite follow yet. As in like, support deleting protected namespaces? Or maybe like... dropping the contents, not deleting? (
If this API exists, I don't think it is necessarily a bad thing to have it in the OpenAPI spec. I understand the concern though that most folks shouldn't be triggering this and we don't want folks dropping everything by mistake. Maybe there is more we can do from an authz perspective (feels like an authz problem). |
Currently you can't delete the namespace with |
@GeorgeMac is correct above about what's required for authz/auditing to work, we should just need to create that requester method to fulfil the interface here: Lines 3 to 5 in 81ec576
Re: @erka 's comments, I tend to agree that protected may not mean much anymore, it wasn't ever exposed publicly from a UI/API perspective (although it is exposed in the
IMO if users are messing around in the database then all bets are off, there is only so much we can guard against
I agree it is a bit weird that we would create the Perhaps, instead on Flipt startup, it could check to see if there is a default namespace and if not create one? That way we could keep this deleteAllNamespaces as is and remove the creation of the default one at the end? Just throwing it out there. We could then get rid of the notion of a If user calls deleteAllNamespace then it will do just that, mostly it should only ever be used for import which as the initial intent of this PR. Just my thoughts |
I am also going to throw a variation of what I mentioned before into the mix: When WDYT? |
@markphelps I think you are right. Probably @GeorgeMac if only It would be nice to have some resolution here so this PR could move forward. |
Agree, would like to get this in the next release (hopefully tomorrow).
Good point. We could check for the default namespace when loading the ui and prompt the user to create it if it doesn't exist. If instead they simply are using |
@erka I see the concern. There is the question of "is delete namespace contents a verb/action in authz language of its own?".
To have both, we need to distinguish that in the policy with potentially a new action or resource. The
@markphelps Flipt startup wouldn't be an appropriate time, since you can import into it while Flipt is online (in fact it needs to be online for import to go through the API). We're not going to restart Flipt after the import is done, we don't want an API that causes a restart and that would just be silly anyway. Really we need the |
Hey @devumesh we had a talk in the community hours today about how to tackle this change. We decided that it might actually be best to change the way this works slightly. The
The We appreciate all the effort you've put into making this approach work, sorry for the delay and lack of clarity on how we wanted this solved. Would you still be interested in updating this PR to do what we described here? |
Hi @GeorgeMac, yeah I'm interested |
Signed-off-by: devumesh <[email protected]>
d05a775
to
110da4c
Compare
Hi @GeorgeMac , I have a question when |
@devumesh There’s no need to worry about the |
Signed-off-by: devumesh <[email protected]>
Signed-off-by: devumesh <[email protected]>
786e435
to
4b9db64
Compare
Signed-off-by: devumesh <[email protected]>
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.
lgtm! Thank you @devumesh !!
@erka I think what @devumesh is saying is that after dropping the default namespace if the flipt/internal/server/namespace.go Line 76 in cb9cfaa
|
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.
@devumesh great work! ty
@markphelps yep, I've got that message. We could add the notice about it in the docs but I think it makes very little impact overall. |
@all-contributors please add @devumesh for code |
@devumesh already contributed before to code |
Approach:
default
.DELETE /api/v1/namespaces
--drop
is used with--address
, delete all namespaces API is called using SDK client before starting the actual importfixes: #3222