diff --git a/charts/psc-autoscaler/examples/cluster-config-cost-saving-with-DS-and-STS.yaml b/charts/psc-autoscaler/examples/cluster-config-cost-saving-all-supported-workload-types.yaml similarity index 67% rename from charts/psc-autoscaler/examples/cluster-config-cost-saving-with-DS-and-STS.yaml rename to charts/psc-autoscaler/examples/cluster-config-cost-saving-all-supported-workload-types.yaml index be5fcf3..49188dd 100644 --- a/charts/psc-autoscaler/examples/cluster-config-cost-saving-with-DS-and-STS.yaml +++ b/charts/psc-autoscaler/examples/cluster-config-cost-saving-all-supported-workload-types.yaml @@ -7,6 +7,26 @@ spec: operational: stopAllAutomation: false workloadTypes: + # You should consider if you want to enable StatefulSets automation. + # You might want a human eye while restarting production databases, in general, pods with persistent volume are more fragile. + # As well, if your StatefulSet runs on dedicated nodes, reducing workload resources will not help to reduce the cost + StatefulSet: + operational: + automationMode: "Enabled" + restrictions: + cpuManagement: + request: + increaseEnabled: false + decreaseEnabled: true + limit: + keepLimit: true + memoryManagement: + request: + increaseEnabled: false + decreaseEnabled: true + limit: + increaseEnabled: false + decreaseEnabled: false Deployment: operational: automationMode: "Enabled" @@ -41,10 +61,24 @@ spec: limit: increaseEnabled: false decreaseEnabled: false - # You should consider if you want to enable StatefulSets automation. - # You might want a human eye while restarting production databases, in general, pods with persistent volume are more fragile. - # As well, if your StatefulSet runs on dedicated nodes, reducing workload resources will not help to reduce the cost - StatefulSet: + CronJob: + operational: + automationMode: "Enabled" + restrictions: + cpuManagement: + request: + increaseEnabled: false + decreaseEnabled: true + limit: + keepLimit: true + memoryManagement: + request: + increaseEnabled: false + decreaseEnabled: true + limit: + increaseEnabled: false + decreaseEnabled: false + Job: operational: automationMode: "Enabled" restrictions: diff --git a/charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement-with-DS-and-STS.yaml b/charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement-all-supported-workload-types.yaml similarity index 67% rename from charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement-with-DS-and-STS.yaml rename to charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement-all-supported-workload-types.yaml index 00724bf..825a486 100644 --- a/charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement-with-DS-and-STS.yaml +++ b/charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement-all-supported-workload-types.yaml @@ -7,6 +7,26 @@ spec: operational: stopAllAutomation: false workloadTypes: + # You should consider if you want to enable StatefulSets automation. + # You might want a human eye while restarting production databases, in general, pods with persistent volume are more fragile. + # As well, if your StatefulSet runs on dedicated nodes, reducing workload resources will not help to reduce the cost + StatefulSet: + operational: + automationMode: "Enabled" + restrictions: + cpuManagement: + request: + increaseEnabled: true + decreaseEnabled: true + limit: + keepLimit: false + memoryManagement: + request: + increaseEnabled: true + decreaseEnabled: true + limit: + increaseEnabled: true + decreaseEnabled: true Deployment: operational: automationMode: "Enabled" @@ -41,10 +61,24 @@ spec: limit: increaseEnabled: true decreaseEnabled: true - # You should consider if you want to enable StatefulSets automation. - # You might want a human eye while restarting production databases, in general, pods with persistent volume are more fragile. - # As well, if your StatefulSet runs on dedicated nodes, reducing workload resources will not help to reduce the cost - StatefulSet: + CronJob: + operational: + automationMode: "Enabled" + restrictions: + cpuManagement: + request: + increaseEnabled: true + decreaseEnabled: true + limit: + keepLimit: false + memoryManagement: + request: + increaseEnabled: true + decreaseEnabled: true + limit: + increaseEnabled: true + decreaseEnabled: true + Job: operational: automationMode: "Enabled" restrictions: diff --git a/charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement.yaml b/charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement.yaml index dc5874e..473a5f1 100644 --- a/charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement.yaml +++ b/charts/psc-autoscaler/examples/cluster-config-cost-saving-performance-improvement.yaml @@ -24,3 +24,37 @@ spec: limit: increaseEnabled: true decreaseEnabled: true + CronJob: + operational: + automationMode: "Enabled" + restrictions: + cpuManagement: + request: + increaseEnabled: true + decreaseEnabled: true + limit: + keepLimit: false + memoryManagement: + request: + increaseEnabled: true + decreaseEnabled: true + limit: + increaseEnabled: true + decreaseEnabled: true + Job: + operational: + automationMode: "Enabled" + restrictions: + cpuManagement: + request: + increaseEnabled: true + decreaseEnabled: true + limit: + keepLimit: false + memoryManagement: + request: + increaseEnabled: true + decreaseEnabled: true + limit: + increaseEnabled: true + decreaseEnabled: true diff --git a/charts/psc-autoscaler/examples/cluster-config-cost-saving.yaml b/charts/psc-autoscaler/examples/cluster-config-cost-saving.yaml index fc1b433..cd4f07c 100644 --- a/charts/psc-autoscaler/examples/cluster-config-cost-saving.yaml +++ b/charts/psc-autoscaler/examples/cluster-config-cost-saving.yaml @@ -41,3 +41,37 @@ spec: limit: increaseEnabled: false decreaseEnabled: false + CronJob: + operational: + automationMode: "Enabled" + restrictions: + cpuManagement: + request: + increaseEnabled: false + decreaseEnabled: true + limit: + keepLimit: true + memoryManagement: + request: + increaseEnabled: false + decreaseEnabled: true + limit: + increaseEnabled: false + decreaseEnabled: false + Job: + operational: + automationMode: "Enabled" + restrictions: + cpuManagement: + request: + increaseEnabled: false + decreaseEnabled: true + limit: + keepLimit: true + memoryManagement: + request: + increaseEnabled: false + decreaseEnabled: true + limit: + increaseEnabled: false + decreaseEnabled: false diff --git a/charts/psc-autoscaler/templates/admission.yaml b/charts/psc-autoscaler/templates/admission.yaml index cd7dc48..6705145 100644 --- a/charts/psc-autoscaler/templates/admission.yaml +++ b/charts/psc-autoscaler/templates/admission.yaml @@ -9,6 +9,13 @@ metadata: name: {{ include "psc-autoscaler.fullname" . }}-tls labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} + {{- with .Values.admission.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} data: {{- if .Values.admission.staticCerts.enabled }} tls.crt: {{ .Values.admission.staticCerts.tlsCert }} @@ -23,6 +30,11 @@ apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: name: {{ include "psc-autoscaler.fullname" . }} + labels: + {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} {{- with .Values.admission.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -62,6 +74,11 @@ apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: {{ include "psc-autoscaler.fullname" . }} + labels: + {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} {{- with .Values.admission.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/psc-autoscaler/templates/clusterrole.yaml b/charts/psc-autoscaler/templates/clusterrole.yaml index 41a5b84..9477f4e 100644 --- a/charts/psc-autoscaler/templates/clusterrole.yaml +++ b/charts/psc-autoscaler/templates/clusterrole.yaml @@ -3,6 +3,14 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: {{ include "psc-autoscaler.fullname" . }} + labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} rules: - apiGroups: [ "admissionregistration.k8s.io" ] resources: [ "mutatingwebhookconfigurations", "validatingwebhookconfigurations" ] diff --git a/charts/psc-autoscaler/templates/clusterrolebinding.yaml b/charts/psc-autoscaler/templates/clusterrolebinding.yaml index a51a963..c08d96e 100644 --- a/charts/psc-autoscaler/templates/clusterrolebinding.yaml +++ b/charts/psc-autoscaler/templates/clusterrolebinding.yaml @@ -4,6 +4,13 @@ kind: ClusterRoleBinding metadata: name: {{ template "psc-autoscaler.fullname" . }} labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} subjects: - kind: ServiceAccount name: {{ include "psc-autoscaler.serviceAccountName" . }} diff --git a/charts/psc-autoscaler/templates/deployment.yaml b/charts/psc-autoscaler/templates/deployment.yaml index 4614719..28a0e56 100644 --- a/charts/psc-autoscaler/templates/deployment.yaml +++ b/charts/psc-autoscaler/templates/deployment.yaml @@ -6,6 +6,9 @@ metadata: name: {{ include "psc-autoscaler.fullname" . }}-serve labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -20,6 +23,9 @@ spec: metadata: annotations: checksum/secret: {{ include (print $.Template.BasePath "/admission.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- if not .Values.admission.staticCerts.enabled }} {{- /* it requires to reload the latest re-generated certs for mtls after helm upgrade*/}} rolloutme: {{ randAlphaNum 5 | quote }} @@ -28,6 +34,9 @@ spec: automation.perfectscale.io/excluded: "true" perfectscale.io/psc-autoscaler-cmd: serve {{- include "psc-autoscaler.selectorLabels" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} spec: {{- if (.Values.hostNetwork).enabled }} hostNetwork: true @@ -142,6 +151,9 @@ metadata: name: {{ include "psc-autoscaler.fullname" . }}-sync labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -160,6 +172,13 @@ spec: automation.perfectscale.io/excluded: "true" perfectscale.io/psc-autoscaler-cmd: sync {{- include "psc-autoscaler.selectorLabels" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} spec: {{- if .Values.priorityClass.enabled }} priorityClassName: {{ .Values.priorityClass.name }} @@ -249,6 +268,9 @@ metadata: name: {{ include "psc-autoscaler.fullname" . }}-evict labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -267,6 +289,13 @@ spec: automation.perfectscale.io/excluded: "true" perfectscale.io/psc-autoscaler-cmd: evict {{- include "psc-autoscaler.selectorLabels" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} spec: {{- if .Values.priorityClass.enabled }} priorityClassName: {{ .Values.priorityClass.name }} diff --git a/charts/psc-autoscaler/templates/secret.yaml b/charts/psc-autoscaler/templates/secret.yaml index e205c9a..31af850 100644 --- a/charts/psc-autoscaler/templates/secret.yaml +++ b/charts/psc-autoscaler/templates/secret.yaml @@ -6,8 +6,14 @@ metadata: name: {{ .Values.secret.name | default $fullName }} annotations: "helm.sh/resource-policy": keep + {{- with .Values.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} type: Opaque data: clientId: {{ .Values.secret.clientId | b64enc | quote }} diff --git a/charts/psc-autoscaler/templates/service.yaml b/charts/psc-autoscaler/templates/service.yaml index 76adf4c..e2326c6 100644 --- a/charts/psc-autoscaler/templates/service.yaml +++ b/charts/psc-autoscaler/templates/service.yaml @@ -4,6 +4,13 @@ metadata: name: {{ include "psc-autoscaler.fullname" . }} labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} + {{- with .Values.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} ports: diff --git a/charts/psc-autoscaler/templates/serviceaccount.yaml b/charts/psc-autoscaler/templates/serviceaccount.yaml index feb902d..4a16b85 100644 --- a/charts/psc-autoscaler/templates/serviceaccount.yaml +++ b/charts/psc-autoscaler/templates/serviceaccount.yaml @@ -5,6 +5,9 @@ metadata: name: {{ include "psc-autoscaler.serviceAccountName" . }} labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/psc-autoscaler/templates/tests/intTestsMutationCheck.yaml b/charts/psc-autoscaler/templates/tests/intTestsMutationCheck.yaml index 4509808..878467b 100644 --- a/charts/psc-autoscaler/templates/tests/intTestsMutationCheck.yaml +++ b/charts/psc-autoscaler/templates/tests/intTestsMutationCheck.yaml @@ -3,8 +3,15 @@ apiVersion: v1 kind: Pod metadata: name: {{ include "psc-autoscaler.fullname" . }}-int-tests-mutation-check + labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} annotations: "helm.sh/hook": test + {{- with .Values.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: containers: - name: mutation-check diff --git a/charts/psc-autoscaler/templates/tests/intTestsRole.yaml b/charts/psc-autoscaler/templates/tests/intTestsRole.yaml index 4af4283..797fb51 100644 --- a/charts/psc-autoscaler/templates/tests/intTestsRole.yaml +++ b/charts/psc-autoscaler/templates/tests/intTestsRole.yaml @@ -3,6 +3,14 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ include "psc-autoscaler.fullname" . }}-int-tests + labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} + {{- with .Values.integrationTests.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} rules: - apiGroups: [ "" ] resources: [ "pods" ] diff --git a/charts/psc-autoscaler/templates/tests/intTestsRolebinding.yaml b/charts/psc-autoscaler/templates/tests/intTestsRolebinding.yaml index 2ae122e..c66b861 100644 --- a/charts/psc-autoscaler/templates/tests/intTestsRolebinding.yaml +++ b/charts/psc-autoscaler/templates/tests/intTestsRolebinding.yaml @@ -4,6 +4,13 @@ kind: RoleBinding metadata: name: {{ include "psc-autoscaler.fullname" . }}-int-tests labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} + {{- with .Values.integrationTests.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} subjects: - kind: ServiceAccount name: {{ include "psc-autoscaler.integrationTests.serviceAccountName" . }} diff --git a/charts/psc-autoscaler/templates/tests/intTestsServiceaccount.yaml b/charts/psc-autoscaler/templates/tests/intTestsServiceaccount.yaml index d9f2bb0..759776d 100644 --- a/charts/psc-autoscaler/templates/tests/intTestsServiceaccount.yaml +++ b/charts/psc-autoscaler/templates/tests/intTestsServiceaccount.yaml @@ -5,6 +5,9 @@ metadata: name: {{ include "psc-autoscaler.integrationTests.serviceAccountName" . }} labels: {{- include "psc-autoscaler.labels" . | nindent 4 }} + {{- if .Values.additionalLabels }} + {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- end }} {{- with .Values.integrationTests.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/psc-autoscaler/values.yaml b/charts/psc-autoscaler/values.yaml index 432cd77..f9a3a8f 100644 --- a/charts/psc-autoscaler/values.yaml +++ b/charts/psc-autoscaler/values.yaml @@ -2,7 +2,7 @@ replicaCount: 3 image: repository: public.ecr.aws/perfectscale-io/psc-autoscaler pullPolicy: Always - tag: "v1.0.14" + tag: "v1.0.15" settings: port: 8443 env: "prod" @@ -48,8 +48,13 @@ secret: clientSecret: "" nameOverride: "" fullnameOverride: "" +## Additional labels to set in the all objects. Together with standard labels from the chart +additionalLabels: {} +podLabels: {} ## Annotations to add to the deployment annotations: {} +## Annotations to add to the pod +podAnnotations: {} priorityClass: enabled: false create: false