Skip to content

Commit

Permalink
Added TrustyAI service to Manifests, with integration into ModelMesh …
Browse files Browse the repository at this point in the history
…and ODH-Monitoring
  • Loading branch information
RobGeada committed Mar 10, 2023
1 parent a0b4ae2 commit 966008c
Show file tree
Hide file tree
Showing 9 changed files with 279 additions and 0 deletions.
1 change: 1 addition & 0 deletions model-mesh/default/config-defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
# These are the system defaults which users can override with a user config
podsPerRuntime: 2
payloadProcessors: ""
headlessService: true
modelMeshImage:
name: $(odh-modelmesh)
Expand Down
3 changes: 3 additions & 0 deletions model-mesh/internal/base/deployment.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ spec:
- name: MM_SERVICE_NAME
value: {{.ServiceName}}
# External gRPC port of the service, should match ports.containerPort
- name: MM_PAYLOAD_PROCESSORS
value: {{.PayloadProcessors}}
# External endpoint for a payload processing service
- name: MM_SVC_GRPC_PORT
value: "{{.Port}}"
- name: WKUBE_POD_NAME
Expand Down
32 changes: 32 additions & 0 deletions trustyai-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# TrustyAI Service

TrustyAI is a service to provide fairness metrics to ModelMesh served models.


### Installation process

Following are the steps to install Model Mesh as a part of OpenDataHub install:

1. Install the OpenDataHub operator
2. Create a KfDef that includes the model-mesh component with the odh-model-controller overlay.
3. Set the `payloadProcessor` value within `model-serving-config-defaults` ConfigMap
to `http://trustyai-service/consumer/kserve/v2`
4. Create a TrustyAI KfDef:
```
apiVersion: kfdef.apps.kubeflow.org/v1
kind: KfDef
metadata:
name: trustyai
spec:
applications:
- kustomizeConfig:
repoRef:
name: manifests
path: trustyai-service
name: trustyai
repos:
- name: manifests
uri: https://github.com/red-hat-data-services/odh-manifests/tarball/master
version: master
```

