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

enrich db - first pass #102

Merged
merged 1 commit into from
Jan 11, 2024
Merged
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
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.

Loading