-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Clusterrole and Webhook update for RAG Engine (#619)
**Reason for Change**: Clusterrole and Webhook update for RAG Engine **Requirements** - [ ] added unit tests and e2e tests (if applicable). **Issue Fixed**: <!-- If this PR fixes GitHub issue 4321, add "Fixes #4321" to the next line. --> **Notes for Reviewers**: Signed-off-by: Bangqi Zhu <bangqizhu@microsoft.com> Co-authored-by: Bangqi Zhu <bangqizhu@microsoft.com>
- Loading branch information
1 parent
2ec45ac
commit 38656dd
Showing
6 changed files
with
98 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
// SetDefaults for the RAG Engine | ||
func (w *RAGEngine) SetDefaults(_ context.Context) { | ||
} |
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,36 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
admissionregistrationv1 "k8s.io/api/admissionregistration/v1" | ||
"k8s.io/klog/v2" | ||
"knative.dev/pkg/apis" | ||
) | ||
|
||
func (w *RAGEngine) SupportedVerbs() []admissionregistrationv1.OperationType { | ||
return []admissionregistrationv1.OperationType{ | ||
admissionregistrationv1.Create, | ||
admissionregistrationv1.Update, | ||
} | ||
} | ||
|
||
func (w *RAGEngine) Validate(ctx context.Context) (errs *apis.FieldError) { | ||
base := apis.GetBaseline(ctx) | ||
if base == nil { | ||
klog.InfoS("Validate creation", "ragengine", fmt.Sprintf("%s/%s", w.Namespace, w.Name)) | ||
errs = errs.Also(w.validateCreate().ViaField("spec")) | ||
} | ||
return errs | ||
} | ||
|
||
func (w *RAGEngine) validateCreate() (errs *apis.FieldError) { | ||
if w.Spec.InferenceService == nil { | ||
errs = errs.Also(apis.ErrGeneric("InferenceService must be specified", "")) | ||
} | ||
return errs | ||
} |
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