diff --git a/template/CHART_NAME/templates/clusterrolebinding.yaml b/template/CHART_NAME/templates/clusterrolebinding.yaml index 3c9527984..03c0bc4c5 100644 --- a/template/CHART_NAME/templates/clusterrolebinding.yaml +++ b/template/CHART_NAME/templates/clusterrolebinding.yaml @@ -2,7 +2,6 @@ kind: ClusterRoleBinding apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }} metadata: name: {{ template "common.names.fullname" . }} - namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} app.kubernetes.io/component: %%COMPONENT_NAME%% {{- if .Values.commonLabels }} diff --git a/template/CHART_NAME/templates/hpa.yaml b/template/CHART_NAME/templates/hpa.yaml index 3cc5de2a9..398728eac 100644 --- a/template/CHART_NAME/templates/hpa.yaml +++ b/template/CHART_NAME/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.%%MAIN_OBJECT_BLOCK%%.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 +apiVersion: {{ include "common.capabilities.hpa.apiVersion" . }} kind: HorizontalPodAutoscaler metadata: name: {{ include "common.names.fullname" . }} @@ -23,12 +23,24 @@ spec: - type: Resource resource: name: memory + {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }} targetAverageUtilization: {{ .Values.%%MAIN_OBJECT_BLOCK%%.autoscaling.targetMemory }} + {{- else }} + target: + type: Utilization + averageUtilization: {{ .Values.worker.autoscaling.targetMemory }} + {{- end }} {{- end }} {{- if .Values.%%MAIN_OBJECT_BLOCK%%.autoscaling.targetCPU }} - type: Resource resource: name: cpu + {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }} targetAverageUtilization: {{ .Values.%%MAIN_OBJECT_BLOCK%%.autoscaling.targetCPU }} + {{- else }} + target: + type: Utilization + averageUtilization: {{ .Values.worker.autoscaling.targetCPU }} + {{- end }} {{- end }} {{- end }} diff --git a/template/CHART_NAME/templates/role.yaml b/template/CHART_NAME/templates/role.yaml index 5f192cb34..dfdab9002 100644 --- a/template/CHART_NAME/templates/role.yaml +++ b/template/CHART_NAME/templates/role.yaml @@ -1,6 +1,6 @@ {{ if .Values.rbac.create }} kind: Role -apiVersion: rbac.authorization.k8s.io/v1 +apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }} metadata: name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} diff --git a/template/CHART_NAME/templates/servicemonitor.yaml b/template/CHART_NAME/templates/servicemonitor.yaml index 73423ae63..6cc8e051d 100644 --- a/template/CHART_NAME/templates/servicemonitor.yaml +++ b/template/CHART_NAME/templates/servicemonitor.yaml @@ -45,5 +45,5 @@ spec: {{- end }} namespaceSelector: matchNames: - - {{ .Release.Namespace }} + - {{ include "common.names.namespace" . | quote }} {{- end }}