Skip to content

Commit

Permalink
feat: GCP marketplace - preserve install config in configmap and secr…
Browse files Browse the repository at this point in the history
…et (#4471)

* tools for comparing gcp marketplace manifests

* commit snapshots

* feat: GCP marketplace - preserve install config snapshot in a configmap and secret

* commit updated snapshots

* update syntax
  • Loading branch information
Bobgy committed Sep 10, 2020
1 parent e275548 commit d447355
Show file tree
Hide file tree
Showing 12 changed files with 5,642 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,10 @@ metadata:
labels:
component: cache-server
data:
{{ if .Values.managedstorage.databaseNamePrefix }}
mysql_database: '{{ .Values.managedstorage.databaseNamePrefix }}_cachedb'
{{ else }}
mysql_database: '{{ .Release.Name | replace "-" "_" | replace "." "_"}}_cachedb'
{{ end }}
mysql_database: '{{ tpl .Values.managedstorage.databaseNamePrefix . }}_cachedb'
mysql_driver: "mysql"
mysql_host: "mysql"
mysql_port: "3306"
mysql_port: "3306"
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -283,7 +279,7 @@ apiVersion: v1
kind: Service
metadata:
name: cache-server
labels:
labels:
app: cache-server
app.kubernetes.io/name: {{ .Release.Name }}
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: ml-pipeline-install-config-snapshot
labels:
app.kubernetes.io/name: '{{ .Release.Name }}'
annotations:
pipelines.kubeflow.org/comment: |-
This is a snapshot of install parameters. There's no effect modifying this.
data:
appName: '{{ .Release.Name }}'
namespace: '{{ .Release.Namespace }}'
managedStorageEnabled: '{{ .Values.managedstorage.enabled }}'
#{{ if .Values.managedstorage.enabled }}
managedStorageCloudSqlInstanceConnectionName: '{{ .Values.managedstorage.cloudsqlInstanceConnectionName }}'
managedStorageGcsBucketName: '{{ .Values.managedstorage.gcsBucketName }}'
managedStorageDatabasePrefix: '{{ tpl .Values.managedstorage.databaseNamePrefix . }}'
managedstorageDbUserName: '{{ .Values.managedstorage.dbUsername }}'
#{{ end }}
---
apiVersion: v1
kind: Secret
metadata:
name: ml-pipeline-install-secret-snapshot
labels:
app.kubernetes.io/name: '{{ .Release.Name }}'
annotations:
pipelines.kubeflow.org/comment: |-
This is a snapshot of install secrets. There's no effect modifying this.
type: Opaque
#{{ if .Values.managedstorage.enabled }}
data:
managedStorageDbPassword: '{{ .Values.managedstorage.dbPassword | b64enc }}'
#{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,7 @@ metadata:
labels:
component: metadata-server
data:
{{ if .Values.managedstorage.databaseNamePrefix }}
MYSQL_DATABASE: '{{ .Values.managedstorage.databaseNamePrefix }}_metadata'
{{ else }}
MYSQL_DATABASE: '{{ .Release.Name | replace "-" "_" | replace "." "_"}}_metadata'
{{ end }}
MYSQL_DATABASE: '{{ tpl .Values.managedstorage.databaseNamePrefix . }}_metadata'
MYSQL_HOST: "mysql"
MYSQL_PORT: "3306"
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,7 @@ spec:
- name: OBJECTSTORECONFIG_BUCKETNAME
value: "{{ .Values.managedstorage.gcsBucketName }}"
- name: DBCONFIG_DBNAME
{{ if .Values.managedstorage.databaseNamePrefix }}
value: '{{ .Values.managedstorage.databaseNamePrefix }}_pipeline'
{{ else }}
value: '{{ .Release.Name | replace "-" "_" | replace "." "_" }}_pipeline'
{{ end }}
value: '{{ tpl .Values.managedstorage.databaseNamePrefix . }}_pipeline'
- name: DBCONFIG_USER
valueFrom:
secretKeyRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ managedstorage:
enabled: false
cloudsqlInstanceConnectionName: null
gcsBucketName: null
databaseNamePrefix: null
databaseNamePrefix: '{{ .Release.Name | replace "-" "_" | replace "." "_" }}'
dbUsername: 'root'
dbPassword: ''
gcsProjectId: ''
31 changes: 31 additions & 0 deletions manifests/gcp_marketplace/hack/snapshots.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

CASES=(
"base"
"managed-storage"
"managed-storage-with-db-prefix"
)

for case in "${CASES[@]}"
do
echo "Generating helm template for ./test/values-$case.yaml"
helm template chart/kubeflow-pipelines \
--name "my-release" \
--namespace "kubeflow" \
--values "./test/values-$case.yaml" \
> "./test/snapshot-$case.yaml"
done
Loading

0 comments on commit d447355

Please sign in to comment.