diff --git a/charts/minio/1.6.58/templates/_logsearchapi.tpl b/charts/minio/1.6.58/templates/_logsearchapi.tpl index 65ec661904..daa060ebd5 100644 --- a/charts/minio/1.6.58/templates/_logsearchapi.tpl +++ b/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 -}} diff --git a/charts/minio/1.6.58/templates/_postgres.tpl b/charts/minio/1.6.58/templates/_postgres.tpl index 039908c79e..af26a05f6b 100644 --- a/charts/minio/1.6.58/templates/_postgres.tpl +++ b/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 -}} diff --git a/charts/minio/1.6.58/templates/deployment.yaml b/charts/minio/1.6.58/templates/deployment.yaml index cdcffe80e4..b60d9faff9 100644 --- a/charts/minio/1.6.58/templates/deployment.yaml +++ b/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 }} diff --git a/charts/minio/1.6.58/templates/logsearchapi-deployment.yaml b/charts/minio/1.6.58/templates/logsearchapi-deployment.yaml index f5a8cf62ab..b7a4854fc4 100644 --- a/charts/minio/1.6.58/templates/logsearchapi-deployment.yaml +++ b/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 }} diff --git a/charts/minio/1.6.58/templates/logsearchapi-secret.yaml b/charts/minio/1.6.58/templates/logsearchapi-secret.yaml index 89d797e2cd..2ae0021637 100644 --- a/charts/minio/1.6.58/templates/logsearchapi-secret.yaml +++ b/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 }} diff --git a/charts/minio/1.6.58/templates/logsearchapi-service.yaml b/charts/minio/1.6.58/templates/logsearchapi-service.yaml new file mode 100644 index 0000000000..f9db1a86cf --- /dev/null +++ b/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 }} diff --git a/charts/minio/1.6.58/templates/postgres-secret.yaml b/charts/minio/1.6.58/templates/postgres-secret.yaml index 2c2cce2852..fad28dfc65 100644 --- a/charts/minio/1.6.58/templates/postgres-secret.yaml +++ b/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 }} diff --git a/charts/minio/1.6.58/templates/postgres-service.yaml b/charts/minio/1.6.58/templates/postgres-service.yaml new file mode 100644 index 0000000000..2bdb1e8a97 --- /dev/null +++ b/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 }}