Skip to content

Commit 847b570

Browse files
authored
Merge pull request opendatahub-io#47 from gmfrasca/remove-dbs3-creds
chore(manifests): Remove configuration objects from manifests
2 parents 06b4f35 + dc82a8d commit 847b570

File tree

14 files changed

+131
-23
lines changed

14 files changed

+131
-23
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 -
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apiVersion: rbac.authorization.k8s.io/v1
2-
kind: RoleBinding
2+
kind: ClusterRoleBinding
33
metadata:
44
labels:
55
application-crd-id: data-science-pipelines
6-
name: ds-pipeline-persistenceagent-binding
6+
name: ds-pipeline-persistenceagent-clusterrolebinding
77
roleRef:
88
apiGroup: rbac.authorization.k8s.io
9-
kind: Role
10-
name: ds-pipeline-persistenceagent-role
9+
kind: ClusterRole
10+
name: ds-pipeline-persistenceagent-clusterrole
1111
subjects:
1212
- kind: ServiceAccount
1313
name: ds-pipeline-persistenceagent

manifests/opendatahub/base/roles/ds-pipeline-persistenceagent-role.yaml renamed to manifests/opendatahub/base/clusterroles/ds-pipeline-persistenceagent-clusterrole.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
apiVersion: rbac.authorization.k8s.io/v1
2-
kind: Role
2+
kind: ClusterRole
33
metadata:
44
labels:
55
application-crd-id: data-science-pipelines
6-
name: ds-pipeline-persistenceagent-role
6+
name: ds-pipeline-persistenceagent-clusterrole
77
rules:
88
- apiGroups:
99
- argoproj.io

manifests/opendatahub/base/deployments/ds-pipeline-persistenceagent.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ spec:
3030
command:
3131
- persistence_agent
3232
- "--logtostderr=true"
33-
- "--namespace=$(namespace)"
3433
- "--ttlSecondsAfterWorkflowFinish=86400"
3534
- "--numWorker=2"
3635
- "--mlPipelineAPIServerName=ds-pipeline"

manifests/opendatahub/base/kustomization.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
44

55
resources:
6-
# Configmaps
7-
- ./configmaps/ds-pipeline-config.yaml
8-
- ./configmaps/pipeline-install-config.yaml
9-
106
# CustomResourceDefinitions
117
- ./customresourcedefinitions/viewers.yaml
128
- ./customresourcedefinitions/scheduledworkflows.yaml
@@ -19,19 +15,23 @@ resources:
1915
- ./deployments/ds-pipeline.yaml
2016

2117
# Rolebindings
22-
- ./rolebindings/ds-pipeline-persistenceagent-binding.yaml
2318
- ./rolebindings/ds-pipeline-scheduledworkflow-binding.yaml
2419
- ./rolebindings/ds-pipeline-viewer-crd-binding.yaml
2520
- ./rolebindings/ds-pipeline.yaml
2621
- ./rolebindings/pipeline-runner-binding.yaml
2722

2823
# Roles
29-
- ./roles/ds-pipeline-persistenceagent-role.yaml
3024
- ./roles/ds-pipeline-scheduledworkflow-role.yaml
3125
- ./roles/ds-pipeline-viewer-controller-role.yaml
3226
- ./roles/ds-pipeline.yaml
3327
- ./roles/pipeline-runner.yaml
3428

29+
# ClusterRoleBindings
30+
- ./clusterrolebindings/ds-pipeline-persistenceagent-clusterrolebinding.yaml
31+
32+
# ClusterRoles
33+
- ./clusterroles/ds-pipeline-persistenceagent-clusterrole.yaml
34+
3535
# ServiceAccounts
3636
- ./serviceaccounts/ds-pipeline-container-builder.yaml
3737
- ./serviceaccounts/ds-pipeline-persistenceagent.yaml
@@ -92,6 +92,7 @@ vars:
9292
apiVersion: v1
9393
fieldref:
9494
fieldpath: data.ds_pipelines_ui_configuration
95+
9596
configurations:
9697
- params.yaml
9798

0 commit comments

Comments
 (0)