Skip to content

Commit

Permalink
feat(minio): add MinIO support alongside AWS S3
Browse files Browse the repository at this point in the history
- Updated Chart.yaml to include MinIO as a conditional dependency
- Modified api-deployment.yaml to dynamically set environment variables based on the chosen provider (AWS S3 or MinIO)
- Adjusted values.yaml to include configuration options for MinIO, while keeping existing AWS S3 settings
  • Loading branch information
electrosenpai committed Sep 10, 2024
1 parent d416dc0 commit c64a2cd
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 32 deletions.
4 changes: 4 additions & 0 deletions Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ dependencies:
version: '18.2.1'
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled
- name: minio
version: '5.2.0' # Remplace par la version appropriée de MinIO
repository: https://charts.min.io/
condition: s3.provider == "minio" and s3.enabled == true
75 changes: 51 additions & 24 deletions templates/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,32 +128,59 @@ spec:
name: {{ .Release.Name }}-secrets
key: license
{{ end }}

{{ if .Values.global.s3.enabled }}
- name: LAGO_USE_AWS_S3
value: "true"
{{ if .Values.global.s3.aws.endpoint }}
- name: LAGO_AWS_S3_ENDPOINT
value: {{ .Values.global.s3.aws.endpoint | quote }}
{{ end }}
{{ if or .Values.global.s3.aws.accessKeyId .Values.global.existingSecret }}
- name: LAGO_AWS_S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ include "secret-path" . }}
key: awsS3AccessKeyId
{{ end }}
{{ if or .Values.global.s3.aws.secretAccessKey .Values.global.existingSecret }}
- name: LAGO_AWS_S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "secret-path" . }}
key: awsS3SecretAccessKey
{{ end }}
- name: LAGO_AWS_S3_BUCKET
value: {{ .Values.global.s3.aws.bucket | quote }}
- name: LAGO_AWS_S3_REGION
value: {{ .Values.global.s3.aws.region | quote }}
- name: LAGO_USE_AWS_S3
value: "true"

{{ if .Values.global.s3.aws.endpoint or .Values.global.s3.minio.endpoint }}
- name: LAGO_AWS_S3_ENDPOINT
value: {{ if eq .Values.global.s3.provider "minio" }}
{{ .Values.global.s3.minio.endpoint | quote }}
{{ else }}
{{ .Values.global.s3.aws.endpoint | quote }}
{{ end }}
{{ end }}

{{ if or .Values.global.s3.aws.accessKeyId .Values.global.s3.minio.accessKeyId .Values.global.existingSecret }}
- name: LAGO_AWS_S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ include "secret-path" . }}
key: {{ if eq .Values.global.s3.provider "minio" }}
minioAccessKeyId
{{ else }}
awsS3AccessKeyId
{{ end }}
{{ end }}

{{ if or .Values.global.s3.aws.secretAccessKey .Values.global.s3.minio.secretAccessKey .Values.global.existingSecret }}
- name: LAGO_AWS_S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "secret-path" . }}
key: {{ if eq .Values.global.s3.provider "minio" }}
minioSecretAccessKey
{{ else }}
awsS3SecretAccessKey
{{ end }}
{{ end }}

- name: LAGO_AWS_S3_BUCKET
value: {{ if eq .Values.global.s3.provider "minio" }}
{{ .Values.global.s3.minio.bucket | quote }}
{{ else }}
{{ .Values.global.s3.aws.bucket | quote }}
{{ end }}

- name: LAGO_AWS_S3_REGION
value: {{ if eq .Values.global.s3.provider "minio" }}
{{ .Values.global.s3.minio.region | quote }}
{{ else }}
{{ .Values.global.s3.aws.region | quote }}
{{ end }}
{{ end }}

{{ if .Values.global.smtp.enabled }}
- name: LAGO_FROM_EMAIL
value: {{ .Values.global.smtp.fromEmail }}
Expand Down
25 changes: 17 additions & 8 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,23 @@ global:
segment:
enabled: true
s3:
enabled: false
# accessKeyId and secretAccessKey are not required here if using existingSecret
# aws:
# accessKeyId:
# secretAccessKey:
# bucket:
# region:
# endpoint:
enabled: true
provider: aws # or 'minio' to switch between S3 and MinIO
#aws:
# accessKeyId and secretAccessKey are not required here if using existingSecret
# accessKeyId: "<your-aws-access-key>"
# secretAccessKey: "<your-aws-secret-key>"
# bucket: "<your-aws-bucket>"
# region: "<your-aws-region>"
# endpoint: "https://s3.<region>.amazonaws.com" # Leave empty for default AWS S3 endpoint
#minio:
# enabled: false # Enable this to switch to MinIO
# accessKeyId: "<your-minio-access-key>" # Can be stored in a Kubernetes secret
# secretAccessKey: "<your-minio-secret-key>" # Can be stored in a Kubernetes secret
# bucket: "<your-minio-bucket>"
# region: "us-east-1" # You can keep this default
# endpoint: "http://minio-service.minio-namespace.svc.cluster.local:9000" # Internal URL to access MinIO within your cluster

smtp:
# username and password are not required here if using existingSecret
enabled: false
Expand Down

0 comments on commit c64a2cd

Please sign in to comment.