Browse Source

minio/charts - label fixes (#1788)

* minio - small fixes

* remove duplicate labels

* revert labels

* rename deployments and fix labels

* add minio labels too

* fix one more

* update urls

* always render the same selectors

* default to recreate
Stavros Kois 1 year ago
parent
commit
3c9a6c4908

+ 1 - 1
library/ix-dev/charts/minio/Chart.yaml

@@ -3,7 +3,7 @@ description: High Performance, Kubernetes Native Object Storage
 annotations:
   title: MinIO
 type: application
-version: 1.7.22
+version: 1.7.23
 apiVersion: v2
 appVersion: '2023-03-13'
 kubeVersion: '>=1.16.0-0'

+ 1 - 1
library/ix-dev/charts/minio/questions.yaml

@@ -55,7 +55,7 @@ questions:
     group: "Workload Configuration"
     schema:
       type: string
-      default: "RollingUpdate"
+      default: "Recreate"
       enum:
         - value: "RollingUpdate"
           description: "Create new pods and then kill old ones"

+ 6 - 6
library/ix-dev/charts/minio/templates/deployment.yaml

@@ -4,12 +4,12 @@
 apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
 kind: Deployment
 metadata:
-  name: {{ template "common.names.fullname" . }}
+  name: {{ template "common.names.fullname" . }}-minio
   labels:
     app: {{ template "common.names.name" . }}
-    chart: {{ template "common.names.chart" . }}
     release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
+    app.kubernetes.io/name: {{ template "common.names.name" . }}
+    app.kubernetes.io/instance: {{ .Release.Name }}
   annotations:
     rollme: {{ randAlphaNum 5 | quote }}
 spec:
@@ -20,12 +20,12 @@ spec:
     matchLabels:
       app: {{ template "common.names.name" . }}
       release: {{ .Release.Name }}
+      app.kubernetes.io/name: {{ template "common.names.name" . }}
+      app.kubernetes.io/instance: {{ .Release.Name }}
   template:
     metadata:
       name: {{ template "common.names.fullname" . }}
       labels:
-        app: {{ template "common.names.name" . }}
-        release: {{ .Release.Name }}
         {{- include "common.labels.selectorLabels" . | nindent 8 }}
       annotations: {{ include "common.annotations" . | nindent 8 }}
     spec:
@@ -43,7 +43,7 @@ spec:
           command:
             - sh
             - -c
-            - "until curl $apiURL/status; do sleep 2; done"
+            - "until curl --silent $apiURL/status; do sleep 2; done"
       {{ end }}
       containers:
         - name: {{ .Chart.Name }}

+ 1 - 1
library/ix-dev/charts/minio/templates/logsearchapi-deployment.yaml

@@ -1,6 +1,6 @@
 {{ if .Values.logsearchapi.enabled }}
 {{ $values := (. | mustDeepCopy) }}
-{{ $_ := set $values "common" (dict "nameSuffix" (include "logsearchapi.nameSuffix" .)) }}
+{{ $_ := set $values "common" (dict "nameSuffix" (printf "%s-log" (include "logsearchapi.nameSuffix" .))) }}
 {{ $pg_values := (. | mustDeepCopy) }}
 {{ $_ := set $pg_values "common" (dict "nameSuffix" (include "postgres.nameSuffix" .)) }}
 {{ include "common.deployment.common_config" $values | nindent 0 }}

+ 2 - 4
library/ix-dev/charts/minio/templates/logsearchapi-secret.yaml

@@ -1,4 +1,3 @@
-{{ if .Values.logsearchapi.enabled }}
 {{ $logSearchValues := (. | mustDeepCopy) }}
 {{ $_ := set $logSearchValues "common" (dict "nameSuffix" (include "logsearchapi.nameSuffix" .)) }}
 
@@ -20,6 +19,5 @@ data:
   {{ end }}
   queryToken: {{ $queryToken }}
 
-  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 | b64dec)) | b64enc }}
-{{ end }}
+  logQueryURL: {{ (printf "http://%v-log:8080" (include "common.names.fullname" $logSearchValues)) | b64enc }}
+  webhookURL: {{ (printf "http://%v-log:8080/api/ingest?token=%v" (include "common.names.fullname" $logSearchValues) ($auditToken | b64dec)) | b64enc }}

+ 3 - 1
library/ix-dev/charts/minio/templates/logsearchapi-service.yaml

@@ -1,6 +1,8 @@
+{{ if .Values.logsearchapi.enabled }}
 {{ $ports := list }}
 {{ $ports = mustAppend $ports (dict "name" "logsearchapi-tcp" "port" 8080 "targetPort" 8080) }}
 {{ $values := (. | mustDeepCopy) }}
