open-match icon indicating copy to clipboard operation
open-match copied to clipboard

sentinel less redis connection

Open dzmitry-lahoda opened this issue 2 years ago • 5 comments

as of now in om yaml

      sentinelPort: 26379
      sentinelMaster: om-redis-master
      sentinelHostname: open-match-redis
      sentinelUsePassword: false
      usePassword: false

so I can use Redis with and only with sentinel setup.

could I have no sentinel Redis? I assume that some Go codes to be changed in OM on how they connect to Redis. This can be first step to https://github.com/googleforgames/open-match/issues/1409

dzmitry-lahoda avatar Oct 02 '21 20:10 dzmitry-lahoda

hm, may that is possible, so need to check

https://github.com/googleforgames/open-match/blob/6f46731b156f5ada463b309e0a35774b11255323/install/helm/open-match/Chart.yaml#L23

https://github.com/googleforgames/open-match/blob/2e03c1a1976fa1ed7dce29c55b426645e2cf20ac/install/helm/open-match/values.yaml#L108

dzmitry-lahoda avatar Oct 02 '21 20:10 dzmitry-lahoda

will post here about success of my try

dzmitry-lahoda avatar Oct 02 '21 20:10 dzmitry-lahoda

You can connect to Redis without sentinel using this config (sorry it's not well documented)

redis:
        hostname: <redishost>
        port: <redisport>

Be sure to remove all the redis config parameters that contain 'sentinel' in the key name. The 'usePassword' and 'pool' config params are still required so be sure to set them appropriately.

joeholley avatar Oct 04 '21 03:10 joeholley

default config

    redis:
      sentinelPort:
      sentinelMaster:
      sentinelHostname:
      sentinelUsePassword:
      hostname: aom-redis-stage.redis.cache.windows.net
      port: 6379
      usePassword: true
      passwordPath: /opt/bitnami/redis/secrets/redis-password
      pool:
        maxIdle: 200
        maxActive: 0
        idleTimeout: 0
        healthCheckTimeout: 300ms

deploy az redis with password and export its stuff into secret + override

# NOTE: open match provides basic config via k8s kustomize repo,
# and we override here
# not very neat - like recursion, but there is not other way (cannot provied as separate config and then merge)
resource "kubernetes_config_map" "open_match_configmap_override" {
   metadata {
      namespace = "open-match"
      name = "open-match-configmap-override"
    }
    lifecycle {
      ignore_changes = [
        metadata
      ]
    }

    data = {
       "matchmaker_config_override.yaml" = <<EOF
        redis:
          hostname: ${azurerm_redis_cache.aom.hostname}
          port: ${azurerm_redis_cache.aom.port}
          usePassword: true
          passwordPath: /opt/bitnami/redis/secrets/redis-password
          pool:
            maxIdle: 200
            maxActive: 0
            idleTimeout: 0
            healthCheckTimeout: 300ms
        EOF
    }
}

resource "kubernetes_secret" "aom_redis_password" {
    metadata {
      namespace = "open-match"
      name = "aom-redis-password"
    }

    lifecycle {
      ignore_changes = [
        metadata
      ]
    }

    data = {
      "redis-password" = azurerm_redis_cache.aom.primary_access_key
    }
}

patch deployments with password like that

apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: open-match
  name: open-match-backend
spec:
  template:
    spec:
      volumes:
        - name: aom-redis-password
          secret:
            secretName: aom-redis-password
      containers:
      - name: open-match-backend
        volumeMounts:
          - name: aom-redis-password
            mountPath: /opt/bitnami/redis/secrets/

dzmitry-lahoda avatar Oct 28 '21 16:10 dzmitry-lahoda

it worked well, nodes connected. also i have installed from yaml, so made redis replica to 0, so still having redis noise in yaml, need to clear up or generate stuff from helm. so would be nice to have redis less yaml variant. and some predefined secret mount path to ease override

dzmitry-lahoda avatar Oct 28 '21 16:10 dzmitry-lahoda

Seems resolved. Closing

syntxerror avatar Sep 28 '22 15:09 syntxerror