remove scalyr sidecar

This commit is contained in:
Felix Kunde 2019-11-04 11:44:23 +01:00
parent 719505afba
commit 983a4e45b5
12 changed files with 17 additions and 179 deletions

View File

@ -32,6 +32,4 @@ configuration:
{{ toYaml .Values.configTeamsApi | indent 4 }} {{ toYaml .Values.configTeamsApi | indent 4 }}
logging_rest_api: logging_rest_api:
{{ toYaml .Values.configLoggingRestApi | indent 4 }} {{ toYaml .Values.configLoggingRestApi | indent 4 }}
scalyr:
{{ toYaml .Values.configScalyr | indent 4 }}
{{- end }} {{- end }}

View File

@ -217,23 +217,6 @@ configTeamsApi:
# URL of the Teams API service # URL of the Teams API service
# teams_api_url: http://fake-teams-api.default.svc.cluster.local # teams_api_url: http://fake-teams-api.default.svc.cluster.local
# Scalyr is a log management tool that Zalando uses as a sidecar
scalyr:
# API key for the Scalyr sidecar
# scalyr_api_key: ""
# Docker image for the Scalyr sidecar
# scalyr_image: ""
# CPU limit value for the Scalyr sidecar
scalyr_cpu_limit: "1"
# CPU rquest value for the Scalyr sidecar
scalyr_cpu_request: 100m
# Memory limit value for the Scalyr sidecar
scalyr_memory_limit: 1Gi
# Memory request value for the Scalyr sidecar
scalyr_memory_request: 50Mi
rbac: rbac:
# Specifies whether RBAC resources should be created # Specifies whether RBAC resources should be created
create: true create: true

View File

@ -24,6 +24,7 @@
component/.style={draw,solid,thick,rounded corners,fill=yellow!20,inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}}, component/.style={draw,solid,thick,rounded corners,fill=yellow!20,inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}},
border/.style={draw,dashed,rounded corners,fill=gray!20,inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}}, border/.style={draw,dashed,rounded corners,fill=gray!20,inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}},
volume/.style={draw,solid,thick,rounded corners,fill=blue!20, inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}}, volume/.style={draw,solid,thick,rounded corners,fill=blue!20, inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}},
initcontainer/.style={draw,solid,thick,rounded corners,fill=blue!20, inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}},
sidecar/.style={draw,solid,thick,rounded corners,fill=blue!20, inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}}, sidecar/.style={draw,solid,thick,rounded corners,fill=blue!20, inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}},
k8s-label/.style={draw,solid,thick,rounded corners,fill=blue!20, minimum width=1.5cm, inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}}, k8s-label/.style={draw,solid,thick,rounded corners,fill=blue!20, minimum width=1.5cm, inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}},
affinity/.style={draw,solid,thick,rounded corners,fill=blue!20, minimum width=2cm, inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}}, affinity/.style={draw,solid,thick,rounded corners,fill=blue!20, minimum width=2cm, inner sep=.3cm, blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}},
@ -60,7 +61,14 @@
fit=(data-volume)(shm-volume)(tokens-volume)(volumes-label) fit=(data-volume)(shm-volume)(tokens-volume)(volumes-label)
] (volumes) {}; \& ] (volumes) {}; \&
\node[component] (spilo) {Spilo}; \& \node[component] (spilo) {Spilo}; \&
\node[sidecar] (scalyr) {Scalyr}; \& \\ \& \path
node[initcontainer] (custom-initcontainer1) {User defined}
node[label, right=.25cm of custom-initcontainer1] (initcontainers-middle) {}
node[initcontainer, right=.25cm of initcontainers-middle] (custom-initcontainer2) {User defined}
node[label, below of=initcontainers-middle] (initcontainers-label) {Custom initcontainers}
node[border, behind path,
fit=(custom-initcontainer1)(custom-initcontainer2)(initcontainers-label)
] (initcontainers) {}; \&
\path \path
node[component] (patroni) {Patroni} node[component] (patroni) {Patroni}
node[component, below=.25cm of patroni] (postgres) {PostgreSQL} node[component, below=.25cm of patroni] (postgres) {PostgreSQL}
@ -82,7 +90,7 @@
\draw[to] (pod) to [bend left=25] (volumes); \draw[to] (pod) to [bend left=25] (volumes);
\draw[to] (pod) to [bend left=25] (k8s-labels); \draw[to] (pod) to [bend left=25] (k8s-labels);
\draw[to] (pod) to [bend right=25] (affinity); \draw[to] (pod) to [bend right=25] (affinity);
\draw[to] (pod) to [bend right=25] (scalyr); \draw[to] (pod) to [bend right=25] (initcontainers);
\draw[to] (pod) to [bend right=25] (sidecars); \draw[to] (pod) to [bend right=25] (sidecars);
\draw[to] (pod) -- node[midway,above] {} node[midway,below] {} (spilo); \draw[to] (pod) -- node[midway,above] {} node[midway,below] {} (spilo);
\draw[to] (spilo) -- node[midway,above] {} node[midway,below] {} (spilo-components); \draw[to] (spilo) -- node[midway,above] {} node[midway,below] {} (spilo-components);

