Support for per-cluster and operator global sidecars (#331)

* Define sidecars in the operator configuration.

Right now only the name and the docker image can be defined, but with
the help of the pod_environment_configmap parameter arbitrary
environment variables can be passed to the sidecars.

* Refactoring around generatePodTemplate.

Original implementation of per-cluster sidecars by @theRealWardo 

Per review by @zerg-junior and @Jan-M
This commit is contained in:
Oleksii Kliukin
2018-07-02 16:25:27 +02:00
committed by GitHub
parent 7394c15d0a
commit 25a306244f
6 changed files with 427 additions and 156 deletions
+10
View File
@@ -61,6 +61,15 @@ type CloneDescription struct {
EndTimestamp string `json:"timestamp,omitempty"`
}
// Sidecar defines a container to be run in the same pod as the Postgres container.
type Sidecar struct {
Resources `json:"resources,omitempty"`
Name string `json:"name,omitempty"`
DockerImage string `json:"image,omitempty"`
Ports []v1.ContainerPort `json:"ports,omitempty"`
Env []v1.EnvVar `json:"env,omitempty"`
}
type UserFlags []string
// PostgresStatus contains status of the PostgreSQL cluster (running, creation failed etc.)
@@ -124,6 +133,7 @@ type PostgresSpec struct {
ClusterName string `json:"-"`
Databases map[string]string `json:"databases,omitempty"`
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
Sidecars []Sidecar `json:"sidecars,omitempty"`
}
// PostgresqlList defines a list of PostgreSQL clusters.