forked from kubesphere/kubesphere
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: f10atin9 <[email protected]>
- Loading branch information
Showing
17 changed files
with
1,310 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package webhooks | ||
|
||
import ( | ||
"context" | ||
|
||
accessor "github.com/kubesphere/storageclass-accessor/webhook" | ||
v1 "k8s.io/api/admission/v1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission" | ||
) | ||
|
||
type AccessorHandler struct { | ||
C client.Client | ||
decoder *admission.Decoder | ||
} | ||
|
||
func (h *AccessorHandler) InjectDecoder(d *admission.Decoder) error { | ||
h.decoder = d | ||
return nil | ||
} | ||
|
||
func (h *AccessorHandler) Handle(ctx context.Context, req admission.Request) admission.Response { | ||
review := v1.AdmissionReview{ | ||
Request: &req.AdmissionRequest, | ||
} | ||
resp := accessor.AdmitPVC(review) | ||
return admission.Response{ | ||
AdmissionResponse: *resp, | ||
} | ||
} |
201 changes: 201 additions & 0 deletions
201
vendor/github.com/kubesphere/storageclass-accessor/LICENSE
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.