charts icon indicating copy to clipboard operation
charts copied to clipboard

[bitnami/gitea] OAuth2 Provider Configuration

Open ikamii opened this issue 1 year ago • 3 comments

Name and Version

bitnami/gitea

What is the problem this feature will solve?

I am not sure if it's already possible to configure an OAuth2 provider via values.yaml while deploying this chart, like in gitea/gitea chart. If there is a feature for this, please explain me. Thank you in advance!

example:

oauth:
    []
    # - name: 'OAuth 1'
    #   provider:
    #   key:
    #   secret:
    #   existingSecret:
    #   autoDiscoverUrl:
    #   useCustomUrls:
    #   customAuthUrl:
    #   customTokenUrl:
    #   customProfileUrl:
    #   customEmailUrl:

What is the feature you are proposing to solve the problem?

It enables to configure OAuth2 authentication Provider while deploying Gitea helm chart.

What alternatives have you considered?

No response

ikamii avatar Jul 30 '24 14:07 ikamii

Hi @ikamii, thanks for sharing your doubts about the Gitea helm chart.

At the moment there is no helper to configure OAuth in the bitnami/gitea helm chart., but taking a look to the upstream implementation I think it could be implemented from your side using initContainers:

initContainers: |
  - name: configure-oauth
    image: {{ include "gitea.image" . }}
    imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
    {{- if .Values.containerSecurityContext.enabled }}
    securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.containerSecurityContext "context" $) | nindent 12 }}
    {{- end }}
    command:
      - /bin/bash
    args:
      - -ec
      - |
        #!/bin/bash

        . /opt/bitnami/scripts/liblog.sh

        OAUTH_NAME="test"
        AUTH_ID=$(gitea admin auth list --vertical-bars | grep -E "\|${OAUTH_NAME}\s+\|" | grep -iE '\|OAuth2\s+\|' | awk -F " "  "{print \$1}")

        if [[ -z "${AUTH_ID}" ]]; then
          info "No oauth configuration found with name '${OAUTH_NAME}'. Installing it now..."
          gitea admin auth add-oauth <<< YOUR CONFIGURATION HERE >>>
          info '...installed.'
        else
          info "Existing oauth configuration with name '${OAUTH_NAME}': '${AUTH_ID}'. Running update to sync settings..."
          gitea admin auth update-oauth --id "${AUTH_ID}" <<< YOUR CONFIGURATION HERE >>>
          info '...sync settings done.'
        fi
    volumeMounts:
      - name: gitea-data
         mountPath: /bitnami/gitea
      - name: empty-dir
         mountPath: /opt/bitnami/gitea
         subPath: app-base-dir

To be perfectly blunt I didn't test it and it could require changes in the bitnami helm chart. Please give it a try and share your findings

fmulero avatar Aug 05 '24 08:08 fmulero

Hi sorry for late reply,

Firstly thank you for your response.

When I copy & paste what you have provided in values.yaml, it doesn't work but it was expected. I might have to test a bit more I think.

If it won't work, I will try to find a solution and implement something in next days.

ikamii avatar Aug 12 '24 08:08 ikamii

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] avatar Aug 28 '24 01:08 github-actions[bot]

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

github-actions[bot] avatar Sep 02 '24 01:09 github-actions[bot]