mongodb / helm-charts

Apache License 2.0
90 stars 91 forks source link

Agent log configuration problem #341

Open vramperez opened 1 month ago

vramperez commented 1 month ago

What did you do to encounter the bug? deploy the community-operator chart with the following values:

community-operator-crds:
  enabled: true
operator:
  priorityClassName: infra-priority
  resources:
    limits:
      cpu: "2"
      memory: 1Gi
    requests:
      cpu: 10m
      memory: 100Mi

and deploy a mongodb cluster with the following config:

apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
    name: test-mongodb
    namespace: test
spec:
    members: 1
    type: ReplicaSet
    version: 7.0.11
    security:
        authentication:
            modes:
                - SCRAM
    statefulSet:
        spec:
            template:
                metadata:
                    labels:
                        role: dbserver
                        type: mongodb
                spec:
                    agent:
                      logLevel: "DEBUG"
                      logFile: "/var/log/mongodb-mms-automation/automation-agent-test.log"
                      logRotate:
                        numTotal: 5
                        numUncompressed: 1
                        sizeThresholdMB: "1"
                        timeThresholdHrs: 1
                    containers:
                        - name: mongod
                          resources:
                            limits:
                                cpu: "1"
                                memory: 1Gi
                            requests:
                                cpu: 10m
                                memory: 100Mi
                        - name: mongodb-agent
                          resources:
                            limits:
                                cpu: "1"
                                memory: 1Gi
                            requests:
                                cpu: 10m
                                memory: 100Mi
                    topologySpreadConstraints:
                        - labelSelector:
                            matchLabels:
                                type: mongodb
                          maxSkew: 1
                          topologyKey: topology.kubernetes.io/zone
                          whenUnsatisfiable: DoNotSchedule
                    affinity:
                        nodeAffinity:
                            preferredDuringSchedulingIgnoredDuringExecution:
                                - weight: 100
                                  preference:
                                    matchExpressions:
                                        - key: test.help/type
                                          operator: In
                                          values:
                                            - application
                    serviceAccountName: test-mongodb-sa
                    tolerations:
                        - key: node.kubernetes.io/not-ready
                          operator: Exists
                          effect: NoExecute
                          tolerationSeconds: 5
                        - key: node.kubernetes.io/unreachable
                          operator: Exists
                          effect: NoExecute
                          tolerationSeconds: 5
                    priorityClassName: infra-priority
            volumeClaimTemplates:
                - kind: PersistentVolumeClaim
                  apiVersion: v1
                  metadata:
                    name: data-volume
                    namespace: test
                  spec:
                    accessModes:
                        - ReadWriteOnce
                    storageClassName: nfs-csi
                    resources:
                        requests:
                            storage: 10G
                - kind: PersistentVolumeClaim
                  apiVersion: v1
                  metadata:
                    name: logs-volume
                    namespace: test
                  spec:
                    accessModes:
                        - ReadWriteOnce
                    storageClassName: nfs-csi
                    resources:
                        requests:
                            storage: 10G
    users:
    ...

What did you expect? I would expect the agent's log configuration to be applied

....
                spec:
                    agent:
                      logLevel: "DEBUG"
                      logFile: "/var/log/mongodb-mms-automation/automation-agent-test.log"
                      logRotate:
                        numTotal: 5
                        numUncompressed: 1
                        sizeThresholdMB: "1"
                        timeThresholdHrs: 1
....

What happened instead? The specified configuration does not apply. For example, the log file remains the default one /var/log/mongodb-mms-automation/automation-agent.log, instead of the one specified /var/log/mongodb-mms-automation/automation-agent-test.log

Kubernetes Cluster Information

kubectl version
Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.0

helm list
NAME                NAMESPACE   REVISION    UPDATED                                     STATUS      CHART                       APP VERSION
mongodb             test        1           2024-08-08 13:31:24.882820339 +0200 CEST    deployed    community-operator-0.10.0   0.10.0 

I'm probably setting something wrong, but I can't figure out what it is.

Thank you.

divyanshverma commented 1 month ago

Have the exact same problem. Have you been able to fix it ? @vramperez It appears to work only with mongodb 4.4.0. 6.0.5 and 7+ > all fail with same error.

divyanshverma commented 1 month ago

I am able to run version 5.0.28 successfully. Its definitely not related to AVX also.

divyanshverma commented 1 month ago

MongoDB Kubernetes Operator 0.10.0 works fine. The migration to UBI based images in 0.11.0 seems to be the problem. I am able to run MongoDB 6.0.16 with Operator 0.10.0.

vramperez commented 3 weeks ago

No news from my side. Finally what I have done is to override the agent command in the chart to be able to pass the configuration as arguments to the agent directly. I don't like that solution, but for the time being, until it is fixed I have had to opt for this workaround.