9 changes: 9 additions & 0 deletions trustyai-service/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
app: trustyai
app.kubernetes.io/part-of: trustyai
resources:
- ../default
- ../servicemonitors
- trustyai-configmap.yaml
11 changes: 11 additions & 0 deletions trustyai-service/base/trustyai-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: trustyai-config
data:
service_storage_format: "PVC"
service_data_format: "CSV"
service_metrics_schedule: "5s"
service_batch_size: "5000"
storage_data_filename: "data.csv"
storage_data_folder: "/inputs"
4 changes: 4 additions & 0 deletions trustyai-service/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- trustyai-deployment.yaml
190 changes: 190 additions & 0 deletions trustyai-service/default/trustyai-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
---
apiVersion: v1
kind: Service
metadata:
annotations:
app.openshift.io/vcs-url: <<unknown>>
app.quarkus.io/commit-id: 0acbb40970b5c0dd7e5a50966d6b3d68e137be10
app.quarkus.io/build-timestamp: 2023-02-24 - 13:56:14 +0000
prometheus.io/scrape: "true"
prometheus.io/path: /q/metrics
prometheus.io/port: "8080"
prometheus.io/scheme: http
labels:
app.kubernetes.io/name: trustyai-service
app.kubernetes.io/version: 0.1.0
app.openshift.io/runtime: quarkus
name: trustyai-service
spec:
ports:
- name: http
port: 80
targetPort: 8080
selector:
app.kubernetes.io/name: trustyai-service
app.kubernetes.io/version: 0.1.0
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
app.openshift.io/vcs-url: <<unknown>>
app.quarkus.io/commit-id: ea73183a2c1b81bd9afe31005644d374b5bdeb34
app.quarkus.io/build-timestamp: 2023-02-15 - 15:41:47 +0000
prometheus.io/scrape: "true"
prometheus.io/path: /q/metrics
prometheus.io/port: "8080"
prometheus.io/scheme: http
labels:
app.openshift.io/runtime: quarkus
app.kubernetes.io/version: 0.1.0
app.kubernetes.io/name: trustyai-service
app.kubernetes.io/version: 0.1.0
app.openshift.io/runtime: quarkus
name: trustyai-service
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/version: 0.1.0
app.kubernetes.io/name: trustyai-service
template:
metadata:
annotations:
app.openshift.io/vcs-url: <<unknown>>
app.quarkus.io/commit-id: ea73183a2c1b81bd9afe31005644d374b5bdeb34
app.quarkus.io/build-timestamp: 2023-02-15 - 15:41:47 +0000
prometheus.io/scrape: "true"
prometheus.io/path: /q/metrics
prometheus.io/port: "8080"
prometheus.io/scheme: http
labels:
app.openshift.io/runtime: quarkus
app.kubernetes.io/version: 0.1.0
app.kubernetes.io/name: trustyai-service
spec:
initContainers:
- name: config-map-overrider
image: registry.redhat.io/openshift4/ose-cli@sha256:25fef269ac6e7491cb8340119a9b473acbeb53bc6970ad029fdaae59c3d0ca61
command: [ "/bin/bash", "-c", "--" ]
args:
- |
# ugly hack: write a configmap that knows its own namespace
echo "apiVersion: v1" > /tmp/model-serving-config.yaml
echo "kind: ConfigMap" >> /tmp/model-serving-config.yaml
echo "metadata:" >> /tmp/model-serving-config.yaml
echo " name: model-serving-config" >> /tmp/model-serving-config.yaml
echo "data:" >> /tmp/model-serving-config.yaml
echo " config.yaml: |" >> /tmp/model-serving-config.yaml
current_namespace=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
echo " payloadProcessors: "http://trustyai-service.$current_namespace/consumer/kserve/v2"" >> /tmp/model-serving-config.yaml
cat /tmp/model-serving-config.yaml
oc apply -f /tmp/model-serving-config.yaml
exit 0
containers:
- env:
- name: STORAGE_DATA_FILENAME
valueFrom:
configMapKeyRef:
key: storage_data_filename
name: trustyai-config
- name: SERVICE_STORAGE_FORMAT
valueFrom:
configMapKeyRef:
key: service_storage_format
name: trustyai-config
- name: STORAGE_DATA_FOLDER
valueFrom:
configMapKeyRef:
key: storage_data_folder
name: trustyai-config
- name: SERVICE_BATCH_SIZE
valueFrom:
configMapKeyRef:
key: service_batch_size
name: trustyai-config
- name: SERVICE_DATA_FORMAT
valueFrom:
configMapKeyRef:
key: service_data_format
name: trustyai-config
- name: SERVICE_METRICS_SCHEDULE
valueFrom:
configMapKeyRef:
key: service_metrics_schedule
name: trustyai-config
image: quay.io/trustyai/trustyai-service:0.1.0
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
httpGet:
path: /q/health/live
port: 8080
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 10
name: trustyai-service
ports:
- containerPort: 8080
name: http
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /q/health/ready
port: 8080
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 10
volumeMounts:
- mountPath: /inputs
name: volume
readOnly: false
serviceAccountName: trustyai-serviceaccount
volumes:
- name: volume
persistentVolumeClaim:
claimName: trustyai-service-pvc
readOnly: false
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: trustyai-serviceaccount
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: trustyai-role
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: trustyai-clusterrolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: trustyai-role
subjects:
- kind: ServiceAccount
name: trustyai-serviceaccount
4 changes: 4 additions & 0 deletions trustyai-service/servicemonitors/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- trustyai-metrics.yaml
25 changes: 25 additions & 0 deletions trustyai-service/servicemonitors/trustyai-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: trustyai-metrics
labels:
modelmesh-service: modelmesh-serving
spec:
endpoints:
- interval: 30s
path: /q/metrics
honorLabels: true
honorTimestamps: true
scrapeTimeout: 10s
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
bearerTokenSecret:
key: ""
targetPort: 8080
scheme: http
params:
'match[]':
- '{__name__= "trusty_spd"}'
- '{__name__= "trusty_dir"}'
selector:
matchLabels:
app.kubernetes.io/name: trustyai-service

0 comments on commit 966008c

Please sign in to comment.