diff --git a/HelmChart/Public/oneuptime/templates/clickhouse-service.yaml b/HelmChart/Public/oneuptime/templates/clickhouse-service.yaml new file mode 100644 index 0000000000..f6844fba86 --- /dev/null +++ b/HelmChart/Public/oneuptime/templates/clickhouse-service.yaml @@ -0,0 +1,97 @@ +{{- if .Values.clickhouse.enabled }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-clickhouse + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: clickhouse + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: clickhouse + app.kubernetes.io/part-of: clickhouse + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: {{ .Values.clickhouse.service.type }} + ports: + - port: {{ .Values.clickhouse.service.ports.http | int }} + targetPort: http + protocol: TCP + name: http + - port: {{ .Values.clickhouse.service.ports.tcp | int }} + targetPort: tcp + protocol: TCP + name: tcp + - port: {{ .Values.clickhouse.service.ports.mysql | int }} + targetPort: mysql + protocol: TCP + name: mysql + - port: {{ .Values.clickhouse.service.ports.postgresql | int }} + targetPort: postgresql + protocol: TCP + name: postgresql + - port: {{ .Values.clickhouse.service.ports.interserver | int }} + targetPort: interserver + protocol: TCP + name: interserver + selector: + app.kubernetes.io/name: clickhouse + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: clickhouse + app.kubernetes.io/part-of: clickhouse + +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-clickhouse-headless + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: clickhouse + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: clickhouse + app.kubernetes.io/part-of: clickhouse + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: ClusterIP + clusterIP: None + ports: + - port: {{ .Values.clickhouse.service.ports.http | int }} + targetPort: http + protocol: TCP + name: http + - port: {{ .Values.clickhouse.service.ports.tcp | int }} + targetPort: tcp + protocol: TCP + name: tcp + - port: {{ .Values.clickhouse.service.ports.mysql | int }} + targetPort: mysql + protocol: TCP + name: mysql + - port: {{ .Values.clickhouse.service.ports.postgresql | int }} + targetPort: postgresql + protocol: TCP + name: postgresql + - port: {{ .Values.clickhouse.service.ports.interserver | int }} + targetPort: interserver + protocol: TCP + name: interserver + selector: + app.kubernetes.io/name: clickhouse + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: clickhouse + app.kubernetes.io/part-of: clickhouse + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Release.Name }}-clickhouse + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: clickhouse + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: clickhouse + app.kubernetes.io/part-of: clickhouse + app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} diff --git a/HelmChart/Public/oneuptime/templates/secrets.yaml b/HelmChart/Public/oneuptime/templates/secrets.yaml index a7841f99c1..c136dd6380 100644 --- a/HelmChart/Public/oneuptime/templates/secrets.yaml +++ b/HelmChart/Public/oneuptime/templates/secrets.yaml @@ -164,6 +164,43 @@ stringData: {{- end }} --- +{{- if .Values.clickhouse.enabled }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-clickhouse + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: clickhouse + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: clickhouse + app.kubernetes.io/part-of: clickhouse + app.kubernetes.io/managed-by: {{ .Release.Service }} + annotations: + "helm.sh/resource-policy": "keep" +type: Opaque +stringData: + {{- if .Release.IsUpgrade }} + {{- if .Values.clickhouse.auth.password }} + admin-password: {{ .Values.clickhouse.auth.password | quote }} + {{- else }} + {{- if (index (lookup "v1" "Secret" $.Release.Namespace (printf "%s-clickhouse" $.Release.Name)).data "admin-password") }} + admin-password: {{ index (lookup "v1" "Secret" $.Release.Namespace (printf "%s-clickhouse" $.Release.Name)).data "admin-password" | b64dec }} + {{- else }} + admin-password: {{ randAlphaNum 32 | quote }} + {{- end }} + {{- end }} + {{- else }} + {{- if .Values.clickhouse.auth.password }} + admin-password: {{ .Values.clickhouse.auth.password | quote }} + {{- else }} + admin-password: {{ randAlphaNum 32 | quote }} + {{- end }} + {{- end }} +{{- end }} + +--- + # Clickhouse Configuration {{- if not $.Values.clickhouse.enabled }}