diff --git a/.github/workflows/helmrelease.yaml b/.github/workflows/helmrelease.yaml new file mode 100644 index 0000000..496432d --- /dev/null +++ b/.github/workflows/helmrelease.yaml @@ -0,0 +1,34 @@ +name: Release Charts + +on: + push: + branches: + - cfg-template + paths: + - "helm/**" + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v2.0 + with: + version: v3.7.1 + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.3.0 + with: + charts_dir: helm + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/proxysql-cluster-controller/Chart.yaml b/helm/proxysql-cluster-controller/Chart.yaml similarity index 100% rename from proxysql-cluster-controller/Chart.yaml rename to helm/proxysql-cluster-controller/Chart.yaml diff --git a/proxysql-cluster-controller/files/hg-scheduler.bash b/helm/proxysql-cluster-controller/files/hg-scheduler.bash similarity index 100% rename from proxysql-cluster-controller/files/hg-scheduler.bash rename to helm/proxysql-cluster-controller/files/hg-scheduler.bash diff --git a/proxysql-cluster-controller/files/probe-proxysql.bash b/helm/proxysql-cluster-controller/files/probe-proxysql.bash similarity index 100% rename from proxysql-cluster-controller/files/probe-proxysql.bash rename to helm/proxysql-cluster-controller/files/probe-proxysql.bash diff --git a/proxysql-cluster-controller/files/proxysql.cnf b/helm/proxysql-cluster-controller/files/proxysql.cnf similarity index 100% rename from proxysql-cluster-controller/files/proxysql.cnf rename to helm/proxysql-cluster-controller/files/proxysql.cnf diff --git a/proxysql-cluster-controller/templates/NOTES.txt b/helm/proxysql-cluster-controller/templates/NOTES.txt similarity index 100% rename from proxysql-cluster-controller/templates/NOTES.txt rename to helm/proxysql-cluster-controller/templates/NOTES.txt diff --git a/proxysql-cluster-controller/templates/_helpers.tpl b/helm/proxysql-cluster-controller/templates/_helpers.tpl similarity index 100% rename from proxysql-cluster-controller/templates/_helpers.tpl rename to helm/proxysql-cluster-controller/templates/_helpers.tpl diff --git a/proxysql-cluster-controller/templates/configmap.yaml b/helm/proxysql-cluster-controller/templates/configmap.yaml similarity index 100% rename from proxysql-cluster-controller/templates/configmap.yaml rename to helm/proxysql-cluster-controller/templates/configmap.yaml diff --git a/proxysql-cluster-controller/templates/ingress.yaml b/helm/proxysql-cluster-controller/templates/ingress.yaml similarity index 100% rename from proxysql-cluster-controller/templates/ingress.yaml rename to helm/proxysql-cluster-controller/templates/ingress.yaml diff --git a/proxysql-cluster-controller/templates/service.yaml b/helm/proxysql-cluster-controller/templates/service.yaml similarity index 100% rename from proxysql-cluster-controller/templates/service.yaml rename to helm/proxysql-cluster-controller/templates/service.yaml diff --git a/proxysql-cluster-controller/templates/statefulset.yaml b/helm/proxysql-cluster-controller/templates/statefulset.yaml similarity index 100% rename from proxysql-cluster-controller/templates/statefulset.yaml rename to helm/proxysql-cluster-controller/templates/statefulset.yaml diff --git a/proxysql-cluster-controller/templates/storage-class.yaml b/helm/proxysql-cluster-controller/templates/storage-class.yaml similarity index 100% rename from proxysql-cluster-controller/templates/storage-class.yaml rename to helm/proxysql-cluster-controller/templates/storage-class.yaml diff --git a/proxysql-cluster-controller/templates/tests/test-connection.yaml b/helm/proxysql-cluster-controller/templates/tests/test-connection.yaml similarity index 100% rename from proxysql-cluster-controller/templates/tests/test-connection.yaml rename to helm/proxysql-cluster-controller/templates/tests/test-connection.yaml diff --git a/proxysql-cluster-controller/values.yaml b/helm/proxysql-cluster-controller/values.yaml similarity index 100% rename from proxysql-cluster-controller/values.yaml rename to helm/proxysql-cluster-controller/values.yaml diff --git a/proxysql-cluster-passive/Chart.yaml b/helm/proxysql-cluster-passive/Chart.yaml similarity index 100% rename from proxysql-cluster-passive/Chart.yaml rename to helm/proxysql-cluster-passive/Chart.yaml diff --git a/proxysql-cluster-passive/files/probe-proxysql.bash b/helm/proxysql-cluster-passive/files/probe-proxysql.bash similarity index 100% rename from proxysql-cluster-passive/files/probe-proxysql.bash rename to helm/proxysql-cluster-passive/files/probe-proxysql.bash diff --git a/proxysql-cluster-passive/files/proxysql.cnf b/helm/proxysql-cluster-passive/files/proxysql.cnf similarity index 100% rename from proxysql-cluster-passive/files/proxysql.cnf rename to helm/proxysql-cluster-passive/files/proxysql.cnf diff --git a/proxysql-cluster-passive/templates/NOTES.txt b/helm/proxysql-cluster-passive/templates/NOTES.txt similarity index 100% rename from proxysql-cluster-passive/templates/NOTES.txt rename to helm/proxysql-cluster-passive/templates/NOTES.txt diff --git a/proxysql-cluster-passive/templates/_helpers.tpl b/helm/proxysql-cluster-passive/templates/_helpers.tpl similarity index 100% rename from proxysql-cluster-passive/templates/_helpers.tpl rename to helm/proxysql-cluster-passive/templates/_helpers.tpl diff --git a/proxysql-cluster-passive/templates/configmap.yaml b/helm/proxysql-cluster-passive/templates/configmap.yaml similarity index 100% rename from proxysql-cluster-passive/templates/configmap.yaml rename to helm/proxysql-cluster-passive/templates/configmap.yaml diff --git a/proxysql-cluster-passive/templates/deployment.yaml b/helm/proxysql-cluster-passive/templates/deployment.yaml similarity index 100% rename from proxysql-cluster-passive/templates/deployment.yaml rename to helm/proxysql-cluster-passive/templates/deployment.yaml diff --git a/proxysql-cluster-passive/templates/ingress.yaml b/helm/proxysql-cluster-passive/templates/ingress.yaml similarity index 100% rename from proxysql-cluster-passive/templates/ingress.yaml rename to helm/proxysql-cluster-passive/templates/ingress.yaml diff --git a/proxysql-cluster-passive/templates/service.yaml b/helm/proxysql-cluster-passive/templates/service.yaml similarity index 100% rename from proxysql-cluster-passive/templates/service.yaml rename to helm/proxysql-cluster-passive/templates/service.yaml diff --git a/proxysql-cluster-passive/templates/tests/test-connection.yaml b/helm/proxysql-cluster-passive/templates/tests/test-connection.yaml similarity index 100% rename from proxysql-cluster-passive/templates/tests/test-connection.yaml rename to helm/proxysql-cluster-passive/templates/tests/test-connection.yaml diff --git a/proxysql-cluster-passive/values.yaml b/helm/proxysql-cluster-passive/values.yaml similarity index 100% rename from proxysql-cluster-passive/values.yaml rename to helm/proxysql-cluster-passive/values.yaml diff --git a/proxysql-cluster/.helmignore b/helm/proxysql-cluster/.helmignore similarity index 100% rename from proxysql-cluster/.helmignore rename to helm/proxysql-cluster/.helmignore diff --git a/proxysql-sidecar-cascade/Chart.yaml b/helm/proxysql-cluster/Chart.yaml similarity index 87% rename from proxysql-sidecar-cascade/Chart.yaml rename to helm/proxysql-cluster/Chart.yaml index a7151c9..c960f0d 100644 --- a/proxysql-sidecar-cascade/Chart.yaml +++ b/helm/proxysql-cluster/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: "1.0" description: A Helm chart to deploy ProxySQL on Kubernetes name: proxysql -version: 0.1.0 +version: 0.2.1 diff --git a/helm/proxysql-cluster/files/cleanlogs.bash b/helm/proxysql-cluster/files/cleanlogs.bash new file mode 100755 index 0000000..de63e0d --- /dev/null +++ b/helm/proxysql-cluster/files/cleanlogs.bash @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +TAIL_CMD=$(($KEEP_FILES+1)) + +cd $DIR + +while true +do + ls -tp | grep -v '/$' | tail -n +$TAIL_CMD | while read line + do + echo "Removing file $line" + rm $line + done + sleep 5 +done diff --git a/proxysql-sidecar-cascade/files/probe-proxysql.bash b/helm/proxysql-cluster/files/probe-proxysql.bash similarity index 84% rename from proxysql-sidecar-cascade/files/probe-proxysql.bash rename to helm/proxysql-cluster/files/probe-proxysql.bash index e2ef0c2..2a300c8 100644 --- a/proxysql-sidecar-cascade/files/probe-proxysql.bash +++ b/helm/proxysql-cluster/files/probe-proxysql.bash @@ -2,7 +2,7 @@ set -e mbin="/usr/bin/mysql" -lcon="-h127.0.0.1 -P6032 -uadmin -padmin" +lcon="-h127.0.0.1 -P6032 -u$ADMIN_USER -p$ADMIN_PASSWORD" opts="-NB" hg0_avail=$($mbin $lcon $opts -e"select count(*) from runtime_mysql_servers where hostgroup_id = 0") diff --git a/proxysql-cluster/templates/NOTES.txt b/helm/proxysql-cluster/templates/NOTES.txt similarity index 100% rename from proxysql-cluster/templates/NOTES.txt rename to helm/proxysql-cluster/templates/NOTES.txt diff --git a/proxysql-sidecar-cascade/templates/_helpers.tpl b/helm/proxysql-cluster/templates/_helpers.tpl similarity index 77% rename from proxysql-sidecar-cascade/templates/_helpers.tpl rename to helm/proxysql-cluster/templates/_helpers.tpl index 50d07f2..0d19ba4 100644 --- a/proxysql-sidecar-cascade/templates/_helpers.tpl +++ b/helm/proxysql-cluster/templates/_helpers.tpl @@ -43,3 +43,24 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} + +{{- define "proxysql.pwd" -}} +{{- if not .password }} +{{- $_ := set . "password" (randAlphaNum 20) }} +{{- end -}} +{{ .password }} +{{- end -}} + +{{- define "proxysql.cfgmapdump" -}} +{{ range $key, $val := . -}} +{{ $key }}={{ $val }} +{{ end -}} +{{- end -}} + +{{- define "proxysql.cfglistdump" -}} +{{- range $idx, $val := . -}} +{ + {{ include "proxysql.cfgmapdump" $val | nindent 2 }} +}, +{{ end -}} +{{- end -}} diff --git a/helm/proxysql-cluster/templates/configmap.yaml b/helm/proxysql-cluster/templates/configmap.yaml new file mode 100644 index 0000000..742ee99 --- /dev/null +++ b/helm/proxysql-cluster/templates/configmap.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "proxysql.fullname" . }}-cm + labels: + {{- include "proxysql.labels" . | nindent 4 }} +data: + probe-proxysql.bash: | +{{ tpl (.Files.Get "files/probe-proxysql.bash") . | indent 4 }} + {{- if and .Values.eventsLog.enabled .Values.eventsLog.logrotate.enabled }} + cleanlogs.bash: | +{{ tpl (.Files.Get "files/cleanlogs.bash") . | indent 4 }} + {{- end }} diff --git a/helm/proxysql-cluster/templates/deployment.yaml b/helm/proxysql-cluster/templates/deployment.yaml new file mode 100644 index 0000000..27714d8 --- /dev/null +++ b/helm/proxysql-cluster/templates/deployment.yaml @@ -0,0 +1,131 @@ +{{- $root := . }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "proxysql.fullname" . }} + labels: +{{ include "proxysql.labels" . | indent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "proxysql.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + {{ include "proxysql.labels" . | nindent 8 }} + annotations: + checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.securityContext.enabled }} + securityContext: + fsGroup: {{ .Values.securityContext.fsGroup }} + runAsUser: {{ .Values.securityContext.runAsUser }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: proxysql + containerPort: 6033 + protocol: TCP + - name: admin + containerPort: 6032 + protocol: TCP + volumeMounts: + - name: script-config + mountPath: /usr/local/bin/probe-proxysql.bash + subPath: probe-proxysql.bash + readOnly: true + - name: proxy-config + mountPath: /etc/proxysql.cnf + subPath: proxysql.cnf + readOnly: true + - name: datadir + mountPath: {{ .Values.config.datadir }} + {{- if .Values.eventsLog.enabled }} + - name: eventslog + mountPath: {{ .Values.eventsLog.directory }} + {{- end }} + env: + {{- range $index, $envName := .Values.secretEnvs }} + - name: {{ $envName }} + valueFrom: + secretKeyRef: + name: {{ include "proxysql.fullname" $root }}-secret + key: {{ $envName }} + {{- end }} + livenessProbe: + exec: + command: ["/bin/bash","/usr/local/bin/probe-proxysql.bash"] + readinessProbe: + exec: + command: ["/bin/bash","/usr/local/bin/probe-proxysql.bash"] + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- if and .Values.eventsLog.enabled .Values.eventsLog.tailer.enabled }} + - name: "eventslog" + image: "{{ .Values.eventsLog.tailer.image.repository }}:{{ .Values.eventsLog.tailer.image.tag }}" + imagePullPolicy: "{{ .Values.eventsLog.tailer.image.pullPolicy }}" + command: + - "xtail" + - "/logs/" + resources: + {{- toYaml .Values.eventsLog.tailer.resources | nindent 12 }} + volumeMounts: + - name: eventslog + mountPath: /logs + {{- end }} + {{- if and .Values.eventsLog.enabled .Values.eventsLog.logrotate.enabled }} + - name: "logrotate" + image: "{{ .Values.eventsLog.logrotate.image.repository }}:{{ .Values.eventsLog.logrotate.image.tag }}" + imagePullPolicy: "{{ .Values.eventsLog.logrotate.image.pullPolicy }}" + env: + - name: DIR + value: /logs + - name: KEEP_FILES + value: {{ .Values.eventsLog.logrotate.copies | quote }} + command: + - /bin/sh + - /script/cleanlogs.bash + resources: + {{- toYaml .Values.eventsLog.logrotate.resources | nindent 12 }} + volumeMounts: + - name: eventslog + mountPath: /logs + - name: script-config + mountPath: /script/cleanlogs.bash + subPath: cleanlogs.bash + readOnly: true + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: script-config + configMap: + name: {{ include "proxysql.fullname" . }}-cm + - name: proxy-config + secret: + secretName: {{ include "proxysql.fullname" . }}-secret + - name: datadir + emptyDir: {} + {{- if .Values.eventsLog.enabled }} + - name: eventslog + emptyDir: {} + {{- end }} diff --git a/proxysql-cluster/templates/ingress.yaml b/helm/proxysql-cluster/templates/ingress.yaml similarity index 100% rename from proxysql-cluster/templates/ingress.yaml rename to helm/proxysql-cluster/templates/ingress.yaml diff --git a/helm/proxysql-cluster/templates/pdb.yaml b/helm/proxysql-cluster/templates/pdb.yaml new file mode 100644 index 0000000..392b23e --- /dev/null +++ b/helm/proxysql-cluster/templates/pdb.yaml @@ -0,0 +1,14 @@ +{{- if .Values.podDisruptionBudget -}} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "proxysql.fullname" . }} + labels: + {{- include "proxysql.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ include "proxysql.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + {{ toYaml .Values.podDisruptionBudget | nindent 2 }} +{{- end -}} diff --git a/helm/proxysql-cluster/templates/secret.yaml b/helm/proxysql-cluster/templates/secret.yaml new file mode 100644 index 0000000..86f6c1c --- /dev/null +++ b/helm/proxysql-cluster/templates/secret.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "proxysql.fullname" . }}-secret + labels: + {{- include "proxysql.labels" . | nindent 4 }} +stringData: + proxysql.cnf: | + {{- tpl .Values.config.template . | nindent 4 }} + ADMIN_PASSWORD: {{ include "proxysql.pwd" .Values.credentials.admin }} + ADMIN_USER: {{ .Values.credentials.admin.user }} + RADMIN_PASSWORD: {{ include "proxysql.pwd" .Values.credentials.radmin }} + RADMIN_USER: {{ .Values.credentials.radmin.user }} diff --git a/proxysql-cluster/templates/service.yaml b/helm/proxysql-cluster/templates/service.yaml similarity index 100% rename from proxysql-cluster/templates/service.yaml rename to helm/proxysql-cluster/templates/service.yaml diff --git a/proxysql-cluster/templates/tests/test-connection.yaml b/helm/proxysql-cluster/templates/tests/test-connection.yaml similarity index 100% rename from proxysql-cluster/templates/tests/test-connection.yaml rename to helm/proxysql-cluster/templates/tests/test-connection.yaml diff --git a/helm/proxysql-cluster/values.yaml b/helm/proxysql-cluster/values.yaml new file mode 100644 index 0000000..e640b18 --- /dev/null +++ b/helm/proxysql-cluster/values.yaml @@ -0,0 +1,191 @@ +# Default values for proxysql. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 2 + +image: + repository: pondix/proxysqlk8s + tag: 2.0.10 + pullPolicy: IfNotPresent + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +service: + type: ClusterIP + port: 6033 + +secretEnvs: ["ADMIN_USER", "ADMIN_PASSWORD", "RADMIN_USER", "RADMIN_PASSWORD"] + +credentials: + admin: + user: admin + #if blank a random password is created + password: "" + + radmin: + user: radmin + #if blank a random password is created + password: "" + +eventsLog: + enabled: false + directory: /var/log/proxysql/eventslog/ + filename: queries + logrotate: + # clean up old logs + enabled: false + copies: 3 + + image: + repository: "alpine" + tag: "3.14.4" + pullPolicy: "IfNotPresent" + resources: {} + # limits: + # cpu: 10m + # memory: 10Mi + # requests: + # cpu: 3m + # memory: 10Mi + + tailer: + # sidecar for outputting query log, hopefully made redundant by + # https://github.com/sysown/proxysql/issues/3805 + enabled: false + image: + repository: "rickw/debian-exim-send" + tag: "latest" + pullPolicy: "IfNotPresent" + resources: {} + # limits: + # cpu: 10m + # memory: 10Mi + # requests: + # cpu: 1m + # memory: 10Mi + + +mysql: + servers: + - address: '"192.168.0.1"' + port: 3306 + hostgroup: 0 + max_connections: 5000 + - address: '"192.168.1.1"' + users: + - username: '"user"' + password: '"password"' + default_hostgroup: 0 + active: 1 + queryRules: + - rule_id: 1 + active: 1 + match_digest: '"."' + log: 1 + destination_hostgroup: 0 + apply: 1 + variables: + threads: 2 + max_connections: 2048 + default_query_delay: 0 + default_query_timeout: "3600000" + have_compress: true + poll_timeout: 2000 + interfaces: '"0.0.0.0:6033"' + stacksize: "1048576" + server_version: '"8.0.20"' + connect_timeout_server: 3000 + monitor_username: '"user"' + monitor_password: '"password"' + monitor_history: 600000 + monitor_connect_interval: 5000 + monitor_ping_interval: 2000 + monitor_read_only_interval: 1500 + monitor_read_only_timeout: 500 + ping_interval_server_msec: 15000 + ping_timeout_server: 500 + commands_stats: true + sessions_sort: true + connect_retries_on_failure: 10 + + +config: + datadir: /var/lib/proxysql + template: | + datadir="{{ .Values.config.datadir }}" + + admin_variables= + { + admin_credentials="{{ .Values.credentials.admin.user }}:{{ include "proxysql.pwd" .Values.credentials.admin }};{{ .Values.credentials.radmin.user }}:{{ include "proxysql.pwd" .Values.credentials.radmin }}" + mysql_ifaces="0.0.0.0:6032" + } + + mysql_variables= + { + {{ include "proxysql.cfgmapdump" .Values.mysql.variables | nindent 2 }} + + {{- if .Values.eventsLog.enabled }} + eventslog_filename="{{ .Values.eventsLog.directory }}{{ .Values.eventsLog.filename }}" + eventslog_format=2 + {{- end }} + } + + # defines all the MySQL servers + mysql_servers = + ( + {{ include "proxysql.cfglistdump" .Values.mysql.servers | nindent 2 }} + ) + + # defines all the MySQL users + mysql_users: + ( + {{ include "proxysql.cfglistdump" .Values.mysql.users | nindent 2 }} + ) + + #defines MySQL Query Rules + mysql_query_rules: + ( + {{ include "proxysql.cfglistdump" .Values.mysql.queryRules | nindent 2 }} + ) + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: proxysql + # kubernetes.io/tls-acme: "true" + hosts: + - host: 10.18.120.41 + paths: [] + + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 1024Mi + # requests: + # cpu: 100m + # memory: 1024Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +podDisruptionBudget: {} + +securityContext: + enabled: true + fsGroup: 1000 + runAsUser: 1000 diff --git a/proxysql-cluster/Chart.yaml b/helm/proxysql-sidecar-cascade/Chart.yaml similarity index 100% rename from proxysql-cluster/Chart.yaml rename to helm/proxysql-sidecar-cascade/Chart.yaml diff --git a/proxysql-cluster/files/probe-proxysql.bash b/helm/proxysql-sidecar-cascade/files/probe-proxysql.bash similarity index 100% rename from proxysql-cluster/files/probe-proxysql.bash rename to helm/proxysql-sidecar-cascade/files/probe-proxysql.bash diff --git a/proxysql-sidecar-cascade/files/proxysql.cnf b/helm/proxysql-sidecar-cascade/files/proxysql.cnf similarity index 100% rename from proxysql-sidecar-cascade/files/proxysql.cnf rename to helm/proxysql-sidecar-cascade/files/proxysql.cnf diff --git a/proxysql-sidecar-cascade/templates/NOTES.txt b/helm/proxysql-sidecar-cascade/templates/NOTES.txt similarity index 100% rename from proxysql-sidecar-cascade/templates/NOTES.txt rename to helm/proxysql-sidecar-cascade/templates/NOTES.txt diff --git a/proxysql-cluster/templates/_helpers.tpl b/helm/proxysql-sidecar-cascade/templates/_helpers.tpl similarity index 100% rename from proxysql-cluster/templates/_helpers.tpl rename to helm/proxysql-sidecar-cascade/templates/_helpers.tpl diff --git a/proxysql-cluster/templates/configmap.yaml b/helm/proxysql-sidecar-cascade/templates/configmap.yaml similarity index 100% rename from proxysql-cluster/templates/configmap.yaml rename to helm/proxysql-sidecar-cascade/templates/configmap.yaml diff --git a/proxysql-sidecar-cascade/templates/deployment.yaml b/helm/proxysql-sidecar-cascade/templates/deployment.yaml similarity index 100% rename from proxysql-sidecar-cascade/templates/deployment.yaml rename to helm/proxysql-sidecar-cascade/templates/deployment.yaml diff --git a/proxysql-sidecar-cascade/templates/ingress.yaml b/helm/proxysql-sidecar-cascade/templates/ingress.yaml similarity index 100% rename from proxysql-sidecar-cascade/templates/ingress.yaml rename to helm/proxysql-sidecar-cascade/templates/ingress.yaml diff --git a/proxysql-sidecar-cascade/templates/service.yaml b/helm/proxysql-sidecar-cascade/templates/service.yaml similarity index 100% rename from proxysql-sidecar-cascade/templates/service.yaml rename to helm/proxysql-sidecar-cascade/templates/service.yaml diff --git a/proxysql-sidecar-cascade/templates/tests/test-connection.yaml b/helm/proxysql-sidecar-cascade/templates/tests/test-connection.yaml similarity index 100% rename from proxysql-sidecar-cascade/templates/tests/test-connection.yaml rename to helm/proxysql-sidecar-cascade/templates/tests/test-connection.yaml diff --git a/proxysql-cluster/values.yaml b/helm/proxysql-sidecar-cascade/values.yaml similarity index 100% rename from proxysql-cluster/values.yaml rename to helm/proxysql-sidecar-cascade/values.yaml diff --git a/proxysql-cluster/files/proxysql.cnf b/proxysql-cluster/files/proxysql.cnf deleted file mode 100644 index 83b6674..0000000 --- a/proxysql-cluster/files/proxysql.cnf +++ /dev/null @@ -1,84 +0,0 @@ -datadir="/var/lib/proxysql" - -admin_variables= -{ - admin_credentials="admin:admin;radmin:radmin" - mysql_ifaces="0.0.0.0:6032" -} - -mysql_variables= -{ - threads=2 - max_connections=2048 - default_query_delay=0 - default_query_timeout=36000000 - have_compress=true - poll_timeout=2000 - interfaces="0.0.0.0:6033" - default_schema="information_schema" - stacksize=1048576 - server_version="8.0.20" - connect_timeout_server=3000 - monitor_username="monitor" - monitor_password="monitor" - monitor_history=600000 - monitor_connect_interval=5000 - monitor_ping_interval=2000 - monitor_read_only_interval=1500 - monitor_read_only_timeout=500 - ping_interval_server_msec=15000 - ping_timeout_server=500 - commands_stats=true - sessions_sort=true - connect_retries_on_failure=10 -} - -# defines all the MySQL servers -mysql_servers = -( - { address="mysql-8.default.svc.cluster.local" , port=3306 , hostgroup=1, max_connections=5000 }, - { address="mysql-8-slave.default.svc.cluster.local" , port=3306 , hostgroup=1, max_connections=5000 }, -) - - -# defines all the MySQL users -mysql_users: -( - { username = "root" , password = "XHCO2ydDXj" , default_hostgroup = 0 , active = 1 } -) - - - -#defines MySQL Query Rules -mysql_query_rules: -( - { - rule_id=1 - active=1 - match_pattern="^SELECT .* FOR UPDATE$" - destination_hostgroup=0 - apply=1 - }, - { - rule_id=2 - active=1 - match_pattern="^SELECT" - destination_hostgroup=1 - apply=1 - } -) - -scheduler= -( -) - - -mysql_replication_hostgroups= -( - { - writer_hostgroup=0 - reader_hostgroup=1 - comment="RHG1" - } -) - diff --git a/proxysql-cluster/templates/deployment.yaml b/proxysql-cluster/templates/deployment.yaml deleted file mode 100644 index a5c93e5..0000000 --- a/proxysql-cluster/templates/deployment.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "proxysql.fullname" . }} - labels: -{{ include "proxysql.labels" . | indent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "proxysql.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - template: - metadata: - labels: - app.kubernetes.io/name: {{ include "proxysql.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: proxysql - containerPort: 6033 - protocol: TCP - - name: admin - containerPort: 6032 - protocol: TCP - volumeMounts: - - name: {{ .Release.Name }}-config - mountPath: /usr/local/bin/probe-proxysql.bash - subPath: probe-proxysql.bash - - name: {{ .Release.Name }}-config - mountPath: /etc/proxysql.cnf - subPath: proxysql.cnf - livenessProbe: - exec: - command: ["/bin/bash","/usr/local/bin/probe-proxysql.bash"] - readinessProbe: - exec: - command: ["/bin/bash","/usr/local/bin/probe-proxysql.bash"] - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} - volumes: - - name: {{ .Release.Name }}-config - configMap: - name: {{ .Release.Name }}-proxysqlcm diff --git a/proxysql-sidecar-cascade/templates/configmap.yaml b/proxysql-sidecar-cascade/templates/configmap.yaml deleted file mode 100644 index bd92c2a..0000000 --- a/proxysql-sidecar-cascade/templates/configmap.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-proxysqlcm -data: - proxysql.cnf: | -{{ tpl (.Files.Get "files/proxysql.cnf") . | indent 4 }} - probe-proxysql.bash: | -{{ tpl (.Files.Get "files/probe-proxysql.bash") . | indent 4 }} diff --git a/proxysql-sidecar-cascade/values.yaml b/proxysql-sidecar-cascade/values.yaml deleted file mode 100644 index eb85767..0000000 --- a/proxysql-sidecar-cascade/values.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# Default values for proxysql. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 2 - -image: - repository: pondix/proxysqlk8s - tag: 2.0.10 - pullPolicy: IfNotPresent - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -service: - type: ClusterIP - port: 6033 - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: proxysql - # kubernetes.io/tls-acme: "true" - hosts: - - host: 10.18.120.41 - paths: [] - - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 1024Mi - # requests: - # cpu: 100m - # memory: 1024Mi - -nodeSelector: {} - -tolerations: [] - -affinity: {}