View File

@ -41,13 +41,9 @@ The following environment variables are accepted by the operator:
operator itself. operator itself.
* **WATCHED_NAMESPACE** * **WATCHED_NAMESPACE**
the name of the namespace the operator watches. Special '*' character denotes the name of the namespace the operator watches. Special **'*'** character
all namespaces. Empty value defaults to the operator namespace. Overrides the denotes all namespaces. Empty value defaults to the operator namespace.
`watched_namespace` operator parameter. Overrides the `watched_namespace` operator parameter.
* **SCALYR_API_KEY**
the value of the Scalyr API key to supply to the pods. Overrides the
`scalyr_api_key` operator parameter.
* **CRD_READY_WAIT_TIMEOUT** * **CRD_READY_WAIT_TIMEOUT**
defines the timeout for the complete `postgresql` CRD creation. When not set defines the timeout for the complete `postgresql` CRD creation. When not set

View File

@ -120,9 +120,9 @@ Those are top-level keys, containing both leaf keys and groups.
value is also increased). This prevents certain cases of memory overcommitment value is also increased). This prevents certain cases of memory overcommitment
at the cost of overprovisioning memory and potential scheduling problems for at the cost of overprovisioning memory and potential scheduling problems for
containers with high memory limits due to the lack of memory on Kubernetes containers with high memory limits due to the lack of memory on Kubernetes
cluster nodes. This affects all containers created by the operator (Postgres, cluster nodes. This affects all containers created by the operator incl.
Scalyr sidecar, and other sidecars); to set resources for the operator's own sidecars); to set resources for the operator's own container, change the
container, change the [operator deployment manually](../manifests/postgres-operator.yaml#L20). [operator deployment manually](../manifests/postgres-operator.yaml#L20).
The default is `false`. The default is `false`.
## Postgres users ## Postgres users
@ -523,30 +523,3 @@ configuration they are grouped under the `logging_rest_api` key.
* **cluster_history_entries** * **cluster_history_entries**
number of entries in the cluster history ring buffer. The default is `1000`. number of entries in the cluster history ring buffer. The default is `1000`.
## Scalyr options
Those parameters define the resource requests/limits and properties of the
scalyr sidecar. In the CRD-based configuration they are grouped under the
`scalyr` key.
* **scalyr_api_key**
API key for the Scalyr sidecar. The default is empty.
* **scalyr_image**
Docker image for the Scalyr sidecar. The default is empty.
* **scalyr_server_url**
server URL for the Scalyr sidecar. The default is `https://upload.eu.scalyr.com`.
* **scalyr_cpu_request**
CPU request value for the Scalyr sidecar. The default is `100m`.
* **scalyr_memory_request**
Memory request value for the Scalyr sidecar. The default is `50Mi`.
* **scalyr_cpu_limit**
CPU limit value for the Scalyr sidecar. The default is `1`.
* **scalyr_memory_limit**
Memory limit value for the Scalyr sidecar. The default is `1Gi`.

View File

@ -94,11 +94,3 @@ configuration:
api_port: 8008 api_port: 8008
cluster_history_entries: 1000 cluster_history_entries: 1000
ring_log_lines: 100 ring_log_lines: 100
scalyr:
# scalyr_api_key: ""
scalyr_cpu_limit: "1"
scalyr_cpu_request: 100m
# scalyr_image: ""
scalyr_memory_limit: 1Gi
scalyr_memory_request: 50Mi
# scalyr_server_url: ""

View File

@ -136,17 +136,6 @@ type LoggingRESTAPIConfiguration struct {
ClusterHistoryEntries int `json:"cluster_history_entries,omitempty"` ClusterHistoryEntries int `json:"cluster_history_entries,omitempty"`
} }
// ScalyrConfiguration defines the configuration for ScalyrAPI
type ScalyrConfiguration struct {
ScalyrAPIKey string `json:"scalyr_api_key,omitempty"`
ScalyrImage string `json:"scalyr_image,omitempty"`
ScalyrServerURL string `json:"scalyr_server_url,omitempty"`
ScalyrCPURequest string `json:"scalyr_cpu_request,omitempty"`
ScalyrMemoryRequest string `json:"scalyr_memory_request,omitempty"`
ScalyrCPULimit string `json:"scalyr_cpu_limit,omitempty"`
ScalyrMemoryLimit string `json:"scalyr_memory_limit,omitempty"`
}
// OperatorConfigurationData defines the operation config // OperatorConfigurationData defines the operation config
type OperatorConfigurationData struct { type OperatorConfigurationData struct {
EtcdHost string `json:"etcd_host,omitempty"` EtcdHost string `json:"etcd_host,omitempty"`
@ -168,7 +157,6 @@ type OperatorConfigurationData struct {
OperatorDebug OperatorDebugConfiguration `json:"debug"` OperatorDebug OperatorDebugConfiguration `json:"debug"`
TeamsAPI TeamsAPIConfiguration `json:"teams_api"` TeamsAPI TeamsAPIConfiguration `json:"teams_api"`
LoggingRESTAPI LoggingRESTAPIConfiguration `json:"logging_rest_api"` LoggingRESTAPI LoggingRESTAPIConfiguration `json:"logging_rest_api"`
Scalyr ScalyrConfiguration `json:"scalyr"`
LogicalBackup OperatorLogicalBackupConfiguration `json:"logical_backup"` LogicalBackup OperatorLogicalBackupConfiguration `json:"logical_backup"`
} }

View File

@ -230,7 +230,6 @@ func (in *OperatorConfigurationData) DeepCopyInto(out *OperatorConfigurationData
out.OperatorDebug = in.OperatorDebug out.OperatorDebug = in.OperatorDebug
in.TeamsAPI.DeepCopyInto(&out.TeamsAPI) in.TeamsAPI.DeepCopyInto(&out.TeamsAPI)
out.LoggingRESTAPI = in.LoggingRESTAPI out.LoggingRESTAPI = in.LoggingRESTAPI
out.Scalyr = in.Scalyr
out.LogicalBackup = in.LogicalBackup out.LogicalBackup = in.LogicalBackup
return return
} }
@ -683,22 +682,6 @@ func (in *Resources) DeepCopy() *Resources {
return out return out
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ScalyrConfiguration) DeepCopyInto(out *ScalyrConfiguration) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScalyrConfiguration.
func (in *ScalyrConfiguration) DeepCopy() *ScalyrConfiguration {
if in == nil {
return nil
}
out := new(ScalyrConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Sidecar) DeepCopyInto(out *Sidecar) { func (in *Sidecar) DeepCopyInto(out *Sidecar) {
*out = *in *out = *in

View File

@ -745,9 +745,6 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
} }
// controller adjusts the Scalyr sidecar request at operator startup
// as this sidecar is managed separately
// adjust sidecar containers defined for that particular cluster // adjust sidecar containers defined for that particular cluster
for _, sidecar := range spec.Sidecars { for _, sidecar := range spec.Sidecars {
@ -849,23 +846,6 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
// resolve conflicts between operator-global and per-cluster sidecars // resolve conflicts between operator-global and per-cluster sidecars
sideCars := c.mergeSidecars(spec.Sidecars) sideCars := c.mergeSidecars(spec.Sidecars)
resourceRequirementsScalyrSidecar := makeResources(
c.OpConfig.ScalyrCPURequest,
c.OpConfig.ScalyrMemoryRequest,
c.OpConfig.ScalyrCPULimit,
c.OpConfig.ScalyrMemoryLimit,
)
// generate scalyr sidecar container
if scalyrSidecar :=
generateScalyrSidecarSpec(c.Name,
c.OpConfig.ScalyrAPIKey,
c.OpConfig.ScalyrServerURL,
c.OpConfig.ScalyrImage,
&resourceRequirementsScalyrSidecar, c.logger); scalyrSidecar != nil {
sideCars = append(sideCars, *scalyrSidecar)
}
// generate sidecar containers // generate sidecar containers
if sidecarContainers, err = generateSidecarContainers(sideCars, volumeMounts, defaultResources, if sidecarContainers, err = generateSidecarContainers(sideCars, volumeMounts, defaultResources,
c.OpConfig.SuperUsername, c.credentialSecretName(c.OpConfig.SuperUsername), c.logger); err != nil { c.OpConfig.SuperUsername, c.credentialSecretName(c.OpConfig.SuperUsername), c.logger); err != nil {
@ -949,35 +929,6 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
return statefulSet, nil return statefulSet, nil
} }
func generateScalyrSidecarSpec(clusterName, APIKey, serverURL, dockerImage string,
containerResources *acidv1.Resources, logger *logrus.Entry) *acidv1.Sidecar {
if APIKey == "" || dockerImage == "" {
if APIKey == "" && dockerImage != "" {
logger.Warning("Not running Scalyr sidecar: SCALYR_API_KEY must be defined")
}
return nil
}
scalarSpec := &acidv1.Sidecar{
Name: "scalyr-sidecar",
DockerImage: dockerImage,
Env: []v1.EnvVar{
{
Name: "SCALYR_API_KEY",
Value: APIKey,
},
{
Name: "SCALYR_SERVER_HOST",
Value: clusterName,
},
},
Resources: *containerResources,
}
if serverURL != "" {
scalarSpec.Env = append(scalarSpec.Env, v1.EnvVar{Name: "SCALYR_SERVER_URL", Value: serverURL})
}
return scalarSpec
}
// mergeSidecar merges globally-defined sidecars with those defined in the cluster manifest // mergeSidecar merges globally-defined sidecars with those defined in the cluster manifest
func (c *Cluster) mergeSidecars(sidecars []acidv1.Sidecar) []acidv1.Sidecar { func (c *Cluster) mergeSidecars(sidecars []acidv1.Sidecar) []acidv1.Sidecar {
globalSidecarsToSkip := map[string]bool{} globalSidecarsToSkip := map[string]bool{}

View File

@ -6,7 +6,7 @@ import (
"sync" "sync"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
rbacv1beta1 "k8s.io/api/rbac/v1beta1" rbacv1beta1 "k8s.io/api/rbac/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
@ -120,15 +120,6 @@ func (c *Controller) initOperatorConfig() {
c.opConfig.DefaultMemoryRequest = c.opConfig.DefaultMemoryLimit c.opConfig.DefaultMemoryRequest = c.opConfig.DefaultMemoryLimit
} }
isSmaller, err = util.RequestIsSmallerThanLimit(c.opConfig.ScalyrMemoryRequest, c.opConfig.ScalyrMemoryLimit)
if err != nil {
panic(err)
}
if isSmaller {
c.logger.Warningf("The memory request of %v for the Scalyr sidecar container is increased to match the memory limit of %v.", c.opConfig.ScalyrMemoryRequest, c.opConfig.ScalyrMemoryLimit)
c.opConfig.ScalyrMemoryRequest = c.opConfig.ScalyrMemoryLimit
}
// generateStatefulSet adjusts values for individual Postgres clusters // generateStatefulSet adjusts values for individual Postgres clusters
} }
@ -143,10 +134,6 @@ func (c *Controller) modifyConfigFromEnvironment() {
if c.config.NoTeamsAPI { if c.config.NoTeamsAPI {
c.opConfig.EnableTeamsAPI = false c.opConfig.EnableTeamsAPI = false
} }
scalyrAPIKey := os.Getenv("SCALYR_API_KEY")
if scalyrAPIKey != "" {
c.opConfig.ScalyrAPIKey = scalyrAPIKey
}
} }
// warningOnDeprecatedParameters emits warnings upon finding deprecated parmaters // warningOnDeprecatedParameters emits warnings upon finding deprecated parmaters

View File

@ -122,14 +122,5 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur
result.RingLogLines = fromCRD.LoggingRESTAPI.RingLogLines result.RingLogLines = fromCRD.LoggingRESTAPI.RingLogLines
result.ClusterHistoryEntries = fromCRD.LoggingRESTAPI.ClusterHistoryEntries result.ClusterHistoryEntries = fromCRD.LoggingRESTAPI.ClusterHistoryEntries
// Scalyr config
result.ScalyrAPIKey = fromCRD.Scalyr.ScalyrAPIKey
result.ScalyrImage = fromCRD.Scalyr.ScalyrImage
result.ScalyrServerURL = fromCRD.Scalyr.ScalyrServerURL
result.ScalyrCPURequest = fromCRD.Scalyr.ScalyrCPURequest
result.ScalyrMemoryRequest = fromCRD.Scalyr.ScalyrMemoryRequest
result.ScalyrCPULimit = fromCRD.Scalyr.ScalyrCPULimit
result.ScalyrMemoryLimit = fromCRD.Scalyr.ScalyrMemoryLimit
return result return result
} }