-{{ $_ := set $values "common" (dict "nameSuffix" (include "logsearchapi.nameSuffix" .)) }}
+{{ $_ := set $values "common" (dict "nameSuffix" (printf "%s-log" (include "logsearchapi.nameSuffix" .))) }}
 {{ $_1 := set $values "commonService" (dict "type" "ClusterIP" "ports" $ports ) }}
 {{ include "common.classes.service" $values }}
+{{ end }}

+ 3 - 1
library/ix-dev/charts/minio/templates/postgres-deployment.yaml

@@ -1,6 +1,6 @@
 {{ if .Values.logsearchapi.enabled }}
 {{ $values := (. | mustDeepCopy) }}
-{{ $_ := set $values "common" (dict "nameSuffix" (include "postgres.nameSuffix" .)) }}
+{{ $_ := set $values "common" (dict "nameSuffix" (printf "%s-pg" (include "postgres.nameSuffix" .))) }}
 {{ include "common.deployment.common_config" $values | nindent 0 }}
 spec:
   replicas: {{ (default 1 .Values.replicas) }}
@@ -8,6 +8,8 @@ spec:
     type: Recreate
   selector:
     matchLabels:
+      app.kubernetes.io/name: {{ template "common.names.name" $values }}
+      app.kubernetes.io/instance: {{ .Release.Name }}-postgres-pg
       app: {{ template "common.names.name" . }}
       release: {{ .Release.Name }}
   template: {{ include "common.deployment.pod.metadata" $values | nindent 4 }}

+ 2 - 4
library/ix-dev/charts/minio/templates/postgres-secret.yaml

@@ -1,4 +1,3 @@
-{{ if .Values.logsearchapi.enabled }}
 {{ $pgValues := (. | mustDeepCopy) }}
 {{ $_ := set $pgValues "common" (dict "nameSuffix" (include "postgres.nameSuffix" .)) }}
 
@@ -17,6 +16,5 @@ data:
   db_user: {{ include "postgres.dbUser" . | b64enc }}
   db_name: {{ include "postgres.dbName" . | b64enc }}
 
-  postgresURL: {{ printf "postgres://%v:%v@%v:5432/%v?sslmode=disable" (include "postgres.dbUser" .) ($dbPass | b64dec) (include "common.names.fullname" $pgValues) (include "postgres.dbName" .) | b64enc }}
-  postgresHost: {{ printf "%v" (include "common.names.fullname" $pgValues) | b64enc }}
-{{ end }}
+  postgresURL: {{ printf "postgres://%v:%v@%v-pg:5432/%v?sslmode=disable" (include "postgres.dbUser" .) ($dbPass | b64dec) (include "common.names.fullname" $pgValues) (include "postgres.dbName" .) | b64enc }}
+  postgresHost: {{ printf "%v-pg" (include "common.names.fullname" $pgValues) | b64enc }}

+ 3 - 1
library/ix-dev/charts/minio/templates/postgres-service.yaml

@@ -1,6 +1,8 @@
+{{ if .Values.logsearchapi.enabled }}
 {{ $ports := list }}
 {{ $ports = mustAppend $ports (dict "name" "postgres-tcp" "port" 5432 "targetPort" 5432) }}
 {{ $values := (. | mustDeepCopy) }}
-{{ $_ := set $values "common" (dict "nameSuffix" (include "postgres.nameSuffix" .)) }}
+{{ $_ := set $values "common" (dict "nameSuffix" (printf "%s-pg" (include "postgres.nameSuffix" .))) }}
 {{ $_1 := set $values "commonService" (dict "type" "ClusterIP" "ports" $ports ) }}
 {{ include "common.classes.service" $values }}
+{{ end }}

+ 4 - 3
library/ix-dev/charts/minio/templates/service.yaml

@@ -1,13 +1,14 @@
-{{ if eq (include "minio.hostNetworking" .) "false" }}
-{{ $svc := .Values.service }}
 {{ $selectors := list }}
 {{ $selectors = mustAppend $selectors (dict "key" "app" "value" (include "common.names.name" .) ) }}
 {{ $selectors = mustAppend $selectors (dict "key" "release" "value" .Release.Name ) }}
+{{ $_1 := set .Values "extraSelectorLabels" $selectors }}
+
+{{ if eq (include "minio.hostNetworking" .) "false" }}
+{{ $svc := .Values.service }}
 {{ $ports := list }}
 {{ $ports = mustAppend $ports (dict "name" "api" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" (.Values.service.nodePort | int)) }}
 {{ $ports = mustAppend $ports (dict "name" "console" "port" $svc.consolePort "nodePort" $svc.consolePort "targetPort" (.Values.service.consolePort | int)) }}
 {{ $params := . }}
 {{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
-{{ $_1 := set .Values "extraSelectorLabels" $selectors }}
 {{ include "common.classes.service" $params }}
 {{ end }}