From dae73b2b740a379125395b9509d750b2566d39f7 Mon Sep 17 00:00:00 2001 From: ramvibhulaanandh Date: Wed, 10 Apr 2024 15:42:12 +0530 Subject: [PATCH 1/2] Add priority class to the innodb cluster --- .../templates/deployment_cluster.yaml | 3 +++ .../mysql-innodbcluster/templates/priority_class.yaml | 11 +++++++++++ helm/mysql-innodbcluster/values.yaml | 7 +++++++ 3 files changed, 21 insertions(+) create mode 100644 helm/mysql-innodbcluster/templates/priority_class.yaml diff --git a/helm/mysql-innodbcluster/templates/deployment_cluster.yaml b/helm/mysql-innodbcluster/templates/deployment_cluster.yaml index eab1467c..0ed4ec08 100644 --- a/helm/mysql-innodbcluster/templates/deployment_cluster.yaml +++ b/helm/mysql-innodbcluster/templates/deployment_cluster.yaml @@ -444,6 +444,9 @@ spec: {{- end }} {{- end }} {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} {{- if hasKey $replica "mycnf" }} mycnf: | {{- if not (hasPrefix "[mysqld]" (($replica).mycnf) ) }}{{- "[mysqld]" | nindent 6 }}{{- end }}{{ (($replica).mycnf) | nindent 6 }}{{- end }} {{- if hasKey $replica "instances" }} diff --git a/helm/mysql-innodbcluster/templates/priority_class.yaml b/helm/mysql-innodbcluster/templates/priority_class.yaml new file mode 100644 index 00000000..8c2b1ba4 --- /dev/null +++ b/helm/mysql-innodbcluster/templates/priority_class.yaml @@ -0,0 +1,11 @@ +{{- $cluster_name := default "mycluster" .Release.Name }} +{{- if .Values.podPriorityClassName.create }} +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: {{ $cluster_name }} + namespace: {{ .Release.Namespace }} +preemptionPolicy: PreemptLowerPriority +globalDefault: false +value: {{ .Values.podPriorityClassName.priority }} +{{- end }} \ No newline at end of file diff --git a/helm/mysql-innodbcluster/values.yaml b/helm/mysql-innodbcluster/values.yaml index 4b8f6b0c..01f60393 100644 --- a/helm/mysql-innodbcluster/values.yaml +++ b/helm/mysql-innodbcluster/values.yaml @@ -29,6 +29,13 @@ baseServerId: 1000 # podAnnotations: # podLabels: +podPriorityClassName: + # If create is false with no name set, no podPriorityClassName is specified. + create: true + # If not set a name is generated using the fullname template + name: "" + priority: 1000000 + #logs: # error: # enabled: true From d53e49ca3dd73bb902c3ea8d3e3e19ad092739f1 Mon Sep 17 00:00:00 2001 From: ram-vibhul <136695724+ram-vibhul@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:59:17 +0530 Subject: [PATCH 2/2] Update deployment_cluster.yaml --- helm/mysql-innodbcluster/templates/deployment_cluster.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/mysql-innodbcluster/templates/deployment_cluster.yaml b/helm/mysql-innodbcluster/templates/deployment_cluster.yaml index 0ed4ec08..d91a76e1 100644 --- a/helm/mysql-innodbcluster/templates/deployment_cluster.yaml +++ b/helm/mysql-innodbcluster/templates/deployment_cluster.yaml @@ -444,8 +444,8 @@ spec: {{- end }} {{- end }} {{- end }} - {{- if .Values.priorityClassName }} - priorityClassName: {{ .Values.priorityClassName }} + {{- if .Values.podPriorityClassName }} + priorityClassName: {{ .Values.podPriorityClassName }} {{- end }} {{- if hasKey $replica "mycnf" }} mycnf: | {{- if not (hasPrefix "[mysqld]" (($replica).mycnf) ) }}{{- "[mysqld]" | nindent 6 }}{{- end }}{{ (($replica).mycnf) | nindent 6 }}{{- end }}