[pr-review] Lighten docs & validate SQL dialect

Signed-off-by: Étienne Lafarge <etienne.lafarge@gmail.com>
pull/5371/head
Étienne Lafarge 7 years ago
parent a602d70842
commit 6c396880ad

@ -380,13 +380,13 @@ Using such a storage backend is particularly useful if your release information
weighs more than 1MB (in which case, it can't be stored in ConfigMaps/Secrets
because of internal limits in Kubernetes' underlying etcd key-value store).
To enable the SQL backend, you'll need to [deploy an SQL
database](./sql-storage.md) and init Tiller with the following options:
To enable the SQL backend, you'll need to deploy a SQL database and init Tiller
with the following options:
```shell
helm init \
--override \
'spec.template.spec.containers[0].args'='{--storage=sql,--sql-dialect=postgres,--sql-connection-string=postgresql://tiller-postgres:5432/helm?user=helm&password=changemeforgodssake&sslmode=disable}'
'spec.template.spec.containers[0].args'='{--storage=sql,--sql-dialect=postgres,--sql-connection-string=postgresql://tiller-postgres:5432/helm?user=helm&password=changeme}'
```
**PRODUCTION NOTES**: it's recommended to change the username and password of

@ -1,89 +0,0 @@
# Store release information in an SQL database
You may be willing to store release information in an SQL database - in
particular, if your releases weigh more than 1MB and therefore [can't be stored in ConfigMaps or Secrets](https://github.com/helm/helm/issues/1413).
We recommend using [PostgreSQL](https://www.postgresql.org/).
This document describes how to deploy `postgres` atop Kubernetes. This being
said, using an out-of-cluster (managed or not) PostreSQL instance is totally
possible as well.
Here's a Kubernetes manifest you can apply to get a minimal PostreSQL pod
running on your Kubernetes cluster. **Don't forget to change the credentials
and, optionally, enable TLS in production deployments**.
```yaml
apiVersion: v1
kind: Service
metadata:
name: tiller-postgres
namespace: kube-system
spec:
ports:
- port: 5432
selector:
app: helm
name: postgres
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: tiller-postgres
namespace: kube-system
spec:
serviceName: tiller-postgres
selector:
matchLabels:
app: helm
name: postgres
replicas: 1
template:
metadata:
labels:
app: helm
name: postgres
spec:
containers:
- name: postgres
image: postgres:11-alpine
imagePullPolicy: Always
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: helm
- name: POSTGRES_USER
value: helm
- name: POSTGRES_PASSWORD
value: changemeforgodssake
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
resources:
limits:
memory: 128Mi
requests:
cpu: 50m
memory: 128Mi
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: tiller-postgres-data
volumeClaimTemplates:
- metadata:
name: tiller-postgres-data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: default
resources:
requests:
storage: 5Gi
```
Once postgres is deployed, you'll need to install Tiller using `helm init`, with
a few custom CLI flags:
```shell
helm init \
--override \
'spec.template.spec.containers[0].args'='{--storage=sql,--sql-dialect=postgres,--sql-connection-string=postgresql://tiller-postgres:5432/helm?user=helm&password=changemeforgodssake&sslmode=disable}'
```

@ -43,6 +43,10 @@ var labelMap = map[string]string{
"NAME": "name",
}
var supportedSQLDialects = map[string]struct{}{
"postgres": struct{}{},
}
// SQLDriverName is the string name of this driver.
const SQLDriverName = "SQL"
@ -113,6 +117,10 @@ type Release struct {
// NewSQL initializes a new memory driver.
func NewSQL(dialect, connectionString string, logger func(string, ...interface{})) (*SQL, error) {
if _, ok := supportedSQLDialects[dialect]; !ok {
return nil, fmt.Errorf("%s dialect isn't supported, only \"postgres\" is available for now", dialect)
}
db, err := sqlx.Connect(dialect, connectionString)
if err != nil {
return nil, err

Loading…
Cancel
Save