-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sync: sync up dev/lm-eval branch with main branch (#336)
* [CI] Run tests from trustyai-tests (#279) * Change Dockerfile to clone trustyai-tests * Add PYTEST_MARKERS env and remove TESTS_REGEX * RHOAIENG-12274: Update operator's overlays (#287) * Update operator's overlays * Update kustomization.yaml * Add devflag printout to GH Action comment (#289) * Add timeout loop to DSC install (#305) * RHOAIENG-13625: Add DBAvailable status to CR (#304) * Add DBAvailable status to CR * Remove probes * Add KServe destination rule for Inference Services in the ServiceMesh (#315) * Add DestinationRule creation for KServe serverless * Add permissions for destination rules * Add role for destination rules * Add missing role for creating destination rules * Fix spacing in DestinationRule template * Add check if DestinationRule CRD is present before creating it (#316) * Add check for DestinationRule CRD * Add API extensions to operator's scheme * Add permission for CRD resource * Fix operator metrics service target port (#320) * Add readiness probes (#312) * Enable KServe serverless in the rhoai overlay (#321) * Update overlay images (#331) * Add correct CA cert to JDBC (#324) * Add correct CA cert to JDBC * Add require SSL * Support for VirtualServices for InferenceLogger traffic (#332) * Generate KServe Inference Logger in conformance with DestinationRule and VirtualService * Add VirtualService creation for models in the mesh * Add permissions for VirtualServices * Update manifests for VirtualServices * Fix VirtualServiceName variable * fix yaml linter after the sync Signed-off-by: Yihong Wang <[email protected]> * tidy the go.mod and go.sum as well Signed-off-by: Yihong Wang <[email protected]> --------- Signed-off-by: Yihong Wang <[email protected]> Co-authored-by: Adolfo Aguirrezabal <[email protected]> Co-authored-by: Rui Vieira <[email protected]> Co-authored-by: Rob Geada <[email protected]> Co-authored-by: Rui Vieira <[email protected]>
- Loading branch information
1 parent
faf468b
commit 471738b
Showing
27 changed files
with
601 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ lmes-image-pull-policy=Always | |
lmes-max-batch-size=24 | ||
lmes-default-batch-size=8 | ||
lmes-detect-device=true | ||
|
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 |
---|---|---|
|
@@ -10,4 +10,4 @@ patchesStrategicMerge: | |
configMapGenerator: | ||
- env: params.env | ||
behavior: merge | ||
name: config | ||
name: config |
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,62 @@ | ||
package tas | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
|
||
trustyaiopendatahubiov1alpha1 "github.com/trustyai-explainability/trustyai-service-operator/api/tas/v1alpha1" | ||
appsv1 "k8s.io/api/apps/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/types" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
func (r *TrustyAIServiceReconciler) checkDatabaseAccessible(ctx context.Context, instance *trustyaiopendatahubiov1alpha1.TrustyAIService) (bool, error) { | ||
deployment := &appsv1.Deployment{} | ||
err := r.Get(ctx, types.NamespacedName{Name: instance.Name, Namespace: instance.Namespace}, deployment) | ||
if err != nil { | ||
if errors.IsNotFound(err) { | ||
return false, nil | ||
} | ||
return false, err | ||
} | ||
|
||
for _, cond := range deployment.Status.Conditions { | ||
if cond.Type == appsv1.DeploymentAvailable && cond.Status == corev1.ConditionTrue { | ||
podList := &corev1.PodList{} | ||
listOpts := []client.ListOption{ | ||
client.InNamespace(instance.Namespace), | ||
client.MatchingLabels(deployment.Spec.Selector.MatchLabels), | ||
} | ||
if err := r.List(ctx, podList, listOpts...); err != nil { | ||
return false, err | ||
} | ||
|
||
for _, pod := range podList.Items { | ||
for _, cs := range pod.Status.ContainerStatuses { | ||
if cs.Name == "trustyai-service" { | ||
if cs.State.Running != nil { | ||
return true, nil | ||
} | ||
|
||
if cs.LastTerminationState.Terminated != nil { | ||
termination := cs.LastTerminationState.Terminated | ||
if termination.Reason == "Error" && termination.Message != "" { | ||
if strings.Contains(termination.Message, "Socket fail to connect to host:address") { | ||
return false, nil | ||
} | ||
} | ||
} | ||
|
||
if cs.State.Waiting != nil && cs.State.Waiting.Reason == StateReasonCrashLoopBackOff { | ||
return false, nil | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return false, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package tas | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"reflect" | ||
|
||
trustyaiopendatahubiov1alpha1 "github.com/trustyai-explainability/trustyai-service-operator/api/tas/v1alpha1" | ||
templateParser "github.com/trustyai-explainability/trustyai-service-operator/controllers/tas/templates" | ||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" | ||
"k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
"k8s.io/apimachinery/pkg/types" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/log" | ||
) | ||
|
||
const ( | ||
destinationRuleTemplatePath = "service/destination-rule.tmpl.yaml" | ||
destinationRuleCDRName = "destinationrules.networking.istio.io" | ||
) | ||
|
||
// DestinationRuleConfig has the variables for the DestinationRule template | ||
type DestinationRuleConfig struct { | ||
Name string | ||
Namespace string | ||
DestinationRuleName string | ||
} | ||
|
||
// isDestinationRuleCRDPresent returns true if the DestinationRule CRD is present, false otherwise | ||
func (r *TrustyAIServiceReconciler) isDestinationRuleCRDPresent(ctx context.Context) (bool, error) { | ||
crd := &apiextensionsv1.CustomResourceDefinition{} | ||
|
||
err := r.Get(ctx, types.NamespacedName{Name: destinationRuleCDRName}, crd) | ||
if err != nil { | ||
if !errors.IsNotFound(err) { | ||
return false, fmt.Errorf("error getting "+destinationRuleCDRName+" CRD: %v", err) | ||
} | ||
// Not found | ||
return false, nil | ||
} | ||
|
||
// Found | ||
return true, nil | ||
} | ||
|
||
func (r *TrustyAIServiceReconciler) ensureDestinationRule(ctx context.Context, instance *trustyaiopendatahubiov1alpha1.TrustyAIService) error { | ||
|
||
destinationRuleName := instance.Name + "-internal" | ||
|
||
existingDestinationRule := &unstructured.Unstructured{} | ||
existingDestinationRule.SetKind("DestinationRule") | ||
existingDestinationRule.SetAPIVersion("networking.istio.io/v1beta1") | ||
|
||
// Check if the DestinationRule already exists | ||
err := r.Get(ctx, types.NamespacedName{Name: destinationRuleName, Namespace: instance.Namespace}, existingDestinationRule) | ||
if err == nil { | ||
// DestinationRule exists | ||
return nil | ||
} | ||
|
||
if !errors.IsNotFound(err) { | ||
return fmt.Errorf("failed to check for existing DestinationRule: %v", err) | ||
} | ||
|
||
destinationRuleConfig := DestinationRuleConfig{ | ||
Name: instance.Name, | ||
Namespace: instance.Namespace, | ||
DestinationRuleName: destinationRuleName, | ||
} | ||
|
||
var destinationRule *unstructured.Unstructured | ||
destinationRule, err = templateParser.ParseResource[unstructured.Unstructured](destinationRuleTemplatePath, destinationRuleConfig, reflect.TypeOf(&unstructured.Unstructured{})) | ||
if err != nil { | ||
log.FromContext(ctx).Error(err, "could not parse the DestinationRule template") | ||
return err | ||
} | ||
|
||
if err := ctrl.SetControllerReference(instance, destinationRule, r.Scheme); err != nil { | ||
return err | ||
} | ||
|
||
err = r.Create(ctx, destinationRule) | ||
if err != nil { | ||
return fmt.Errorf("failed to create DestinationRule: %v", err) | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.