-
Notifications
You must be signed in to change notification settings - Fork 51
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
Feat validating admission webhook #207
Feat validating admission webhook #207
Conversation
Signed-off-by: xu.zhu <[email protected]>
Signed-off-by: xu.zhu <[email protected]>
} | ||
|
||
// Get sends the admission request to the webhook server and returns the response | ||
func (c *HTTPAdmissionClient) Get(ctx context.Context, admitData *Request) (*Response, error) { |
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.
Method HTTPAdmissionClient.Get
has 6 return statements (exceeds 4 allowed).
Interest(*Request) bool | ||
} | ||
|
||
func Validating(ctx context.Context, request *Request) error { |
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.
Function Validating
has 7 return statements (exceeds 4 allowed).
Interest(*Request) bool | ||
} | ||
|
||
func Validating(ctx context.Context, request *Request) error { |
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.
Function Validating
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
be770ae
to
6add4c5
Compare
6add4c5
to
9944bbb
Compare
Interest(*Request) bool | ||
} | ||
|
||
func Validating(ctx context.Context, request *Request) error { |
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.
Function Validating
has 8 return statements (exceeds 4 allowed).
Interest(*Request) bool | ||
} | ||
|
||
func Validating(ctx context.Context, request *Request) error { |
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.
Function Validating
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Signed-off-by: xu.zhu <[email protected]>
9944bbb
to
b2ec543
Compare
) | ||
|
||
// Middleware to validate and mutate admission request | ||
func Middleware(skippers ...middleware.Skipper) gin.HandlerFunc { |
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.
Function Middleware
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
) | ||
|
||
// Middleware to validate and mutate admission request | ||
func Middleware(skippers ...middleware.Skipper) gin.HandlerFunc { |
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.
Function Middleware
has 53 lines of code (exceeds 50 allowed). Consider refactoring.
pkg/admission/webhook.go
Outdated
} | ||
} | ||
|
||
func Clear() { |
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.
Clear
is not called.
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.
fixed
Interest(*Request) bool | ||
} | ||
|
||
func Validating(ctx context.Context, request *Request) error { |
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.
Function Validating
has 51 lines of code (exceeds 50 allowed). Consider refactoring.
) | ||
|
||
// Middleware to validate and mutate admission request | ||
func Middleware(skippers ...middleware.Skipper) gin.HandlerFunc { |
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.
Function Middleware
has 56 lines of code (exceeds 50 allowed). Consider refactoring.
Signed-off-by: xu.zhu <[email protected]>
7226cce
to
f8e5e61
Compare
) | ||
|
||
// Middleware to validate and mutate admission request | ||
func Middleware(skippers ...middleware.Skipper) gin.HandlerFunc { |
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.
Function Middleware
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
Code Climate has analyzed commit f8e5e61 and detected 6 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 74.9% (60% is the threshold). This pull request will bring the total coverage in the repository to 66.3% (0.0% change). View more on Code Climate. |
@@ -624,7 +631,8 @@ func Init(ctx context.Context, flags *Flags, coreConfig *config.Config) { | |||
middleware.MethodAndPathSkipper(http.MethodPost, regexp.MustCompile("^/apis/core/v[12]/users/login"))), | |||
prehandlemiddle.Middleware(r, manager), | |||
auth.Middleware(rbacAuthorizer, authzSkippers...), | |||
tagmiddle.Middleware(), // tag middleware, parse and attach tagSelector to context | |||
tagmiddle.Middleware(), |
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.
comment?
Description of your changes
Fixes #
I have:
make build && make lint
to ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer