Skip to content

Commit 7d64fd6

Browse files
author
Jeff McCormick
committed
Merge branch 'master' of github.com:CrunchyData/postgres-operator
2 parents 01fda15 + 5efad10 commit 7d64fd6

20 files changed

+758
-6
lines changed

Godeps/Godeps.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

chart/postgres-operator/Chart.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
description: CrunchyData Postgres Operator Helm chart
3+
name: postgres-operator
4+
version: 0.1.3
5+
appVersion: 2.1.0
6+
keywords:
7+
- postgres
8+
- database
9+
- sql
10+
- experimental
11+
home: https://www.crunchydata.com/
12+
icon: http://trusted-charts-logos.stackpoint.io/crunchy_logo.png
13+
sources:
14+
- https://github.com/CrunchyData/postgres-operator
15+
- https://github.com/CrunchyData/crunchy-containers
16+
maintainers:
17+
- name: rimusz
18+

chart/postgres-operator/README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
Crunchy Data PostgreSQL Operator
2+
=======
3+
4+
[PostgreSQL](https://postgresql.org) is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness.
5+
6+
7+
TL;DR;
8+
------
9+
10+
```console
11+
$ helm install --name postgres-operator --namespace=postgres-operator postgres-operator
12+
```
13+
14+
Introduction
15+
------------
16+
17+
This chart bootstraps a PostgreSQL Operator.
18+
19+
The PostgreSQL Operator provides a Kubernetes operator capability for managing PostgreSQL Clusters deployed within a Kubernetes.
20+
The PostgreSQL Operator leverages Kubernetes Third Party Resources to define custom resource types such as:
21+
22+
* *pgcluster*
23+
* *pgbackups*
24+
* *pgupgrades*
25+
* *pgclones*
26+
* *pgpolicies*
27+
* *pgpolicylogs*
28+
29+
30+
Once those custom objects are defined, Kubernetes provides the ability to create and manage those objects similar to any other native Kubernetes object.
31+
32+
The PostgreSQL Operator runs within Kubernetes detecting these new custom object types being created, updated, or removed.
33+
34+
Once the objects are detected, the PostgreSQL Operator enables users to perform operations across the Kubernetes environment, including:
35+
36+
* Create a PostgreSQL Cluster
37+
* Destroy a PostgreSQL Cluster
38+
* Backup a PostgreSQL Cluster
39+
* Scale a a PostgreSQL Cluster
40+
* Restore a PostgreSQL Cluster
41+
* Upgrade a PostgreSQL Cluster
42+
* View PVC
43+
* Test Connections to a PostgreSQL Cluster
44+
* Clone a PostgreSQL Cluster
45+
* Create a SQL-based Policy
46+
* Apply a SQL-based Policy to a PostgreSQL Cluster
47+
* Perform User Management
48+
* Apply User Defined Labels to PostgreSQL Clusters
49+
* Perform Password Management
50+
51+
What actually gets created on the Kube cluster for a
52+
*pgcluster* resource is defined as a *deployment strategy*. Strategies
53+
are documented in detail in [Deployment Strategies](https://github.com/CrunchyData/postgres-operator/blob/master/docs/design.asciidoc#postgresql-operator-deployment-strategies).
54+
55+
56+
Installing the Chart
57+
--------------------
58+
59+
The chart can be installed as follows:
60+
61+
```console
62+
$ helm install postgres-operator --name postgres-operator --namespace=postgres-operator
63+
```
64+
65+
The command deploys postgres-operator on the Kubernetes cluster in the default configuration.
66+
67+
> **Tip**: List all releases using `helm list`
68+
69+
Uninstalling the Chart
70+
----------------------
71+
72+
To uninstall/delete the `postgres-operator` deployment:
73+
74+
```console
75+
$ helm delete postgres-operator
76+
```
77+
78+
The command removes all the Kubernetes components associated with the chart and deletes the release.
79+
80+
Configuration
81+
-------------
82+
83+
See `values.yaml` for configuration notes. Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
84+
85+
```console
86+
$ helm install postgres-operator --name postgres-operator --namespace=postgres-operator \
87+
--set env.debug=false
88+
```
89+
90+
The above command disables the debugging.
91+
92+
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
93+
94+
```console
95+
$ helm install postgres-operator --name postgres-operator --namespace=postgres-operator \
96+
-f values.yaml
97+
```
98+
99+
> **Tip**: You can use the default [values.yaml](values.yaml)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"apiVersion": "batch/v1",
3+
"kind": "Job",
4+
"metadata": {
5+
"name": "backup-{{.Name}}"
6+
},
7+
"spec": {
8+
"template": {
9+
"metadata": {
10+
"name": "{{.Name}}",
11+
"labels": {
12+
"pgbackup": "true",
13+
"pg-database": "{{.Name}}"
14+
}
15+
},
16+
"spec": {
17+
"volumes": [{
18+
"name": "pgdata",
19+
{{.PvcName}}
20+
}],
21+
22+
{{.SecurityContext}}
23+
24+
"containers": [{
25+
"name": "backup",
26+
"image": "crunchydata/crunchy-backup:{{.CCPImageTag}}",
27+
"volumeMounts": [{
28+
"mountPath": "/pgdata",
29+
"name": "pgdata",
30+
"readOnly": false
31+
}],
32+
"env": [{
33+
"name": "BACKUP_HOST",
34+
"value": "{{.BackupHost}}"
35+
}, {
36+
"name": "BACKUP_USER",
37+
"value": "{{.BackupUser}}"
38+
}, {
39+
"name": "BACKUP_PASS",
40+
"value": "{{.BackupPass}}"
41+
}, {
42+
"name": "BACKUP_PORT",
43+
"value": "{{.BackupPort}}"
44+
}]
45+
}],
46+
"restartPolicy": "Never"
47+
}
48+
}
49+
}
50+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"affinity": {
2+
"nodeAffinity": {
3+
"preferredDuringSchedulingIgnoredDuringExecution": [{
4+
"weight": 1,
5+
"preference": {
6+
"matchExpressions": [{
7+
"key": "kubernetes.io/hostname",
8+
"operator": "{{.Operator}}",
9+
"values": [
10+
"{{.Node}}"
11+
]
12+
}]
13+
}
14+
}]
15+
}
16+
},
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
{
2+
"kind": "Deployment",
3+
"apiVersion": "extensions/v1beta1",
4+
"metadata": {
5+
"name": "{{.Name}}",
6+
"labels": {
7+
{{.OperatorLabels }}
8+
}
9+
},
10+
"spec": {
11+
"replicas": 1,
12+
"template": {
13+
"metadata": {
14+
"labels": {
15+
"name": "{{.Name}}",
16+
"primary": "true",
17+
"pg-cluster": "{{.ClusterName}}"
18+
}
19+
},
20+
"spec": {
21+
22+
{{.SecurityContext }}
23+
24+
"containers": [{
25+
"name": "database",
26+
"image": "crunchydata/crunchy-postgres:{{.CCPImageTag}}",
27+
"readinessProbe": {
28+
"exec": {
29+
"command": [
30+
"/opt/cpm/bin/readiness.sh"
31+
]
32+
},
33+
"initialDelaySeconds": 15,
34+
"timeoutSeconds": 8
35+
},
36+
"env": [{
37+
"name": "PG_PRIMARY_PORT",
38+
"value": "{{.Port}}"
39+
}, {
40+
"name": "PG_MODE",
41+
"value": "primary"
42+
}, {
43+
"name": "PGDATA_PATH_OVERRIDE",
44+
"value": "{{.DataPathOverride}}"
45+
}, {
46+
"name": "BACKUP_PATH",
47+
"value": "{{.BackupPath}}"
48+
}, {
49+
"name": "PG_DATABASE",
50+
"value": "{{.Database}}"
51+
}, {
52+
"name": "PGHOST",
53+
"value": "/tmp"
54+
}],
55+
"volumeMounts": [{
56+
"mountPath": "/pgdata",
57+
"name": "pgdata",
58+
"readOnly": false
59+
}, {
60+
"mountPath": "/backup",
61+
"name": "backup",
62+
"readOnly": true
63+
}, {
64+
"mountPath": "/pguser",
65+
"name": "user-volume"
66+
}, {
67+
"mountPath": "/pgprimary",
68+
"name": "primary-volume"
69+
}, {
70+
"mountPath": "/pgroot",
71+
"name": "root-volume"
72+
}
73+
74+
],
75+
76+
"ports": [{
77+
"containerPort": 5432,
78+
"protocol": "TCP"
79+
}],
80+
"resources": {},
81+
"imagePullPolicy": "IfNotPresent"
82+
}],
83+
"volumes": [{
84+
"name": "pgdata",
85+
{{.PVCName}}
86+
}, {
87+
"name": "backup",
88+
{{.BackupPVCName}}
89+
}, {
90+
"name": "user-volume",
91+
"secret": {
92+
"secretName": "{{.UserSecretName}}"
93+
}
94+
}, {
95+
"name": "primary-volume",
96+
"secret": {
97+
"secretName": "{{.PrimarySecretName}}"
98+
}
99+
}, {
100+
"name": "root-volume",
101+
"secret": {
102+
"secretName": "{{.RootSecretName}}"
103+
}
104+
}
105+
106+
],
107+
108+
{{.NodeSelector}}
109+
110+
"restartPolicy": "Always",
111+
"dnsPolicy": "ClusterFirst"
112+
}
113+
},
114+
"strategy": {
115+
"type": "RollingUpdate",
116+
"rollingUpdate": {
117+
"maxUnavailable": 1,
118+
"maxSurge": 1
119+
}
120+
}
121+
}
122+
}

0 commit comments

Comments
 (0)