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

NET-602: delete ext clients when ingress node is removed from network #2554

Merged
merged 44 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
11655df
add superadmin role, apis to create superadmin user
abhishek9686 Aug 16, 2023
f66cd3d
apis to attach and remove user from remote access gateways
abhishek9686 Aug 17, 2023
6cd7939
add api to list user's remote client has gateway clients
abhishek9686 Aug 17, 2023
d4b76fb
remove code related user groups
abhishek9686 Aug 21, 2023
33c0707
remove networks and groups from user model
abhishek9686 Aug 21, 2023
abdd2e4
refactor user CRUD operations
abhishek9686 Aug 21, 2023
f53bbd0
fix network permission test
abhishek9686 Aug 21, 2023
7526ee2
add superadmin to authorize func
abhishek9686 Aug 21, 2023
89fb719
remove user network and groups from cli
abhishek9686 Aug 21, 2023
76ec51e
api to transfer superadmin role
abhishek9686 Aug 22, 2023
e544fee
add api to list users on a ingress gw
abhishek9686 Aug 22, 2023
595911b
restrict user access to resources on server
abhishek9686 Aug 22, 2023
b301a1e
deny request from remote access client if extclient is already created
abhishek9686 Aug 23, 2023
4cbfb3e
fix user tests
abhishek9686 Aug 23, 2023
ad32f06
fix static checks
abhishek9686 Aug 23, 2023
f3f2cfd
fix static checks
abhishek9686 Aug 23, 2023
98e7a98
add limits to extclient create handler
abhishek9686 Aug 23, 2023
6ffac8c
set username to superadmin on if masterkey is used
abhishek9686 Aug 23, 2023
6e7f8c7
allow creation of extclients using masterkey
abhishek9686 Aug 23, 2023
ed5d022
add migration func to assign superadmin role for existing admin user
abhishek9686 Aug 24, 2023
93dfd80
Merge branch 'develop' into NET-551
abhishek9686 Aug 24, 2023
484ce65
check for superadmin on migration if users are present
abhishek9686 Aug 24, 2023
a2558d8
Merge branch 'NET-551' of https://github.com/gravitl/netmaker into NE…
abhishek9686 Aug 24, 2023
72ba473
allowe masterkey to extcleint apis
abhishek9686 Aug 24, 2023
41d6ca9
check ownerid
abhishek9686 Aug 24, 2023
299d086
format error, on jwt token verification failure return unauthorized r…
abhishek9686 Aug 25, 2023
8136d03
user update fix
abhishek9686 Aug 25, 2023
be71536
move user remote functionality to ee
abhishek9686 Aug 25, 2023
2f78fc8
fix update user api
abhishek9686 Aug 28, 2023
06088b9
security patch
abhishek9686 Aug 28, 2023
95009fc
initalise ee user handlers
abhishek9686 Aug 28, 2023
64370f2
allow user to use master key to update any user
abhishek9686 Aug 29, 2023
a986db6
use slog
abhishek9686 Aug 29, 2023
7b1aebb
fix auth user test
abhishek9686 Aug 29, 2023
57c967b
table headers
abhishek9686 Aug 29, 2023
a9edab1
Merge branch 'develop' into NET-551
abhishek9686 Aug 30, 2023
c5aa242
remove user role, it's covered in middleware
abhishek9686 Aug 31, 2023
830ba0f
Merge branch 'NET-551' of https://github.com/gravitl/netmaker into NE…
abhishek9686 Aug 31, 2023
629d138
resolve merge conflicts
abhishek9686 Sep 1, 2023
2783132
setuser defaults fix
abhishek9686 Sep 1, 2023
7f6e92c
if ingress node is deleted, cleanup gateway clients
abhishek9686 Sep 4, 2023
0597ed3
Merge branch 'develop' of https://github.com/gravitl/netmaker into NE…
abhishek9686 Sep 4, 2023
1ad96c5
delete ext clients in a go routine
abhishek9686 Sep 4, 2023
cdf0443
remove response writer from go routine
abhishek9686 Sep 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions controllers/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,14 @@ func deleteHostFromNetwork(w http.ResponseWriter, r *http.Request) {
// unset all the relayed nodes
logic.SetRelayedNodes(false, node.ID.String(), node.RelayedNodes)
}
if node.IsIngressGateway {
// delete ext clients belonging to ingress gateway
go func(node models.Node) {
if err = logic.DeleteGatewayExtClients(node.ID.String(), node.Network); err != nil {
slog.Error("failed to delete extclients", "gatewayid", node.ID.String(), "network", node.Network, "error", err.Error())
}
}(*node)
}
logger.Log(1, "deleting node", node.ID.String(), "from host", currHost.Name)
if err := logic.DeleteNode(node, forceDelete); err != nil {
logic.ReturnErrorResponse(w, r, logic.FormatError(fmt.Errorf("failed to delete node"), "internal"))
Expand Down
10 changes: 10 additions & 0 deletions controllers/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,16 @@ func deleteNode(w http.ResponseWriter, r *http.Request) {
// unset all the relayed nodes
logic.SetRelayedNodes(false, node.ID.String(), node.RelayedNodes)
}
if node.IsIngressGateway {
// delete ext clients belonging to ingress gatewa
go func(node models.Node) {
if err = logic.DeleteGatewayExtClients(node.ID.String(), node.Network); err != nil {
slog.Error("failed to delete extclients", "gatewayid", node.ID.String(), "network", node.Network, "error", err.Error())
}
}(node)

}

purge := forceDelete || fromNode
if err := logic.DeleteNode(&node, purge); err != nil {
logic.ReturnErrorResponse(w, r, logic.FormatError(fmt.Errorf("failed to delete node"), "internal"))
Expand Down
Loading