View File

@ -57,17 +57,6 @@ type Auth struct {
ReplicationUsername string `name:"replication_username" default:"standby"` ReplicationUsername string `name:"replication_username" default:"standby"`
} }
// Scalyr holds the configuration for the Scalyr Agent sidecar for log shipping:
type Scalyr struct {
ScalyrAPIKey string `name:"scalyr_api_key" default:""`
ScalyrImage string `name:"scalyr_image" default:""`
ScalyrServerURL string `name:"scalyr_server_url" default:"https://upload.eu.scalyr.com"`
ScalyrCPURequest string `name:"scalyr_cpu_request" default:"100m"`
ScalyrMemoryRequest string `name:"scalyr_memory_request" default:"50Mi"`
ScalyrCPULimit string `name:"scalyr_cpu_limit" default:"1"`
ScalyrMemoryLimit string `name:"scalyr_memory_limit" default:"1Gi"`
}
// LogicalBackup // LogicalBackup
type LogicalBackup struct { type LogicalBackup struct {
LogicalBackupSchedule string `name:"logical_backup_schedule" default:"30 00 * * *"` LogicalBackupSchedule string `name:"logical_backup_schedule" default:"30 00 * * *"`
@ -80,7 +69,6 @@ type Config struct {
CRD CRD
Resources Resources
Auth Auth
Scalyr
LogicalBackup LogicalBackup
WatchedNamespace string `name:"watched_namespace"` // special values: "*" means 'watch all namespaces', the empty string "" means 'watch a namespace where operator is deployed to' WatchedNamespace string `name:"watched_namespace"` // special values: "*" means 'watch all namespaces', the empty string "" means 'watch a namespace where operator is deployed to'