Skip to content
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

Fixes #300

Merged
merged 4 commits into from
Nov 15, 2024
Merged

Fixes #300

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added ansible/files/model.joblib
Binary file not shown.
44 changes: 44 additions & 0 deletions ansible/playbooks/copy_initial_model_to_incluster_s3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
- name: Load the initial model to in cluster s3
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Fail if any needed parameter is undefined
ansible.builtin.assert:
that:
- bucket_name is defined
- src_file is defined

- name: Find s3 endpoint
ansible.builtin.shell: |
oc extract -n ml-development secret/aws-connection-{{ bucket_name }} --to=- --keys=AWS_S3_ENDPOINT 2>/dev/null
register: s3_endpoint_raw

- name: Find access key
ansible.builtin.shell: |
oc extract -n ml-development secret/aws-connection-{{ bucket_name }} --to=- --keys=AWS_ACCESS_KEY_ID 2>/dev/null
register: s3_access_key_raw

- name: Find aws secret key
ansible.builtin.shell: |
oc extract -n ml-development secret/aws-connection-{{ bucket_name }} --to=- --keys=AWS_SECRET_ACCESS_KEY 2>/dev/null
register: s3_secret_key_raw

- name: Set s3 facts
ansible.builtin.set_fact:
endpoint_url: "{{ s3_endpoint_raw.stdout }}"
aws_access_key: "{{ s3_access_key_raw.stdout }}"
aws_secret_key: "{{ s3_secret_key_raw.stdout }}"
src_file_path: "/git/repo/{{ src_file }}"

- name: Basic individual file upload
amazon.aws.s3_object:
bucket: "{{ bucket_name }}"
object: initial_model.joblib
mode: put
content_base64: "{{ lookup('ansible.builtin.file', src_file_path) | b64encode }}"
endpoint_url: "{{ endpoint_url }}"
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
validate_certs: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
annotations:
serving.kserve.io/deploymentMode: ModelMesh
labels:
opendatahub.io/dashboard: "true"
name: inference-service
spec:
predictor:
model:
modelFormat:
name: sklearn
version: "0"
runtime: anomaly-detection-model-server
storage:
key: aws-connection-user-bucket
path: initial_model.joblib
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
annotations:
serving.kserve.io/deploymentMode: ModelMesh
labels:
opendatahub.io/dashboard: "true"
name: inference-service
spec:
predictor:
model:
modelFormat:
name: sklearn
version: "0"
runtime: anomaly-detection-model-server
storage:
key: aws-connection-user-bucket
path: initial_model.joblib
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ data:
TOPIC_TEMPERATURE: "iot-sensor/sw/temperature"
TOPIC_VIBRATION: "iot-sensor/sw/vibration"
TOPIC_LIGHT: "iot-sensor/sw/light"
ANOMALY_DETECTION_URL: "http://anomaly-detection-predictor:8000"
ANOMALY_DETECTION_URL: "http://modelmesh-serving.manuela-tst-all:8008"
ANOMALY_DETECTION_URL_PATH: "/v2/models/inference-service/infer"
7 changes: 7 additions & 0 deletions values-datacenter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ clusterGroup:
- "repo_name=manuela-dev"
- "upstream_repo_url=https://github.com/validatedpatterns-demos/manuela-dev"
timeout: 180
- name: copy-initial-model-to-incluster-s3
image: quay.io/hybridcloudpatterns/utility-container:latest
playbook: ./ansible/playbooks/copy_initial_model_to_incluster_s3.yml
extravars:
- "bucket_name=user-bucket"
- "src_file=ansible/files/model.joblib"
timeout: 180

managedClusterGroups:
factory:
Expand Down
9 changes: 8 additions & 1 deletion values-global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ main:
git:
repoUpstreamURL: https://github.com/validatedpatterns/industrial-edge

# FIXME: when switching this branch to main, we need to rebuild all bootstrap containers,
# check their version and make sure we reference those in the main branch
# This container has the new API endpoint of the inference service
iot_consumer:
bootstrap_image: quay.io/aeros/iot-consumer:0.3.2-40

global:
pattern: industrial-edge

Expand All @@ -23,7 +29,8 @@ global:
account: gitea_admin
#username: PLAINTEXT
email: [email protected]
dev_revision: main
# Branch used for the manuela-dev repository
dev_revision: integrate_rhoai

s3:
bucket:
Expand Down