Skip to content

Commit

Permalink
Merge pull request rh-aiservices-bu#102 from rh-aiservices-bu/feature…
Browse files Browse the repository at this point in the history
…/enrich-database

enrich db - first pass
  • Loading branch information
guimou authored Jan 11, 2024
2 parents 765b594 + c9529b7 commit d32b1d7
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 125 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions bootstrap/ic-shared-database/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ resources:
# wave 1
- pvc.yaml
- secret.yaml
- secret-minio.yaml
- deployment.yaml
- service.yaml
- sql-script-configmap.yaml
# wave 2
- db-init-job.yaml
- populate-images.yaml
55 changes: 55 additions & 0 deletions bootstrap/ic-shared-database/populate-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: populate-images
annotations:
argocd.argoproj.io/sync-wave: "2"
spec:
backoffLimit: 4
template:
spec:
initContainers:
- name: wait-for-minio
image: busybox:1.28
command: ['sh', '-c', 'until nc -z -v -w30 $MINIO_ENDPOINT 9000; do echo "Waiting for Minio connection..."; sleep 2; done;']
env:
- name: MINIO_ENDPOINT
value: minio.ic-shared-minio.svc.cluster.local
containers:
- name: add-images-to-bucket
image: image-registry.openshift-image-registry.svc:5000/redhat-ods-applications/s2i-generic-data-science-notebook:1.2
imagePullPolicy: IfNotPresent
command: ["/bin/bash"]
args:
- -ec
- |-
git clone https://github.com/rh-aiservices-bu/insurance-claim-processing.git
cat << 'EOF' | python3
import boto3, os
s3 = boto3.client("s3",
endpoint_url=os.getenv("AWS_S3_ENDPOINT"),
aws_access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
aws_secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"))
# Create image bucket
bucket_name = "claim-images"
s3.create_bucket(Bucket=bucket_name)
# Upload original images to minio
for filename in os.listdir("insurance-claim-processing/bootstrap/ic-shared-database/images/original_images"):
with open(f"insurance-claim-processing/bootstrap/ic-shared-database/images/original_images/{filename}", "rb") as f:
s3.upload_fileobj(f, bucket_name, f"original_images/{filename}")
# Upload processed images to minio
for filename in os.listdir("insurance-claim-processing/bootstrap/ic-shared-database/images/processed_images"):
with open(f"insurance-claim-processing/bootstrap/ic-shared-database/images/processed_images/{filename}", "rb") as f:
s3.upload_fileobj(f, bucket_name, f"processed_images/{filename}")
EOF
envFrom:
- secretRef:
name: secret-minio
restartPolicy: Never
14 changes: 14 additions & 0 deletions bootstrap/ic-shared-database/secret-minio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
kind: Secret
apiVersion: v1
metadata:
name: secret-minio
namespace: ic-shared-db
labels:
app: ic-shared-db
annotations:
argocd.argoproj.io/sync-wave: "1"
stringData:
AWS_S3_ENDPOINT: http://minio.ic-shared-minio.svc.cluster.local:9000
AWS_ACCESS_KEY_ID: minio
AWS_SECRET_ACCESS_KEY: minio123
type: Opaque
237 changes: 112 additions & 125 deletions bootstrap/ic-shared-database/sql-script-configmap.yaml

Large diffs are not rendered by default.

0 comments on commit d32b1d7

Please sign in to comment.