Skip to content

Commit

Permalink
Merge pull request #38 from tonyxrmdavidson/removeGitClone
Browse files Browse the repository at this point in the history
Remove git clone
  • Loading branch information
tonyxrmdavidson committed Mar 29, 2024
2 parents c0d2ee0 + 665903d commit 7d467e3
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: modelregistry.opendatahub.io/v1alpha1
kind: ModelRegistry
metadata:
labels:
app.kubernetes.io/name: modelregistry
app.kubernetes.io/instance: modelregistry-sample
app.kubernetes.io/part-of: model-registry-operator
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: model-registry-operator
name: modelregistry-sample
spec:
# TODO(user): Add fields here
grpc:
port: 9090
rest:
port: 8080
serviceRoute: enabled
mysql:
host: model-registry-db
database: model_registry
username: mlmduser
passwordSecret:
name: model-registry-db
key: database-password
126 changes: 126 additions & 0 deletions openshift-ci/resources/model-registry-operator/mysql-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
annotations:
template.openshift.io/expose-uri: mysql://{.spec.clusterIP}:{.spec.ports[?(.name==\mysql\)].port}
name: model-registry-db
spec:
ports:
- name: mysql
nodePort: 0
port: 3306
protocol: TCP
targetPort: 3306
selector:
name: model-registry-db
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: model-registry-db
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
template.alpha.openshift.io/wait-for-ready: "true"
name: model-registry-db
spec:
replicas: 1
revisionHistoryLimit: 0
selector:
matchLabels:
name: model-registry-db
strategy:
type: Recreate
template:
metadata:
annotations:
sidecar.istio.io/inject: "false"
labels:
name: model-registry-db
spec:
containers:
- env:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
key: database-user
name: model-registry-db
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: model-registry-db
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: model-registry-db
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
key: database-name
name: model-registry-db
args:
- --datadir
- /var/lib/mysql/datadir
- --default-authentication-plugin=mysql_native_password
image: mysql:8.3.0
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- /bin/bash
- -c
- mysqladmin -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} ping
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
name: mysql
ports:
- containerPort: 3306
protocol: TCP
readinessProbe:
exec:
command:
- /bin/bash
- -c
- mysql -D ${MYSQL_DATABASE} -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} -e 'SELECT 1'
initialDelaySeconds: 10
timeoutSeconds: 5
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /var/lib/mysql
name: model-registry-db-data
dnsPolicy: ClusterFirst
restartPolicy: Always
volumes:
- name: model-registry-db-data
persistentVolumeClaim:
claimName: model-registry-db
- apiVersion: v1
kind: Secret
metadata:
annotations:
template.openshift.io/expose-database_name: '{.data[''database-name'']}'
template.openshift.io/expose-password: '{.data[''database-password'']}'
template.openshift.io/expose-username: '{.data[''database-user'']}'
name: model-registry-db
stringData:
database-name: "model_registry"
database-password: "TheBlurstOfTimes"
database-user: "mlmduser"
kind: List
metadata: {}
32 changes: 0 additions & 32 deletions openshift-ci/scripts/install_yq.sh

This file was deleted.

28 changes: 5 additions & 23 deletions openshift-ci/scripts/oci-model-registry-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
OPENDATAHUB_SUBSCRIPTION="openshift-ci/resources/opendatahub-subscription.yaml"
DSC_INITIALIZATION_MANIFEST="openshift-ci/resources/model-registry-DSCInitialization.yaml"
DATA_SCIENCE_CLUSTER_MANIFEST="openshift-ci/resources/opendatahub-data-science-cluster.yaml"
MODEL_REGISTRY_OPERATOR_GIT_URL="https://github.com/opendatahub-io/model-registry-operator.git"
MODEL_REGISTRY_DB_MANIFEST="openshift-ci/resources/model-registry-operator/mysql-db.yaml"
MODEL_REGISTRY_SAMPLE_MANIFEST="openshift-ci/resources/model-registry-operator/modelregistry_v1alpha1_modelregistry.yaml"
source "openshift-ci/scripts/colour_text_variables.sh"
source "openshift-ci/scripts/install_yq.sh"


# Function to deploy and wait for deployment
deploy_and_wait() {
Expand All @@ -23,26 +24,6 @@ deploy_and_wait() {
fi
}

# Function to clone a Git repository and deploy the appropriate
clone_deploy_model_registry_operator_crd_files() {
local url="temp_repo/config/samples/mysql/"
local files=("mysql-db.yaml" "modelregistry_v1alpha1_modelregistry.yaml")
# Clone the Git repository
git clone "$MODEL_REGISTRY_OPERATOR_GIT_URL" temp_repo

#Change the deployment serviceRoute to enabled
yq eval '.spec.rest.serviceRoute = "enabled"' -i "$url${files[1]}"

# Deploy the model-registry crd files
for file in "${files[@]}"; do
local path_and_file="$url$file"
oc apply -f "$path_and_file" --wait=true --timeout=300s >/tmp/oc_output 2>&1 && rm /tmp/oc_output
done

# Remove temp_repo
rm -rf temp_repo
}

check_deployment_availability() {
local namespace="$1"
local deployment="$2"
Expand Down Expand Up @@ -162,7 +143,8 @@ main() {
deploy_and_wait $DSC_INITIALIZATION_MANIFEST
check_pod_status "opendatahub" "-l component.opendatahub.io/name=model-registry-operator" 2
deploy_and_wait $DATA_SCIENCE_CLUSTER_MANIFEST
clone_deploy_model_registry_operator_crd_files
deploy_and_wait $MODEL_REGISTRY_DB_MANIFEST
deploy_and_wait $MODEL_REGISTRY_SAMPLE_MANIFEST
run_deployment_tests
}

Expand Down

0 comments on commit 7d467e3

Please sign in to comment.