Bläddra i källkod

fix host in URLs, replace hardcoded suffix with template add services

Stavros kois 2 år sedan
förälder
incheckning
7cddad8903

+ 5 - 1
charts/minio/1.6.58/templates/_logsearchapi.tpl

@@ -2,6 +2,10 @@
 {{- print "minio/operator:v4.5.3" -}}
 {{- end -}}
 
+{{- define "logsearchapi.nameSuffix" -}}
+{{- print "logsearchapi" -}}
+{{- end -}}
+
 {{- define "logsearchapi.command" -}}
 {{- print "/logsearchapi" -}}
 {{- end -}}
@@ -16,7 +20,7 @@
 {{- $postgresSecretName := (include "postgres.secretName" .) -}}
 {{- $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_AUTH_TOKEN" "valueFromSecret" true "secretName" $secretName "secretKey" "queryToken") -}}
 {{- $envList = mustAppend $envList (dict "name" "LOGSEARCH_AUDIT_AUTH_TOKEN" "valueFromSecret" true "secretName" $secretName "secretKey" "auditToken") -}}
-{{- $envList = mustAppend $envList (dict "name" "LOGSEARCH_PG_CONN_STR" "valueFromSecret" true "secretName" $postgresSecretName "secretKey" "postgresURL") -}}
+{{- $envList = mustAppend $envList (dict "name" "LOGSEARCH_PG_CONN_STR" "valueFromSecret" true "secretName" $secretName "secretKey" "postgresURL") -}}
 {{- $envList = mustAppend $envList (dict "name" "LOGSEARCH_DISK_CAPACITY_GB" "value" .Values.logsearchapi.diskCapacityGB) -}}
 {{- include "common.containers.environmentVariables" (dict "environmentVariables" $envList) -}}
 {{- end -}}

+ 4 - 0
charts/minio/1.6.58/templates/_postgres.tpl

@@ -2,6 +2,10 @@
 {{- print "postgres:14.5" -}}
 {{- end -}}
 
+{{- define "postgres.nameSuffix" -}}
+{{- print "postgres" -}}
+{{- end -}}
+
 {{- define "postgres.secretName" -}}
 {{- print "postgres-details" -}}
 {{- end -}}

+ 1 - 1
charts/minio/1.6.58/templates/deployment.yaml

@@ -68,7 +68,7 @@ spec:
             {{ $webhookID := (printf "ix-%v" (randAlphaNum 5)) }}
             {{ $logsearchSecretName := (include "logsearchapi.secretName" .) }}
             {{ $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_AUTH_TOKEN" "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "queryToken") }}
-            {{ $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_URL" "value" "http://localhost:8080") }}
+            {{ $envList = mustAppend $envList (dict "name" "MINIO_LOG_QUERY_URL" "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "logQueryURL") }}
             {{ $envList = mustAppend $envList (dict "name" (printf "MINIO_AUDIT_WEBHOOK_ENDPOINT_%v" $webhookID) "valueFromSecret" true "secretName" $logsearchSecretName "secretKey" "webhookURL") }}
             {{ $envList = mustAppend $envList (dict "name" (printf "MINIO_AUDIT_WEBHOOK_ENABLE_%v" $webhookID) "value" "on") }}
             {{ end }}

+ 1 - 1
charts/minio/1.6.58/templates/logsearchapi-deployment.yaml

@@ -1,6 +1,6 @@
 {{ if .Values.logsearchapi.enabled }}
 {{ $values := (. | mustDeepCopy) }}
-{{ $_ := set $values "common" (dict "nameSuffix" "logsearchapi") }}
+{{ $_ := set $values "common" (dict "nameSuffix" (include "logsearchapi.nameSuffix" .)) }}
 {{ include "common.deployment.common_config" $values | nindent 0 }}
 spec: {{ include "common.deployment.common_spec" $values | nindent 2 }}
   template: {{ include "common.deployment.pod.metadata" $values | nindent 4 }}

+ 4 - 1
charts/minio/1.6.58/templates/logsearchapi-secret.yaml

@@ -1,4 +1,6 @@
 {{ if .Values.logsearchapi.enabled }}
+{{ $logSearchValues := (. | mustDeepCopy) }}
+{{ $_ := set $logSearchValues "common" (dict "nameSuffix" (include "logsearchapi.nameSuffix" .)) }}
 apiVersion: v1
 kind: Secret
 metadata:
@@ -11,5 +13,6 @@ data:
   {{ $auditToken := randAlphaNum 32 }}
   auditToken: {{ $auditToken | b64enc }}
   queryToken: {{ randAlphaNum 32 | b64enc }}
-  webhookURL: {{ (printf "http://localhost:8080/api/ingest?token=%v" $auditToken) | b64enc }}
+  logQueryURL: {{ (printf "http://%v:8080" (include "common.names.fullname" $logSearchValues)) | b64enc }}
+  webhookURL: {{ (printf "http://%v:8080/api/ingest?token=%v" (include "common.names.fullname" $logSearchValues) $auditToken) | b64enc }}
 {{ end }}

+ 6 - 0
charts/minio/1.6.58/templates/logsearchapi-service.yaml

@@ -0,0 +1,6 @@
+{{ $ports := list }}
+{{ $ports = mustAppend $ports (dict "name" "logsearchapi-tcp" "port" 8080 "targetPort" 8080) }}
+{{ $values := (. | mustDeepCopy) }}
+{{ $_ := set $values "common" (dict "nameSuffix" (include "logsearchapi.nameSuffix" .)) }}
+{{ $_1 := set $values "commonService" (dict "type" "ClusterIP" "ports" $ports ) }}
+{{ include "common.classes.service" $values }}

+ 3 - 1
charts/minio/1.6.58/templates/postgres-secret.yaml

@@ -1,5 +1,7 @@
 {{ if .Values.logsearchapi.enabled }}
 {{ $dbPass := randAlphaNum 32 | b64enc }}
+{{ $pgValues := (. | mustDeepCopy) }}
+{{ $_ := set $pgValues "common" (dict "nameSuffix" (include "postgres.nameSuffix" .)) }}
 apiVersion: v1
 kind: Secret
 metadata:
@@ -13,5 +15,5 @@ data:
   {{ else }}
   db_password: {{ $dbPass }}
   {{ end }}
-  postgresURL: {{ printf "postgres://%v:%v:5432/%v?sslmode=disable" (include "postgres.dbUser" .) ($dbPass | b64dec) (include "postgres.dbName" .)  }}
+  postgresURL: {{ printf "postgres://%v:%v@%v:5432/%v?sslmode=disable" (include "postgres.dbUser" .) ($dbPass | b64dec) (include "common.names.fullname" $pgValues) (include "postgres.dbName" .)  }}
 {{ end }}

+ 6 - 0
charts/minio/1.6.58/templates/postgres-service.yaml

@@ -0,0 +1,6 @@
+{{ $ports := list }}
+{{ $ports = mustAppend $ports (dict "name" "postgres-tcp" "port" 5432 "targetPort" 5432) }}
+{{ $values := (. | mustDeepCopy) }}
+{{ $_ := set $values "common" (dict "nameSuffix" (include "postgres.nameSuffix" .)) }}
+{{ $_1 := set $values "commonService" (dict "type" "ClusterIP" "ports" $ports ) }}
+{{ include "common.classes.service" $values }}