diff --git a/docs/user.md b/docs/user.md index d0ebcc1b0..53a260220 100644 --- a/docs/user.md +++ b/docs/user.md @@ -242,3 +242,35 @@ metadata: Note that timezone required for `timestamp` (offset relative to UTC, see RFC 3339 section 5.6) + + +## Sidecar Support + +Each cluster can specify arbitrary sidecars to run. These containers could be used for +log aggregation, monitoring, backups or other tasks. A sidecar can be specified like this: + +```yaml +apiVersion: "acid.zalan.do/v1" +kind: postgresql + +metadata: + name: acid-minimal-cluster +spec: + ... + sidecars: + - name: "container-name" + image: "company/image:tag" + env: + - name: "ENV_VAR_NAME" + value: "any-k8s-env-things" +``` + +In addition to any environment variables you specify, the following environment variables +are always passed to sidecars: + + - `POD_NAME` - field reference to `metadata.name` + - `POD_NAMESPACE` - field reference to `metadata.namespace` + - `POSTGRES_USER` - the superuser that can be used to connect to the database + - `POSTGRES_PASSWORD` - the password for the superuser + +The PostgreSQL volume is shared with sidecars and is mounted at `/home/postgres/pgdata`. diff --git a/pkg/spec/postgresql.go b/pkg/spec/postgresql.go index 70d7788ba..76999c673 100644 --- a/pkg/spec/postgresql.go +++ b/pkg/spec/postgresql.go @@ -65,7 +65,7 @@ type CloneDescription struct { type Sidecar struct { Resources `json:"resources,omitempty"` Name string `json:"name,omitempty"` - DockerImage string `json:"dockerImage,omitempty"` + DockerImage string `json:"image,omitempty"` Ports []v1.ContainerPort `json:"ports,omitempty"` Env []v1.EnvVar `json:"env,omitempty"` }