Kind: SGDistributedLogs
listKind: SGDistributedLogsList
plural: sgdistributedlogs
singular: sgdistributedlogs
shortNames sgdil
The SGDistributedLogs
custom resource represents a distributed logs cluster.
When a Postgres cluster is configured to use distributed logs, all logs from different sources will be forwarded to the distributed logs cluster.
Under the hood, distributed log cluster use an SGCluster
.
Therefore, the distributed log cluster can be queried using SQL as well, for example using postgres-util.
Example:
apiVersion: stackgres.io/v1
kind: SGDistributedLogs
metadata:
name: distributedlogs
spec:
persistentVolume:
size: 10Gi
See also Distribtued Logs section.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
apiVersion | ✓ | string | stackgres.io/v1 | ||
kind | ✓ | string | SGDistributedLogs | ||
metadata | ✓ | ✓ | object | Refer to the Kubernetes API documentation for the fields of the metadata field. |
|
spec | ✓ | ✓ | object |
|
|
status | ✓ | object |
|
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
persistentVolume | ✓ | ✓ | object |
Pod’s persistent volume configuration |
|
configurations | ✓ | object |
Cluster custom configurations.
|
||
metadata | ✓ | object |
Metadata information from cluster created resources. |
||
nonProductionOptions | ✓ | object |
|
||
postgresServices | ✓ | object |
Kubernetes services created or managed by StackGres.
|
||
resources | ✓ | object |
Pod custom resources configuration. |
||
scheduling | ✓ | ✓ | object |
Pod custom scheduling and affinity configuration.
Changing this field may require a restart.
|
|
sgInstanceProfile | ✓ | ✓ | string |
Name of the SGInstanceProfile. A SGInstanceProfile defines CPU and memory limits. Must exist before creating a distributed logs. When no profile is set, a default (currently: 1 core, 2 GiB RAM) one is used.
Changing this field may require a restart.
|
|
toInstallPostgresExtensions | ✓ | []object |
The list of Postgres extensions to install.
This section is filled by the operator.
|
Pod’s persistent volume configuration
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
size | ✓ | string |
Size of the PersistentVolume set for the pod of the cluster for distributed logs. This size is specified either in Mebibytes, Gibibytes or Tebibytes (multiples of 2^20, 2^30 or 2^40, respectively).
|
||
storageClass | ✓ | string |
Name of an existing StorageClass in the Kubernetes cluster, used to create the PersistentVolumes for the instances of the cluster.
|
Cluster custom configurations.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
sgPostgresConfig | ✓ | ✓ | string |
Name of the SGPostgresConfig used for the distributed logs. It must exist. When not set, a default Postgres config, for the major version selected, is used.
Changing this field may require a restart.
|
Metadata information from cluster created resources.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
annotations | ✓ | object |
Custom Kubernetes annotations to be passed to resources created and managed by StackGres. |
Custom Kubernetes annotations to be passed to resources created and managed by StackGres.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
allResources | ✓ | map[string]string |
Annotations to attach to any resource created or managed by StackGres. |
||
pods | ✓ | map[string]string |
Annotations to attach to pods created or managed by StackGres. |
||
services | ✓ | map[string]string |
Annotations to attach to services created or managed by StackGres. |
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
disableClusterPodAntiAffinity | ✓ | ✓ | boolean |
It is a best practice, on non-containerized environments, when running production workloads, to run each database server on a different server (virtual or physical), i.e., not to co-locate more than one database server per host.
The same best practice applies to databases on containers. By default, StackGres will not allow to run more than one StackGres or Distributed Logs pod on a given Kubernetes node. If set to Changing this field may require a restart.
|
|
disableClusterResourceRequirements | ✓ | ✓ | boolean |
It is a best practice, on containerized environments, when running production workloads, to enforce container’s resources requirements.
By default, StackGres will configure resource requirements for all the containers. Set this property to true to prevent StackGres from setting container’s resources requirements (except for patroni container, see Changing this field may require a restart.
|
|
disablePatroniResourceRequirements | ✓ | ✓ | boolean |
It is a best practice, on containerized environments, when running production workloads, to enforce container’s resources requirements.
The same best practice applies to databases on containers. By default, StackGres will configure resource requirements for patroni container. Set this property to true to prevent StackGres from setting patroni container’s resources requirement. Changing this field may require a restart.
|
|
enableSetClusterCpuRequests | ✓ | ✓ | boolean |
On containerized environments, when running production workloads, enforcing container’s cpu requirements request to be equals to the limit allow to achieve the highest level of performance. Doing so, reduces the chances of leaving
the workload with less cpu than it requires. It also allow to set static CPU management policy that allows to guarantee a pod the usage exclusive CPUs on the node.
By default, StackGres will configure cpu requirements to have the same limit and request for all the containers. Set this property to true to prevent StackGres from setting container’s cpu requirements request equals to the limit (except for patroni container, see Changing this field may require a restart.
|
|
enableSetClusterMemoryRequests | ✓ | ✓ | boolean |
On containerized environments, when running production workloads, enforcing container’s memory requirements request to be equals to the limit allow to achieve the highest level of performance. Doing so, reduces the chances of leaving
the workload with less memory than it requires.
By default, StackGres will configure memory requirements to have the same limit and request for all the containers. Set this property to true to prevent StackGres from setting container’s memory requirements request equals to the limit (except for patroni container, see Changing this field may require a restart.
|
|
enableSetPatroniCpuRequests | ✓ | ✓ | boolean |
On containerized environments, when running production workloads, enforcing container’s cpu requirements request to be equals to the limit allow to achieve the highest level of performance. Doing so, reduces the chances of leaving
the workload with less cpu than it requires. It also allow to set static CPU management policy that allows to guarantee a pod the usage exclusive CPUs on the node.
By default, StackGres will configure cpu requirements to have the same limit and request for the patroni container. Set this property to true to prevent StackGres from setting patroni container’s cpu requirements request equals to the limit
when Changing this field may require a restart.
|
|
enableSetPatroniMemoryRequests | ✓ | ✓ | boolean |
On containerized environments, when running production workloads, enforcing container’s memory requirements request to be equals to the limit allow to achieve the highest level of performance. Doing so, reduces the chances of leaving
the workload with less memory than it requires.
By default, StackGres will configure memory requirements to have the same limit and request for the patroni container. Set this property to true to prevent StackGres from setting patroni container’s memory requirements request equals to the limit
when Changing this field may require a restart.
|
Kubernetes services created or managed by StackGres.
Example:
apiVersion: stackgres.io/v1
kind: SGDistributedLogs
metadata:
name: stackgres
spec:
postgresServices:
primary:
type: ClusterIP
replicas:
enabled: true
type: ClusterIP
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
primary | ✓ | object |
Configuration for the -primary service. It provides a stable connection (regardless of primary failures or switchovers) to the read-write Postgres server of the cluster. |
||
replicas | ✓ | object |
Configuration for the -replicas service. It provides a stable connection (regardless of replica node failures) to any read-only Postgres server of the cluster. Read-only servers are load-balanced via this service. |
Configuration for the -primary
service. It provides a stable connection (regardless of primary failures or switchovers) to the read-write Postgres server of the cluster.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
annotations | ✓ | map[string]string |
Custom Kubernetes annotations passed to the -primary service.
|
||
loadBalancerIP | ✓ | string |
Specify loadBalancer IP of Postgres primary service for Distributed Log |
||
type | ✓ | enum |
Specifies the type of Kubernetes service(`ClusterIP`, `LoadBalancer`, `NodePort`) Enum: ClusterIP, LoadBalancer, NodePort |
Configuration for the -replicas
service. It provides a stable connection (regardless of replica node failures) to any read-only Postgres server of the cluster. Read-only servers are load-balanced via this service.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
annotations | ✓ | map[string]string |
Custom Kubernetes annotations passed to the -replicas service. |
||
enabled | ✓ | boolean |
Specify if the -replicas service should be created or not. |
||
loadBalancerIP | ✓ | string |
Specify loadBalancer IP of Postgres replica service for Distributed Log |
||
type | ✓ | enum |
Specifies the type of Kubernetes service(ClusterIP , LoadBalancer , NodePort ).Enum: ClusterIP, LoadBalancer, NodePort |
Pod custom resources configuration.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
enableClusterLimitsRequirements | ✓ | ✓ | boolean |
When enabled resource limits for containers other than the patroni container wil be set just like for patroni contianer as specified in the SGInstanceProfile.
Changing this field may require a restart.
|
Pod custom scheduling and affinity configuration.
Changing this field may require a restart.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
nodeAffinity | ✓ | ✓ | object |
Node affinity is a group of node affinity scheduling rules.
See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#nodeaffinity-v1-core
|
|
nodeSelector | ✓ | ✓ | map[string]string |
NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node’s labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
|
|
podAffinity | ✓ | ✓ | object |
Pod affinity is a group of inter pod affinity scheduling rules.
See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#podaffinity-v1-core
|
|
podAntiAffinity | ✓ | ✓ | object |
Pod anti affinity is a group of inter pod anti affinity scheduling rules.
See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#podantiaffinity-v1-core
|
|
priorityClassName | ✓ | ✓ | string |
Priority indicates the importance of a Pod relative to other Pods. If a Pod cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling of the pending Pod possible.
|
|
tolerations | ✓ | ✓ | []object |
If specified, the pod’s tolerations.
See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#toleration-v1-core
|
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
name | ✓ | ✓ | string |
The name of the extension to install. |
|
postgresVersion | ✓ | ✓ | string |
The postgres major version of the extension to install. |
|
publisher | ✓ | ✓ | string |
The id of the publisher of the extension to install. |
|
repository | ✓ | ✓ | string |
The repository base URL from where the extension will be installed from. |
|
version | ✓ | ✓ | string |
The version of the extension to install. |
|
build | ✓ | string |
The build version of the extension to install. |
||
extraMounts | ✓ | []string |
The extra mounts of the extension to install. |
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
arch | ✓ | string |
The architecture on which the cluster has been initialized. |
||
conditions | ✓ | []object |
|
||
connectedClusters | ✓ | []object |
The list of connected sgclusters |
||
databases | ✓ | []object |
The list of database status |
||
fluentdConfigHash | ✓ | string |
The hash of the configuration file that is used by fluentd |
||
labelPrefix | ✓ | string |
The custom prefix that is prepended to all labels. |
||
os | ✓ | string |
The operative system on which the cluster has been initialized. |
||
podStatuses | ✓ | []object |
The list of pod statuses. |
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
lastTransitionTime | ✓ | string |
Last time the condition transitioned from one status to another. |
||
message | ✓ | string |
A human readable message indicating details about the transition. |
||
reason | ✓ | string |
The reason for the condition’s last transition. |
||
status | ✓ | string |
Status of the condition, one of True, False, Unknown. |
||
type | ✓ | string |
Type of deployment condition. |
A connected sgcluster
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
config | ✓ | object |
The configuration for sgdistributedlgos of this sgcluster |
||
name | ✓ | string |
The sgcluster name |
||
namespace | ✓ | string |
The sgcluster namespace |
The configuration for sgdistributedlgos
of this sgcluster
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
retention | ✓ | string |
The retention window that has been applied to tables |
||
sgDistributedLogs | ✓ | string |
The sgdistributedlogs to which this sgcluster is connected to |
A database status
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
name | ✓ | string |
The database name that has been created |
||
retention | ✓ | string |
The retention window that has been applied to tables |
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
name | ✓ | ✓ | string |
The name of the pod. |
|
installedPostgresExtensions | ✓ | []object |
The list of extensions currently installed. |
||
pendingRestart | ✓ | boolean |
Indicates if the pod requires restart |
||
primary | ✓ | boolean |
Indicates if the pod is the elected primary |
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
name | ✓ | ✓ | string |
The name of the installed extension. |
|
postgresVersion | ✓ | ✓ | string |
The postgres major version of the installed extension. |
|
publisher | ✓ | ✓ | string |
The id of the publisher of the installed extension. |
|
repository | ✓ | ✓ | string |
The repository base URL from where the extension was installed. |
|
version | ✓ | ✓ | string |
The version of the installed extension. |
|
build | ✓ | string |
The build version of the installed extension. |