mongodb / mongodb-kubernetes-operator

MongoDB Community Kubernetes Operator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can not set setParameter.authenticationMechanisms to SCRAM-SHA-1

drivebyer opened this issue · comments

What did you do to encounter the bug?
My resource:

apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
  name: wy-111
  namespace: mcamel-system
spec:
  additionalMongodConfig:
    net.tls.mode: disabled
    setParameter.authenticationMechanisms: SCRAM-SHA-1
    storage.engine: wiredTiger
    systemLog.quiet: "true"
    systemLog.verbosity: "0"
  agent:
    logLevel: ""
    maxLogFileDurationHours: 0
  arbiters: 0
  members: 3
  security:
    authentication:
      ignoreUnknownUsers: true
      modes:
      - SCRAM
    tls:
      certificateKeySecretRef: {}
      enabled: false
      optional: false
  statefulSet:
    spec:
      selector: null
      serviceName: ""
      template:
        metadata:
          creationTimestamp: null
        spec:
          affinity:
            nodeAffinity: null
            podAntiAffinity: null
          containers:
          - imagePullPolicy: IfNotPresent
            name: mongod
            resources:
              limits:
                cpu: "1"
                memory: 1Gi
              requests:
                cpu: 100m
                memory: 512Mi
          - imagePullPolicy: IfNotPresent
            name: mongodb-agent
            resources:
              limits:
                cpu: 200m
                memory: 250M
              requests:
                cpu: 200m
                memory: 200M
          - args:
            - --mongodb.uri=$(MONGODB_URI)
            - --compatible-mode
            - --collect-all
            command:
            - /mongodb_exporter
            env:
            - name: MONGODB_URI
              value: mongodb://root:%21QAZ2wsx@localhost:27017
            image: percona/mongodb_exporter:0.38.0
            imagePullPolicy: IfNotPresent
            name: exporter
            ports:
            - containerPort: 9216
              name: metrics
            resources:
              limits:
                cpu: 100m
                memory: 200Mi
              requests:
                cpu: 50m
                memory: 100Mi
          - args:
            - --mongodb.uri=$(MONGODB_URI)
            - --compatible-mode
            - --collect-all
            command:
            - /mongodb_exporter
            env:
            - name: MONGODB_URI
              value: mongodb://root:%21QAZ2wsx@localhost:27017
            image: percona/mongodb_exporter:0.38.0
            imagePullPolicy: IfNotPresent
            name: exporter
            ports:
            - containerPort: 9216
              name: metrics
            resources:
              limits:
                cpu: 100m
                memory: 200Mi
              requests:
                cpu: 50m
                memory: 100Mi
          initContainers:
          - imagePullPolicy: IfNotPresent
            name: mongod-posthook
            resources:
              limits:
                cpu: 200m
                memory: 250M
              requests:
                cpu: 100m
                memory: 200M
          - imagePullPolicy: IfNotPresent
            name: mongodb-agent-readinessprobe
            resources:
              limits:
                cpu: 200m
                memory: 250M
              requests:
                cpu: 100m
                memory: 200M
      updateStrategy: {}
      volumeClaimTemplates:
      - metadata:
          creationTimestamp: null
          name: data-volume
        spec:
          accessModes:
          - ReadWriteOnce
          resources:
            requests:
              storage: 1Gi
          storageClassName: local-path
        status: {}
      - metadata:
          creationTimestamp: null
          name: logs-volume
        spec:
          accessModes:
          - ReadWriteOnce
          resources:
            requests:
              storage: 1Gi
          storageClassName: local-path
        status: {}
  type: ReplicaSet
  users:
  - connectionStringSecretName: ""
    db: admin
    name: root
    passwordSecretRef:
      key: password
      name: wy-111
    roles:
    - db: admin
      name: root
    scramCredentialsSecretName: wy-111-root
  version: 4.2.24
status:
  currentMongoDBMembers: 3
  currentStatefulSetReplicas: 3
  mongoUri: mongodb://wy-111-0.wy-111-svc.mcamel-system.svc.cluster.local:27017,wy-111-1.wy-111-svc.mcamel-system.svc.cluster.local:27017,wy-111-2.wy-111-svc.mcamel-system.svc.cluster.local:27017/?replicaSet=wy-111
  phase: Running
  version: 4.2.24

What did you expect?
I want to set authenticationMechanisms to SCRAM-SHA-1

What happened instead?
The authenticationMechanisms is SCRAM-SHA-256:
截屏2023-10-26 15 32 44

Operator Information

  • Operator Version
  • MongoDB Image used

Kubernetes Cluster Information

  • Distribution
  • Version
  • Image Registry location (quay, or an internal registry)

Additional context
Add any other context about the problem here.

If possible, please include:

  • kubectl describe output
  • yaml definitions for your objects
  • log files for the operator and database pods

Hey @drivebyer,
I was also facing the same issue but I resolved it by adding

security:
    authentication:
      modes: ["SCRAM-SHA-1"]

It worked for me and changed the authentication mechanism

thanks @harshau007 , i would have a try.

Hey @drivebyer, I was also facing the same issue but I resolved it by adding

security:
    authentication:
      modes: ["SCRAM-SHA-1"]

It worked for me and changed the authentication mechanism

It works. I set modes to ["SCRAM", "SCRAM-SHA-1"] to enable sha-256 && sha-1.