Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor handlers to return object and error
- Loading branch information
1 parent
94d579a
commit 1b6b067
Showing
88 changed files
with
653 additions
and
753 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
package whitelistproxy | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/rancher/rancher/server/whitelist" | ||
"github.com/rancher/types/apis/management.cattle.io/v3" | ||
"github.com/rancher/types/config" | ||
) | ||
|
||
func Register(management *config.ScaledContext) { | ||
management.Management.NodeDrivers("").AddHandler("whitelist-proxy", sync) | ||
func Register(ctx context.Context, management *config.ScaledContext) { | ||
management.Management.NodeDrivers("").AddHandler(ctx, "whitelist-proxy", sync) | ||
} | ||
|
||
func sync(key string, nodeDriver *v3.NodeDriver) error { | ||
func sync(key string, nodeDriver *v3.NodeDriver) (*v3.NodeDriver, error) { | ||
if key == "" || nodeDriver == nil { | ||
return nil | ||
return nil, nil | ||
} | ||
if nodeDriver.DeletionTimestamp != nil { | ||
for _, d := range nodeDriver.Spec.WhitelistDomains { | ||
whitelist.Proxy.Rm(d) | ||
} | ||
return nil | ||
return nil, nil | ||
} | ||
|
||
for _, d := range nodeDriver.Spec.WhitelistDomains { | ||
whitelist.Proxy.Add(d) | ||
} | ||
return nil | ||
return nil, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.