Skip to content
Open
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
3 changes: 3 additions & 0 deletions mysql-helm3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
values.yaml
.helm
.charts
8 changes: 8 additions & 0 deletions mysql-helm3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# MySQL Hub component

PostgreSQL Hub Component, installs a [t3n-helm-charts/mysql](https://artifacthub.io/packages/helm/t3n/mysql) helm chart

## TODO

- [ ] Add GUI component
- [ ] Backup functionality
92 changes: 92 additions & 0 deletions mysql-helm3/hub-component.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
version: 1
kind: component
meta:
name: mysql
title: MySQL
brief: Relational Database
description: >
MySQL is a popular, well known open source relational database
category: Storage
version: '5.7.30'
maturity: alpha
license: GNU
source:
dir: ../../components/mysql

requires:
- kubernetes
- helm
# - tiller

provides:
- mysql
- database
- sql

parameters:
- name: hub.componentName
- name: dns.domain
env: DOMAIN_NAME
- name: component.mysql
empty: allow
parameters:
- name: name
value: mysql
env: COMPONENT_NAME
# - name: host
- name: namespace
value: mysql
env: NAMESPACE
- name: port
value: 3306
- name: user
env: DB_USER
- name: password
env: DB_PASSWORD
- name: database
env: DB_NAME
- name: rootPassword
env: ROOT_PASSWORD
- name: image.name
value: mysql
- name: image.tag
value: 5.7.30
- name: chart.version
value: 1.6.6
env: CHART_VERSION
- name: volumeSize
value: 8Gi
- name: storageClass
value: default
- name: helm
parameters:
- name: repo
value: https://storage.googleapis.com/t3n-helm-charts
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env: HELM_REPO
- name: chart
value: mysql
env: HELM_CHART
- name: version
value: 0.1.0
env: HELM_CHART_VERSION

outputs:
- name: component.mysql.host
value: ${component.mysql.name}.${component.mysql.namespace}.svc.cluster.local
- name: component.mysql.port
- name: component.mysql.database
- name: component.mysql.user
- name: component.mysql.password
kind: secret
- name: component.mysql.rootPassword
kind: secret

templates:
files:
- "*.template"

lifecycle:
verbs:
- deploy
- undeploy
1 change: 1 addition & 0 deletions mysql-helm3/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions mysql-helm3/pre-deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh -xe

HELM_OPTS=""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does HELM_OPTS used here?


if test -n "$DB_NAME"
then
HELM_OPTS="$HELM_OPTS --set mysqlDatabase=$DB_NAME"
fi

if test -n "$DB_USER"
then
HELM_OPTS="$HELM_OPTS --set mysqlUser=$DB_USER"
fi

if test -n "$DB_PASSWORD"
then
HELM_OPTS="$HELM_OPTS --set mysqlPassword=$DB_PASSWORD"
else
HELM_OPTS="$HELM_OPTS --set mysqlAllowEmptyPassword=true"
fi


if test -n "$ROOT_PASSWORD"
then
HELM_OPTS="$HELM_OPTS --set mysqlRootPassword=$ROOT_PASSWORD"
else
HELM_OPTS="$HELM_OPTS --set allowEmptyRootPassword=true"
fi

if $kubectl get pvc "$COMPONENT_NAME" >/dev/null 2>&1
then
HELM_OPTS="$HELM_OPTS --set persistence.existingClaim=$COMPONENT_NAME"
fi


if [ -n "$HELM_OPTS" ]
then
echo export HELM_OPTS=\"$HELM_OPTS\"
fi

# TODO: how should we quote values
# quoting helm flags as
# "$HELM_OPTS --set 'mysqlPassword=$DB_PASSWORD'"
# leads to escaped quotes in the result command e.g
#
# + helm --kube-context=busy-odilee-553.bubble.superhub.io --namespace=kubeflow-data upgrade mysql .charts/mysql --install --create-namespace --debug --wait --version 0.1.0 --values values.yaml \
# --set ''\''mysqlUser=mysql''\'' --set ''\''mysqlPassword=somepass'\''' --set ''\''mysqlRootPassword=somepass''\'' --set ''\''persistence.existingClaim=mysql''\''

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arkadijs Please do I follow the idea right on this change

And there's an issue I've faced with mentioned in TODO regarding quoting the values
What is the proper way for solving it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had an alternative way for exposing the exact values over HELM_OPTS just composing the extra --values set dynamically instead combined with hub templates interpolation.
I would be more safe but it seemed to be more messy same time regarding code structure.

11 changes: 11 additions & 0 deletions mysql-helm3/values.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
image: "${component.mysql.image.name}"
imageTag: "${component.mysql.image.tag}"

persistence:
enabled: true
size: ${component.mysql.volumeSize}
storageClass: "${component.mysql.storageClass}"

serviceAccount:
create: true
name: ${hub.componentName}
2 changes: 1 addition & 1 deletion mysql/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MySQL Hub component

PostgreSQL Hub Component, installs a [stable/mysqll](https://github.com/helm/charts/tree/master/stable/mysql) helm chart
PostgreSQL Hub Component, installs a [stable/mysql](https://github.com/helm/charts/tree/master/stable/mysql) helm chart

## TODO

Expand Down