# Amex standard values for couchbase-operator chart.
# Author: Deepjyoti Saha
# Version: 1
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
# Official Chart keys - https://docs.couchbase.com/operator/current/helm-couchbase-config.html


# Select what to install
install:
  couchbaseOperator: true
  admissionController: true
  couchbaseCluster: true
  syncGateway: false


# couchbaseOperator is the controller for couchbase cluster
couchbaseOperator:
  name: "couchbase-operator"
  image:
    repository: couchbase/operator
    tag: 2.2.0
  imagePullPolicy: IfNotPresent
  imagePullSecrets: []
  commandArgs:
    pod-create-timeout: 10m
  resources: {}
  # -- nodeSelector for couchbase-operator pod assignment
  # -- Ref: https://kubernetes.io/docs/user-guide/node-selection/
  ############# DRAFT ###########
  nodeSelector: 
    tier: app
  # -- tolerations of pod match nodes with corresponding taints
  tolerations: []
  # -- RBAC Scope of the Operator. Must be either 'Role' or 'ClusterRole'
  scope: Role

# Deployment.spec.template.spec.nodeSelector

# admissionController is the controller for couchbase admission controller
admissionController:
  name: "couchbase-admission-controller"
  image:
    repository: couchbase/admission-controller
    tag: 2.2.0
  imagePullPolicy: IfNotPresent
  imagePullSecrets: []
  commandArgs:
    validate-secrets: true
    validate-storage-classes: true
    default-file-system-group: true
  resources: {}
  ############# DRAFT ###########
  nodeSelector: 
    tier: app
  tolerations: []
  verboseLogging: false
  runAsNonRoot: true
  # -- Disable Mutating Webhook to skip verification for changes to Couchbase cluster
  disableMutatingWebhook: false
  # -- Disable Validationg Webhook to skip validation of Couchbase cluster creation
  disableValidatingWebhook: false
  # -- RBAC Scope of the Admission Controller. Must be either 'Role' or 'ClusterRole'
  scope: ClusterRole


# admissionService exposes validation to cluster. This service is over https and certs are auto-generated based on serviceName.
admissionService:  
  name:
  port: 443
  targetPort: 8443  


# admissionCA can be used to override the Certs that will be used to sign the keys used by the admission operator.
admissionCA:
  cert:
  key:
  expiration: 365

# secret with client certs mounted within the admission controller.
admissionSecret:
  name:
  cert:
  key:

# -- coredns service config to be applied to
# pods for cross-cluster deployments
coredns:
  # -- name kubernete service which exposes nameserver (ie coredns)
  service:
  # -- search list for host-name lookup
  searches:
  - default.svc.cluster.local
  - svc.cluster.local
  - cluster.local



# -- CouchbaseBackups runs a job which preserves data into backups
backups: {}
#
# Uncomment to create a backup named 'my-backup'
#
#   default-backup:
#     name: my-backup
#     strategy: full_incremental
#     full:
#       schedule: "0 3 * * 0"
#     incremental:
#       schedule: "0 3 * * 1-6"
#     successfulJobsHistoryLimit: 1
#     failedJobsHistoryLimit: 3
#     backOffLimit: 2
#     backupRetention: 24h
#     logRetention: 24h
#     size: 5Gi


# CouchbaseBackupRestore restores data from backups
#backuprestores: {}
#
# Uncomment to create a restore named 'my-restore'
#
# default-restore:
#   name: my-restore
#   backup: my-backup
#   repo: cb-example-2020-11-12T19_00_03
#   start:
#     int: 1
#     str: oldest
#   end:
#     int: 1
#     str: latest
#   backOffLimit: 2
#   logRetention: 24h  

# RBAC users to create
# (requires couchbase server 6.5.0 and higher)
users: {}
#
# Uncomment to create an example user named 'developer'
#
# developer:
#   # password to use for user authentication
#   # (alternatively use authSecret)
#   password: password
#   # optional secret to use containing user password
#   authSecret:
#   # domain of user authentication
#   authDomain: local
#   # roles attributed to group
#   roles:
#     - name: bucket_admin
#       bucket: default

