Skip to content

Commit 3b2284b

Browse files
committed
Add Config init script and templates for easy dev setup
1 parent 4a09511 commit 3b2284b

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
apiVersion: template.openshift.io/v1
2+
kind: Template
3+
metadata:
4+
name: ds-pipelines-db-template
5+
objects:
6+
- apiVersion: v1
7+
data:
8+
apply_tekton_custom_resource: "true"
9+
archive_logs: "false"
10+
artifact_bucket: ${S3_BUCKET}
11+
artifact_endpoint: ${S3_ENDPOINT}
12+
artifact_endpoint_scheme: http://
13+
artifact_image: quay.io/opendatahub/ml-pipelines-artifact-manager:latest
14+
artifact_script: |-
15+
#!/usr/bin/env sh
16+
push_artifact() {
17+
if [ -f "$2" ]; then
18+
tar -cvzf $1.tgz $2
19+
aws s3 --endpoint ${ARTIFACT_ENDPOINT_SCHEME}${ARTIFACT_ENDPOINT} cp $1.tgz s3://$ARTIFACT_BUCKET/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
20+
else
21+
echo "$2 file does not exist. Skip artifact tracking for $1"
22+
fi
23+
}
24+
push_log() {
25+
cat /var/log/containers/$PODNAME*$NAMESPACE*step-main*.log > step-main.log
26+
push_artifact main-log step-main.log
27+
}
28+
strip_eof() {
29+
if [ -f "$2" ]; then
30+
awk 'NF' $2 | head -c -1 > $1_temp_save && cp $1_temp_save $2
31+
fi
32+
}
33+
inject_default_script: "true"
34+
strip_eof: "true"
35+
terminate_status: Cancelled
36+
track_artifacts: "true"
37+
kind: ConfigMap
38+
metadata:
39+
labels:
40+
application-crd-id: data-science-pipelines
41+
name: ds-pipeline-config
42+
- apiVersion: v1
43+
data:
44+
ConMaxLifeTimeSec: "120"
45+
appName: pipeline
46+
appVersion: 1.7.0
47+
autoUpdatePipelineDefaultVersion: "true"
48+
bucketName: ${S3_BUCKET}
49+
cacheDb: ${DB_DATABASE}
50+
cacheImage: registry.access.redhat.com/ubi8/ubi-minimal
51+
cacheNodeRestrictions: "false"
52+
cronScheduleTimezone: UTC
53+
dbHost: ${DB_HOST}
54+
dbPort: "${DB_PORT}"
55+
defaultPipelineRoot: ""
56+
mlmdDb: ${DB_DATABASE}
57+
pipelineDb: ${DB_DATABASE}
58+
warning: |
59+
1. Do not use kubectl to edit this configmap, because some values are used
60+
during kustomize build. Instead, change the configmap and apply the entire
61+
kustomize manifests again.
62+
2. After updating the configmap, some deployments may need to be restarted
63+
until the changes take effect. A quick way to restart all deployments in a
64+
namespace: `kubectl rollout restart deployment -n <your-namespace>`.
65+
kind: ConfigMap
66+
metadata:
67+
labels:
68+
application-crd-id: data-science-pipelines
69+
name: pipeline-install-config
70+
- apiVersion: v1
71+
kind: Secret
72+
metadata:
73+
name: mysql-secret
74+
stringData:
75+
username: ${DB_USERNAME}
76+
password: ${DB_PASSWORD}
77+
- apiVersion: v1
78+
kind: Secret
79+
metadata:
80+
name: mlpipeline-minio-artifact
81+
labels:
82+
application-crd-id: data-science-pipelines
83+
stringData:
84+
accesskey: ${S3_ACCESS_KEY}
85+
secretkey: ${S3_SECRET_KEY}
86+
parameters:
87+
- name: S3_ENDPOINT
88+
value: "minio-service:9000"
89+
- name: S3_ACCESS_KEY
90+
value: minio
91+
- name: S3_SECRET_KEY
92+
value: minio123
93+
- name: S3_BUCKET
94+
value: mlpipeline
95+
- name: DB_HOST
96+
value: mysql
97+
- name: DB_PORT
98+
value: "3306"
99+
- name: DB_USERNAME
100+
value: mlpipeline
101+
- name: DB_PASSWORD
102+
value: mlpipeline
103+
- name: DB_DATABASE
104+
value: mlpipeline

init/setup-ds-pipeline-configs.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
app_namespace=${1:-odh-applications}
2+
3+
config_params=""
4+
# Check defaultable envvars to print info message
5+
defaultable_envvars="S3_ENDPOINT S3_ACCESS_KEY S3_SECRET_KEY DB_HOST DB_PORT DB_USERNAME DB_PASSWORD DB_DATABASE S3_BUCKET"
6+
for envvar in $defaultable_envvars; do
7+
if [[ -z "${!envvar}" ]]; then
8+
echo "Environment Variable '${envvar}' not set, using default value."
9+
else
10+
config_params="${config_params} -p ${envvar}=${!envvar}"
11+
fi
12+
done
13+
14+
oc process -f ../manifests/ds-pipelines-config-templates.yaml ${config_params} | oc apply -n ${app_namespace} -f -

0 commit comments

Comments
 (0)