# yaml-language-server: $schema=./values.schema.json

# Define the main controller (deployment) for the OpenGist application.
controllers:
  main:
    # Deployment strategy for OpenGist. "Recreate" is used because of local SQLite database persistence.
    strategy: Recreate
    containers:
      main:
        image:
          # Container image repository.
          repository: ghcr.io/thomiceli/opengist
          # Container image tag. Recommended to pin a specific version.
          tag: "{{ .Chart.AppVersion }}"
          # Image pull policy. IfNotPresent is generally recommended.
          pullPolicy: IfNotPresent
        env:
          # Set log level: one of "debug", "info", "warn", "error", "fatal". "info" is standard for production.
          OG_LOG_LEVEL: "info"
          # Set log output destination(s). "stdout" recommended for Kubernetes.
          OG_LOG_OUTPUT: "stdout"

          # # Public URL to access OpenGist.
          # OG_EXTERNAL_URL: ""

          # # Path to the directory where OpenGist stores its data.
          # OG_OPENGIST_HOME: ""

          # # Secret key used for session store & encrypt MFA data on database.
          # OG_SECRET_KEY: ""

          # # URI of the database.
          # OG_DB_URI: "opengist.db"

          # # Enable or disable the code search index (true or false).
          # OG_INDEX: "true"

          # # Name of the directory where the code search index is stored.
          # OG_INDEX_DIRNAME: "opengist.index"

          # # Default branch name used by OpenGist when initializing Git repositories. If not set, uses the Git default branch name.
          # OG_GIT_DEFAULT_BRANCH: ""

          # # Set the journal mode for SQLite.
          # OG_SQLITE_JOURNAL_MODE: "WAL"

          # # The host on which the HTTP server should bind.
          # OG_HTTP_HOST: "0.0.0.0"

          # # The port on which the HTTP server should listen.
          # OG_HTTP_PORT: "6157"

          # # Enable or disable git operations (clone, pull, push) via HTTP (true or false).
          # OG_HTTP_GIT_ENABLED: "true"

          # # Enable or disable git operations (clone, pull, push) via SSH (true or false).
          # OG_SSH_GIT_ENABLED: "true"

          # # The host on which the SSH server should bind.
          # OG_SSH_HOST: "0.0.0.0"

          # # The port on which the SSH server should listen.
          # OG_SSH_PORT: "2222"

          # # Public domain for the Git SSH connection, if it has to be different from the HTTP one. If not set, uses the URL from the request.
          # OG_SSH_EXTERNAL_DOMAIN: ""

          # # Path to the SSH key generation executable.
          # OG_SSH_KEYGEN_EXECUTABLE: "ssh-keygen"

          # # The client key for the GitHub OAuth application.
          # OG_GITHUB_CLIENT_KEY: ""

          # # The secret for the GitHub OAuth application.
          # OG_GITHUB_SECRET: ""

          # # The client key for the GitLab OAuth application.
          # OG_GITLAB_CLIENT_KEY: ""

          # # The secret for the GitLab OAuth application.
          # OG_GITLAB_SECRET: ""

          # # The URL of the GitLab instance.
          # OG_GITLAB_URL: "https://gitlab.com/"

          # # The name of the GitLab instance. It is displayed in the OAuth login button.
          # OG_GITLAB_NAME: "GitLab"

          # # The client key for the Gitea OAuth application.
          # OG_GITEA_CLIENT_KEY: ""

          # # The secret for the Gitea OAuth application.
          # OG_GITEA_SECRET: ""

          # # The URL of the Gitea instance.
          # OG_GITEA_URL: "https://gitea.com/"

          # # The name of the Gitea instance. It is displayed in the OAuth login button.
          # OG_GITEA_NAME: "Gitea"

          # # The client key for the OpenID application.
          # OG_OIDC_CLIENT_KEY: ""

          # # The secret for the OpenID application.
          # OG_OIDC_SECRET: ""

          # # Discovery endpoint of the OpenID provider.
          # OG_OIDC_DISCOVERY_URL: ""

          # # The name of your instance, to be displayed in the tab title.
          # OG_CUSTOM_NAME: ""

          # # Path to an image, relative to $opengist-home/custom.
          # OG_CUSTOM_LOGO: ""

          # # Path to an image, relative to $opengist-home/custom.
          # OG_CUSTOM_FAVICON: ""

          # # Path and name to custom links.
          # OG_CUSTOM_STATIC_LINK_#_(PATH,NAME): ""

        envFrom:
          - secretRef:
              name: opengist-secrets
              optional: true

# Define the service (network access) for the OpenGist application.
service:
  main:
    controller: main
    type: ClusterIP
    ports:
      http:
        # External HTTP port to access the web interface.
        port: 80
        # Internal container HTTP port.
        targetPort: 6157
        protocol: TCP
      ssh:
        # Enable Git over SSH access.
        enabled: true
        # External SSH port for Git operations.
        port: 22
        # Internal container SSH port.
        targetPort: 2222

# Define Ingress to expose OpenGist over the internet securely.
ingress:
  main:
    # Enable or disable the Ingress resource.
    enabled: false
    hosts:
      - host: gist.example.com
        # Configure paths served by this ingress host.
        paths:
          - path: /
            # Path matching strategy.
            pathType: Prefix
            service:
              # Target service (must match the defined service name).
              identifier: main
              port: http
    tls:
      - hosts:
          - gist.example.com
        # Kubernetes Secret that holds the TLS certificate and key.
        secretName: gist-tls-cert

# Define persistence (storage) for OpenGist.
persistence:

  # -> Use this if you need to create a PVC. If you want to use an existing claim, see below
  # opengist:
  #   # Enable persistence to save OpenGist data between restarts.
  #   enabled: true
  #   # # Type of storage to use. "persistentVolumeClaim" for standard PVC.
  #   type: persistentVolumeClaim
  #   # # Access mode for the storage. "ReadWriteOnce" is typical.
  #   accessMode: ReadWriteOnce
  #   # # Size of the persistent storage requested.
  #   size: 20Gi
  #   # # Storage class to use. Set to your cluster's preferred class (e.g., "fast-storage").
  #   storageClass: ""
  #   globalMounts:
  #     - # Path inside the container where the volume will be mounted.
  #       path: /opengist

  # -> Use an existing claim
  # opengist:
  #   # Enable persistence to save OpenGist data between restarts.
  #   enabled: true
  #   # # Type of storage to use. "persistentVolumeClaim" for standard PVC.
  #   type: persistentVolumeClaim

  #   # Your PC name
  #   existingClaim: ""

  #   globalMounts:
  #     - # Path inside the container where the volume will be mounted.
  #       path: /opengist