# TLS Certs that will be used to encrypt traffic between operator and couchbase
tls:
  # -- enable to auto create certs
  generate: true
  # -- Expiry time of CA in days for generated certs
  expiration: 365
  # -- This field defines whether node-to-node encryption is enabled.
  # Must be either 'All' or 'ControlPlaneOnly'.
  # If not specified, data between Couchbase Server nodes is not encrypted.
  nodeToNodeEncryption:

##################### BUCKETS #####################

buckets:
  default:
    compressionMode: passive
    conflictResolution: seqno
    enableFlush: false
    enableIndexReplica: false
    evictionPolicy: valueOnly
    ioPriority: low
    kind: CouchbaseBucket
    memoryQuota: 100Mi
    replicas: 1

##################### CLUSTER #####################


cluster:
  name: cb-example
  image: registry.connect.redhat.com/couchbase/server:6.6.2
#  image: couchbase/server:6.6.2
  paused: false
  softwareUpdateNotifications: false  
  enableOnlineVolumeExpansion: false
  enablePreviewScaling: false
  hibernate: false  
  antiAffinity: true
  autoResourceAllocation:
    cpuLimits: '2'
    cpuRequests: '1'
    enabled: false
    overheadPercent: 25

  backup:
    image: couchbase/operator-backup:1.1.0
    managed: false

  buckets:
    managed: false



  networking:
#    networkPlatform: Istio 
    adminConsoleServiceTemplate:
      spec:
        publishNotReadyAddresses: false
        type: NodePort
    adminConsoleServices:
    - data
    disableUIOverHTTP: false
    disableUIOverHTTPS: false
    exposeAdminConsole: true
    exposedFeatureServiceTemplate:
      spec:
        publishNotReadyAddresses: false
        type: NodePort
    exposedFeatures:
    - client
    - xdcr
#    tls:
#      static:
#        serverSecret: tls-operator-secret
#        operatorSecret: tls-server-secret     

  security:
    adminSecret: ''
    username: Administrator
    password: password
    rbac:
      managed: false
#  securityContext:
#    fsGroup: 1000
#    runAsNonRoot: true
#    runAsUser: 1000
#    sysctls: []


  cluster:
    clusterName: cb-example
    dataServiceMemoryQuota: 256Mi
    indexServiceMemoryQuota: 256Mi
    eventingServiceMemoryQuota: 256Mi
    analyticsServiceMemoryQuota: 1Gi
    searchServiceMemoryQuota: 256Mi

    autoCompaction:
      databaseFragmentationThreshold:
        percent: 30
      parallelCompaction: false
      timeWindow:
        abortCompactionOutsideWindow: false
      tombstonePurgeInterval: 72h
      viewFragmentationThreshold:
        percent: 30

    autoFailoverMaxCount: 1
    autoFailoverOnDataDiskIssues: true
    autoFailoverOnDataDiskIssuesTimePeriod: 10s
    autoFailoverServerGroup: false
    autoFailoverTimeout: 10s

    indexStorageSetting: memory_optimized
    indexer:
      logLevel: info
      maxRollbackPoints: 2
      memorySnapshotInterval: 200ms
      stableSnapshotInterval: 5s
      storageMode: memory_optimized

    query:
      backfillEnabled: true
      temporarySpace: 1Gi
      temporarySpaceUnlimited: false

  servers:
    default:  # Name can be changed to mention different types of offering
      size: 2    
      autoscaleEnabled: false
      env: []
      envFrom: []
      pod:
        spec: {}
      services:
      - data
      - index
      - query
      volumeMounts:
        default: couchbase


  volumeClaimTemplates:
  - metadata:
      name: couchbase
    spec:
      storageClassName: cb-csi-new-sc  # Storage Class Name
      resources:
        requests:
          storage: 150Gi

  xdcr:
    managed: false


  logging:
    audit:
      enabled: false
      garbageCollection:
        sidecar:
          age: 1h
          enabled: false
          image: busybox:1.32.1
          interval: 20m
      rotation:
        interval: 15m
        size: 20Mi
    server:
      configurationName: fluent-bit-config
      enabled: false
      manageConfiguration: true
      sidecar:
        configurationMountPath: /fluent-bit/config/
        image: couchbase/fluent-bit:1.0.1

  monitoring:
    prometheus:
      enabled: false





