diff --git a/README.md b/README.md index 9b81e22..bafb6c2 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ helm search repo ethpandaops-general-helm-charts ## List of charts - [`cloudflare-tunnel`](charts/cloudflare-tunnel) +- [`chproxy`](charts/chproxy) +- [`raw-configmap`](charts/raw-configmap) ## Development diff --git a/charts/chproxy/.helmignore b/charts/chproxy/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/chproxy/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/chproxy/Chart.yaml b/charts/chproxy/Chart.yaml new file mode 100644 index 0000000..c1b77a5 --- /dev/null +++ b/charts/chproxy/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: chproxy +description: HTTP proxy and load balancer for ClickHouse +home: https://www.chproxy.org +type: application +version: 0.0.1 +maintainers: + - name: savid + email: andrew.davis@ethereum.org diff --git a/charts/chproxy/README.md b/charts/chproxy/README.md new file mode 100644 index 0000000..91cd36d --- /dev/null +++ b/charts/chproxy/README.md @@ -0,0 +1,83 @@ + +# chproxy + +![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) + +HTTP proxy and load balancer for ClickHouse + +**Homepage:** + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | Affinity configuration for pods | +| annotations | object | `{}` | Annotations for the Deployment | +| args | list | `[]` | Command arguments | +| autoscaling.enabled | bool | `false` | Autoscaling configuration | +| autoscaling.maxReplicas | int | `3` | Maximum number of replicas | +| autoscaling.minReplicas | int | `2` | Minimum number of replicas | +| autoscaling.targetCPUUtilizationPercentage | int | `85` | Target CPU utilization percentage | +| config.clusters[0].name | string | `"default"` | | +| config.clusters[0].nodes[0] | string | `"clickhouse:8123"` | | +| config.clusters[0].scheme | string | `"http"` | | +| config.clusters[0].users[0].name | string | `"default"` | | +| config.hack_me_please | bool | `true` | | +| config.log_debug | bool | `false` | | +| config.server.http.listen_addr | string | `":8080"` | | +| config.server.http.read_timeout | string | `"5m"` | | +| config.server.proxy.enable | bool | `true` | | +| config.server.proxy.header | string | `"CF-Connecting-IP"` | | +| config.users[0].name | string | `"default"` | | +| config.users[0].to_cluster | string | `"default"` | | +| config.users[0].to_user | string | `"default"` | | +| containerSecurityContext | object | See `values.yaml` | The security context for containers | +| customArgs | list | `[]` | Custom args for the chproxy container | +| customCommand | list | `[]` | Command replacement for the chproxy container | +| extraContainers | list | `[]` | Additional containers | +| extraEnv | list | `[]` | Additional env variables | +| extraPodPorts | list | `[]` | Extra Pod ports | +| extraPorts | list | `[]` | Additional ports. Useful when using extraContainers | +| extraVolumeMounts | list | `[]` | Additional volume mounts | +| extraVolumes | list | `[]` | Additional volumes | +| fullnameOverride | string | `""` | Overrides the chart's computed fullname | +| image.pullPolicy | string | `"IfNotPresent"` | chproxy container pull policy | +| image.repository | string | `"contentsquareplatform/chproxy"` | chproxy container image repository | +| image.tag | string | `"v1.26.5"` | chproxy container image tag | +| imagePullSecrets | list | `[]` | Image pull secrets for Docker images | +| ingress.http.annotations | object | `{}` | Annotations for Ingress | +| ingress.http.enabled | bool | `false` | Ingress resource for the HTTP API | +| ingress.http.hosts[0].host | string | `"chart-example.local"` | | +| ingress.http.hosts[0].paths | list | `[]` | | +| ingress.http.tls | list | `[]` | Ingress TLS | +| initContainers | list | `[]` | Additional init containers | +| lifecycle | object | See `values.yaml` | Lifecycle hooks | +| livenessProbe | object | See `values.yaml` | Liveness probe | +| nameOverride | string | `""` | Overrides the chart's name | +| nodeSelector | object | `{}` | Node selector for pods | +| podAnnotations | object | `{}` | Pod annotations | +| podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created | +| podLabels | object | `{}` | Pod labels | +| priorityClassName | string | `nil` | Pod priority class | +| readinessProbe | object | See `values.yaml` | Readiness probe | +| replicas | int | `1` | Number of replicas | +| resources | object | `{}` | Resource requests and limits | +| secretEnv | object | `{}` | Secret env variables injected via a created secret | +| securityContext | object | See `values.yaml` | The security context for pods | +| service.type | string | `"ClusterIP"` | Service type | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.create | bool | `false` | Specifies whether a service account should be created | +| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | +| serviceMonitor.annotations | object | `{}` | Additional ServiceMonitor annotations | +| serviceMonitor.enabled | bool | `false` | If true, a ServiceMonitor CRD is created for a prometheus operator https://github.com/coreos/prometheus-operator | +| serviceMonitor.interval | string | `"15s"` | ServiceMonitor scrape interval | +| serviceMonitor.labels | object | `{}` | Additional ServiceMonitor labels | +| serviceMonitor.namespace | string | `nil` | Alternative namespace for ServiceMonitor | +| serviceMonitor.path | string | `"/metrics"` | Path to scrape | +| serviceMonitor.relabelings | list | `[]` | ServiceMonitor relabelings | +| serviceMonitor.scheme | string | `"http"` | ServiceMonitor scheme | +| serviceMonitor.scrapeTimeout | string | `"30s"` | ServiceMonitor scrape timeout | +| serviceMonitor.tlsConfig | object | `{}` | ServiceMonitor TLS configuration | +| terminationGracePeriodSeconds | int | `90` | How long to wait until the pod is forcefully terminated | +| tolerations | list | `[]` | Tolerations for pods | +| topologySpreadConstraints | list | `[]` | Topology Spread Constraints for pods | diff --git a/charts/chproxy/README.md.gotmpl b/charts/chproxy/README.md.gotmpl new file mode 100644 index 0000000..5454995 --- /dev/null +++ b/charts/chproxy/README.md.gotmpl @@ -0,0 +1,15 @@ + +{{ template "chart.header" . }} +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }} + +{{ template "chart.description" . }} + +{{ template "chart.homepageLine" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} diff --git a/charts/chproxy/templates/NOTES.txt b/charts/chproxy/templates/NOTES.txt new file mode 100644 index 0000000..d66d314 --- /dev/null +++ b/charts/chproxy/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "chproxy.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "chproxy.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chproxy.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ include "chproxy.httpPort" . }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chproxy.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/charts/chproxy/templates/_helpers.tpl b/charts/chproxy/templates/_helpers.tpl new file mode 100644 index 0000000..620ded1 --- /dev/null +++ b/charts/chproxy/templates/_helpers.tpl @@ -0,0 +1,66 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "chproxy.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "chproxy.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "chproxy.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "chproxy.labels" -}} +helm.sh/chart: {{ include "chproxy.chart" . }} +{{ include "chproxy.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "chproxy.selectorLabels" -}} +app.kubernetes.io/name: {{ include "chproxy.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "chproxy.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "chproxy.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "chproxy.httpPort" -}} +{{ (split ":" .Values.config.server.http.listen_addr)._1 | default "8080" }} +{{- end }} diff --git a/charts/chproxy/templates/configmap.yaml b/charts/chproxy/templates/configmap.yaml new file mode 100644 index 0000000..5c05a0c --- /dev/null +++ b/charts/chproxy/templates/configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "chproxy.fullname" . }} + labels: + {{- include "chproxy.labels" . | nindent 4 }} +data: + config.yaml: |- + {{ toYaml .Values.config | nindent 4 }} diff --git a/charts/chproxy/templates/deployment.yaml b/charts/chproxy/templates/deployment.yaml new file mode 100644 index 0000000..553d154 --- /dev/null +++ b/charts/chproxy/templates/deployment.yaml @@ -0,0 +1,115 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "chproxy.fullname" . }} + labels: + {{- include "chproxy.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.annotations | nindent 4 }} +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + {{- include "chproxy.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "chproxy.selectorLabels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/secrets: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "chproxy.serviceAccountName" . }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} + securityContext: + {{- toYaml .Values.securityContext | nindent 8 }} + initContainers: + {{- if .Values.initContainers }} + {{- toYaml .Values.initContainers | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + {{- if gt (len .Values.customCommand) 0 }} + {{- toYaml .Values.customCommand | nindent 12}} + {{- else }} + - /chproxy + - --config + - /config.yaml + {{- if gt (len .Values.args) 0 }} + {{- toYaml .Values.args | nindent 12}} + {{- end }} + {{- end }} + {{- if gt (len .Values.customArgs) 0 }} + args: + {{- toYaml .Values.customArgs | nindent 12}} + {{- end }} + securityContext: + {{- toYaml .Values.containerSecurityContext | nindent 12 }} + volumeMounts: + - name: config + mountPath: "/config.yaml" + subPath: config.yaml + readOnly: true + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 10 }} + {{- end }} + ports: + - name: http + containerPort: {{ include "chproxy.httpPort" . }} + protocol: TCP + {{- if .Values.extraPodPorts }} + {{ toYaml .Values.extraPodPorts | nindent 10 }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + lifecycle: + {{- toYaml .Values.lifecycle | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + {{- range $key, $value := .Values.secretEnv }} + - name: {{ $key }} + valueFrom: + secretKeyRef: + name: {{ include "chproxy.fullname" $ }}-env + key: {{ $key }} + {{- end }} + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 12 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 8}} + {{- end }} + nodeSelector: + {{- toYaml .Values.nodeSelector | nindent 8 }} + affinity: + {{- toYaml .Values.affinity | nindent 8 }} + tolerations: + {{- toYaml .Values.tolerations | nindent 8 }} + topologySpreadConstraints: + {{- toYaml .Values.topologySpreadConstraints | nindent 8 }} + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + volumes: + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 8}} + {{- end }} + - name: config + configMap: + name: {{ include "chproxy.fullname" . }} diff --git a/charts/chproxy/templates/hpa.yaml b/charts/chproxy/templates/hpa.yaml new file mode 100644 index 0000000..de07de8 --- /dev/null +++ b/charts/chproxy/templates/hpa.yaml @@ -0,0 +1,22 @@ +{{- if .Values.autoscaling.enabled -}} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "chproxy.fullname" . }} + labels: + {{- include "chproxy.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "chproxy.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} +{{- end }} diff --git a/charts/chproxy/templates/ingress.yaml b/charts/chproxy/templates/ingress.yaml new file mode 100644 index 0000000..4b61eca --- /dev/null +++ b/charts/chproxy/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.http.enabled -}} +{{- $fullName := include "chproxy.fullname" . -}} +{{- $svcPort := include "chproxy.httpPort" . -}} +{{- if and .Values.ingress.http.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.http.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.http.annotations "kubernetes.io/ingress.class" .Values.ingress.http.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "chproxy.labels" . | nindent 4 }} + {{- with .Values.ingress.http.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.http.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.http.className }} + {{- end }} + {{- if .Values.ingress.http.tls }} + tls: + {{- range .Values.ingress.http.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.http.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/chproxy/templates/pdb.yaml b/charts/chproxy/templates/pdb.yaml new file mode 100644 index 0000000..c63472d --- /dev/null +++ b/charts/chproxy/templates/pdb.yaml @@ -0,0 +1,18 @@ +{{- if or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable -}} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "chproxy.fullname" . }} + labels: + {{- include "chproxy.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "chproxy.selectorLabels" . | nindent 6 }} + {{- if .Values.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} + {{- end }} +{{- end -}} diff --git a/charts/chproxy/templates/secret.yaml b/charts/chproxy/templates/secret.yaml new file mode 100644 index 0000000..40b9d4a --- /dev/null +++ b/charts/chproxy/templates/secret.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "chproxy.fullname" . }}-env + labels: + {{- include "chproxy.labels" . | nindent 4 }} +data: +{{- range $key, $value := .Values.secretEnv }} + {{ $key }}: {{ $value | b64enc }} +{{- end }} diff --git a/charts/chproxy/templates/service.yaml b/charts/chproxy/templates/service.yaml new file mode 100644 index 0000000..d6cb082 --- /dev/null +++ b/charts/chproxy/templates/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "chproxy.fullname" . }} + labels: + {{- include "chproxy.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ include "chproxy.httpPort" . }} + targetPort: http + protocol: TCP + name: http + {{- if .Values.extraPorts }} + {{ toYaml .Values.extraPorts | nindent 4}} + {{- end }} + selector: + {{- include "chproxy.selectorLabels" . | nindent 4 }} diff --git a/charts/chproxy/templates/serviceaccount.yaml b/charts/chproxy/templates/serviceaccount.yaml new file mode 100644 index 0000000..a81bbaa --- /dev/null +++ b/charts/chproxy/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "chproxy.serviceAccountName" . }} + labels: + {{- include "chproxy.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/chproxy/templates/servicemonitor.yaml b/charts/chproxy/templates/servicemonitor.yaml new file mode 100644 index 0000000..180bd8d --- /dev/null +++ b/charts/chproxy/templates/servicemonitor.yaml @@ -0,0 +1,43 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "chproxy.fullname" . }} + {{- if .Values.serviceMonitor.namespace }} + namespace: {{ .Values.serviceMonitor.namespace }} + {{- end }} + labels: + {{- include "chproxy.labels" . | nindent 4 }} + {{- if .Values.serviceMonitor.labels }} + {{- toYaml .Values.serviceMonitor.labels | nindent 4 }} + {{- end }} + {{- if .Values.serviceMonitor.annotations }} + annotations: + {{ toYaml .Values.serviceMonitor.annotations | nindent 4 }} + {{- end }} +spec: + endpoints: + - interval: {{ .Values.serviceMonitor.interval }} + {{- if .Values.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + {{- end }} + honorLabels: true + port: http + path: {{ .Values.serviceMonitor.path }} + scheme: {{ .Values.serviceMonitor.scheme }} + {{- if .Values.serviceMonitor.tlsConfig }} + tlsConfig: + {{- toYaml .Values.serviceMonitor.tlsConfig | nindent 6 }} + {{- end }} + {{- if .Values.serviceMonitor.relabelings }} + relabelings: + {{- toYaml .Values.serviceMonitor.relabelings | nindent 4 }} + {{- end }} + jobLabel: "{{ .Release.Name }}" + selector: + matchLabels: + {{- include "chproxy.selectorLabels" . | nindent 8 }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} +{{- end }} diff --git a/charts/chproxy/values.yaml b/charts/chproxy/values.yaml new file mode 100644 index 0000000..1d93a33 --- /dev/null +++ b/charts/chproxy/values.yaml @@ -0,0 +1,229 @@ +# -- Overrides the chart's name +nameOverride: "" + +# -- Overrides the chart's computed fullname +fullnameOverride: "" + +# -- Number of replicas +replicas: 1 + +autoscaling: + # -- Autoscaling configuration + enabled: false + # -- Minimum number of replicas + minReplicas: 2 + # -- Maximum number of replicas + maxReplicas: 3 + # -- Target CPU utilization percentage + targetCPUUtilizationPercentage: 85 + +image: + # -- chproxy container image repository + repository: contentsquareplatform/chproxy + # -- chproxy container image tag + tag: v1.26.5 + # -- chproxy container pull policy + pullPolicy: IfNotPresent + +# -- Secret env variables injected via a created secret +secretEnv: {} + +# -- Command arguments +args: [] + +config: + log_debug: false + hack_me_please: true + server: + http: + listen_addr: ":8080" + read_timeout: 5m + proxy: + enable: true + header: CF-Connecting-IP + users: + - name: "default" + to_user: "default" + to_cluster: "default" + clusters: + - name: "default" + scheme: "http" + nodes: ["clickhouse:8123"] + users: + - name: "default" + +ingress: + http: + # -- Ingress resource for the HTTP API + enabled: false + # -- Annotations for Ingress + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- Ingress host + hosts: + - host: chart-example.local + paths: [] + # -- Ingress TLS + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +# -- Custom args for the chproxy container +customArgs: [] + +# -- Command replacement for the chproxy container +customCommand: [] # Only change this if you need to change the default command + +service: + # -- Service type + type: ClusterIP + +# -- Affinity configuration for pods +affinity: {} + +# -- Image pull secrets for Docker images +imagePullSecrets: [] + +# -- Annotations for the Deployment +annotations: {} + +# -- Liveness probe +# @default -- See `values.yaml` +livenessProbe: + httpGet: + path: /metrics + port: http + initialDelaySeconds: 60 + periodSeconds: 120 + +# -- Readiness probe +# @default -- See `values.yaml` +readinessProbe: + httpGet: + path: /metrics + port: http + initialDelaySeconds: 10 + periodSeconds: 10 + +# -- Node selector for pods +nodeSelector: {} + +# -- Pod labels +podLabels: {} + +# -- Pod annotations +podAnnotations: {} + +# -- Extra Pod ports +extraPodPorts: [] + +# -- Pod priority class +priorityClassName: null + +# -- Resource requests and limits +resources: {} +# limits: +# cpu: 500m +# memory: 2Gi +# requests: +# cpu: 300m +# memory: 1Gi + +# -- The security context for pods +# @default -- See `values.yaml` +securityContext: + fsGroup: 10001 + runAsGroup: 10001 + runAsNonRoot: true + runAsUser: 10001 + +# -- The security context for containers +# @default -- See `values.yaml` +containerSecurityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +serviceAccount: + # -- Specifies whether a service account should be created + create: false + # -- Annotations to add to the service account + annotations: {} + # -- The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# -- Lifecycle hooks +# @default -- See `values.yaml` +lifecycle: + preStop: + exec: + command: + - /bin/sleep + - "30" + +# -- How long to wait until the pod is forcefully terminated +terminationGracePeriodSeconds: 90 + +# -- Tolerations for pods +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +tolerations: [] + +# -- Topology Spread Constraints for pods +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/ +topologySpreadConstraints: [] + +# -- Define the PodDisruptionBudget spec +# If not set then a PodDisruptionBudget will not be created +podDisruptionBudget: {} +# minAvailable: 1 +# maxUnavailable: 1 + +# -- Additional init containers +initContainers: [] +# - name: my-init-container +# image: busybox:latest +# command: ['sh', '-c', 'echo hello'] + +# -- Additional containers +extraContainers: [] + +# -- Additional volumes +extraVolumes: [] + +# -- Additional volume mounts +extraVolumeMounts: [] + +# -- Additional ports. Useful when using extraContainers +extraPorts: [] + +# -- Additional env variables +extraEnv: [] + +serviceMonitor: + # -- If true, a ServiceMonitor CRD is created for a prometheus operator + # https://github.com/coreos/prometheus-operator + enabled: false + # -- Path to scrape + path: /metrics + # -- Alternative namespace for ServiceMonitor + namespace: null + # -- Additional ServiceMonitor labels + labels: {} + # -- Additional ServiceMonitor annotations + annotations: {} + # -- ServiceMonitor scrape interval + interval: 15s + # -- ServiceMonitor scheme + scheme: http + # -- ServiceMonitor TLS configuration + tlsConfig: {} + # -- ServiceMonitor scrape timeout + scrapeTimeout: 30s + # -- ServiceMonitor relabelings + relabelings: []