anchor.diff:      spec:
         containers:
           - name: member
  -          image: centos/mongodb-26-centos7
  +          image: openshift/mongodb-24-centos7
             env:
               - name: MONGODB_USER
                 value: "${MONGODB_USER}"
  
positive.code: member of the cluster.
  
  Once the *PRIMARY* member has been elected, the entrypoint script starts
  creating MongoDB users and databases. xref:creating-the-service-pod[The service
  pod] runs MongoDB without the `--auth` argument, so it can bootstrap the
  *PRIMARY* member without providing any authentication.
  
  When the user accounts and databases are created and the data are replicated to
  other members, the service pod then gives up its *PRIMARY* role and
  shuts down.
  
  [NOTE]
  ====
  It is important that the `*restartPolicy*` field in the service pod is set to
  *Never* to prevent the service pod from restarting when the container exits.
  ====
  
  As soon as the service pod shuts down, other members start a new election and
  the new *PRIMARY* member is elected from the running members.
  
  Clients can then start using the MongoDB instance by sending the queries to the
  *mongodb* service. As this service is a headless service, they do not need to
  
negative.code: === Creating the Service Pod
  
  To initialize members created by xref:creating-the-deploymentconfig[the
  deployment configuration], the pods are started with the `initiate` argument, 
  which instructs the startup script to behave xref:mongo-creating-headless-service[slightly differently]
  than a regular, stand-alone MongoDB database.
  
  [[example-deployment-config]]
  .Deployment Configuration Object Definition in the Example Template
  ====
  
  [source,yaml]
  ----
  - kind: DeploymentConfig
    apiVersion: v1
    metadata:
      name: "${MONGODB_SERVICE_NAME}"
    spec:
      strategy:
        type: Recreate
        recreateParams:
          post:
            failurePolicy: Retry
            execNewPod:
              command: ["run-mongod","initiate"]
              containerName: mongodb
              env:
              - name: MONGODB_INITIAL_REPLICA_COUNT
                value: '3'
      triggers:
      - type: ConfigChange
      replicas: 3
      selector:
        name: mongodb-replica
      template:
        metadata:
          labels:
            name: mongodb-replica
        spec:
          containers:
          - name: mongodb
            image: openshift/mongodb-24-centos7
            readinessProbe:
              tcpSocket:
                port: 27017
              initialDelaySeconds: 15
              timeoutSeconds: 1
            env:
            - name: MONGODB_USER
              value: "${MONGODB_USER}"
            - name: MONGODB_PASSWORD
              value: "${MONGODB_PASSWORD}"
            - name: MONGODB_DATABASE
              value: "${MONGODB_DATABASE}"
            - name: MONGODB_ADMIN_PASSWORD
              value: "${MONGODB_ADMIN_PASSWORD}"
            - name: MONGODB_REPLICA_NAME
              value: "${MONGODB_REPLICA_NAME}"
            - name: MONGODB_SERVICE_NAME
              value: "${MONGODB_SERVICE_NAME}"
            - name: MONGODB_KEYFILE_VALUE
              value: "${MONGODB_KEYFILE_VALUE}"
            ports:
            - containerPort: 27017
  ----
  ====
  
  [[mongo-creating-headless-service]]
  === Creating a Headless Service
  
  The `initiate` argument in the xref:example-deployment-config[container specification
  above] instructs the container to first discover all running member pods within
  the MongoDB cluster. To achieve this, a _headless service_ is defined named
  *mongodb* in the example template.
  