Skip to content

Commit aba4e28

Browse files
committed
fix: revert chart macros; limit name length
1 parent 6eef2d7 commit aba4e28

9 files changed

Lines changed: 38 additions & 37 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ $(HELMIFY): $(LOCALBIN)
187187
.PHONY: helm-build
188188
helm-build: helm helmify manifests kustomize
189189
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) && cd ../../
190-
$(KUSTOMIZE) build config/default | $(HELMIFY) -crd-dir chart/valid8or-plugin-aws
190+
$(KUSTOMIZE) build config/default | $(HELMIFY) -crd-dir
191191
cat hack/extra-values.yaml >> chart/valid8or-plugin-aws/values.yaml
192192

193193
.PHONY: helm-package

chart/valid8or-plugin-aws/templates/_helpers.tpl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@
22
Expand the name of the chart.
33
*/}}
44
{{- define "chart.name" -}}
5-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 28 | trimSuffix "-" }}
66
{{- end }}
77

88
{{/*
99
Create a default fully qualified app name.
10-
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
10+
We truncate at 28 chars because some Kubernetes name fields are limited to 63 chars by the DNS naming spec.
11+
And the longest suffix appended to the chart's full name is 35 chars.
1112
If release name contains chart name it will be used as a full name.
1213
*/}}
1314
{{- define "chart.fullname" -}}
1415
{{- if .Values.fullnameOverride }}
15-
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- .Values.fullnameOverride | trunc 28 | trimSuffix "-" }}
1617
{{- else }}
1718
{{- $name := default .Chart.Name .Values.nameOverride }}
1819
{{- if contains $name .Release.Name }}
19-
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- .Release.Name | trunc 28 | trimSuffix "-" }}
2021
{{- else }}
21-
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 28 | trimSuffix "-" }}
2223
{{- end }}
2324
{{- end }}
2425
{{- end }}
@@ -27,7 +28,7 @@ If release name contains chart name it will be used as a full name.
2728
Create chart name and version as used by the chart label.
2829
*/}}
2930
{{- define "chart.chart" -}}
30-
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 28 | trimSuffix "-" }}
3132
{{- end }}
3233

3334
{{/*

chart/valid8or-plugin-aws/templates/deployment.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: {{ include "valid8or-plugin-aws.fullname" . }}-controller-manager
4+
name: {{ include "chart.fullname" . }}-controller-manager
55
labels:
66
app.kubernetes.io/component: manager
77
app.kubernetes.io/created-by: valid8or-plugin-aws
88
app.kubernetes.io/part-of: valid8or-plugin-aws
99
control-plane: controller-manager
10-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
10+
{{- include "chart.labels" . | nindent 4 }}
1111
spec:
1212
replicas: {{ .Values.controllerManager.replicas }}
1313
selector:
1414
matchLabels:
1515
control-plane: controller-manager
16-
{{- include "valid8or-plugin-aws.selectorLabels" . | nindent 6 }}
16+
{{- include "chart.selectorLabels" . | nindent 6 }}
1717
template:
1818
metadata:
1919
labels:
2020
control-plane: controller-manager
21-
{{- include "valid8or-plugin-aws.selectorLabels" . | nindent 8 }}
21+
{{- include "chart.selectorLabels" . | nindent 8 }}
2222
annotations:
2323
kubectl.kubernetes.io/default-container: manager
2424
spec:
@@ -65,5 +65,5 @@ spec:
6565
| nindent 10 }}
6666
securityContext:
6767
runAsNonRoot: true
68-
serviceAccountName: {{ include "valid8or-plugin-aws.fullname" . }}-controller-manager
68+
serviceAccountName: {{ include "chart.fullname" . }}-controller-manager
6969
terminationGracePeriodSeconds: 10

chart/valid8or-plugin-aws/templates/leader-election-rbac.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: Role
33
metadata:
4-
name: {{ include "valid8or-plugin-aws.fullname" . }}-leader-election-role
4+
name: {{ include "chart.fullname" . }}-leader-election-role
55
labels:
66
app.kubernetes.io/component: rbac
77
app.kubernetes.io/created-by: valid8or-plugin-aws
88
app.kubernetes.io/part-of: valid8or-plugin-aws
9-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
9+
{{- include "chart.labels" . | nindent 4 }}
1010
rules:
1111
- apiGroups:
1212
- ""
@@ -43,17 +43,17 @@ rules:
4343
apiVersion: rbac.authorization.k8s.io/v1
4444
kind: RoleBinding
4545
metadata:
46-
name: {{ include "valid8or-plugin-aws.fullname" . }}-leader-election-rolebinding
46+
name: {{ include "chart.fullname" . }}-leader-election-rolebinding
4747
labels:
4848
app.kubernetes.io/component: rbac
4949
app.kubernetes.io/created-by: valid8or-plugin-aws
5050
app.kubernetes.io/part-of: valid8or-plugin-aws
51-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
51+
{{- include "chart.labels" . | nindent 4 }}
5252
roleRef:
5353
apiGroup: rbac.authorization.k8s.io
5454
kind: Role
55-
name: '{{ include "valid8or-plugin-aws.fullname" . }}-leader-election-role'
55+
name: '{{ include "chart.fullname" . }}-leader-election-role'
5656
subjects:
5757
- kind: ServiceAccount
58-
name: '{{ include "valid8or-plugin-aws.fullname" . }}-controller-manager'
58+
name: '{{ include "chart.fullname" . }}-controller-manager'
5959
namespace: '{{ .Release.Namespace }}'

chart/valid8or-plugin-aws/templates/manager-rbac.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4-
name: {{ include "valid8or-plugin-aws.fullname" . }}-manager-role
4+
name: {{ include "chart.fullname" . }}-manager-role
55
labels:
6-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
6+
{{- include "chart.labels" . | nindent 4 }}
77
rules:
88
- apiGroups:
99
- validation.spectrocloud.labs
@@ -45,17 +45,17 @@ rules:
4545
apiVersion: rbac.authorization.k8s.io/v1
4646
kind: ClusterRoleBinding
4747
metadata:
48-
name: {{ include "valid8or-plugin-aws.fullname" . }}-manager-rolebinding
48+
name: {{ include "chart.fullname" . }}-manager-rolebinding
4949
labels:
5050
app.kubernetes.io/component: rbac
5151
app.kubernetes.io/created-by: valid8or-plugin-aws
5252
app.kubernetes.io/part-of: valid8or-plugin-aws
53-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
53+
{{- include "chart.labels" . | nindent 4 }}
5454
roleRef:
5555
apiGroup: rbac.authorization.k8s.io
5656
kind: ClusterRole
57-
name: '{{ include "valid8or-plugin-aws.fullname" . }}-manager-role'
57+
name: '{{ include "chart.fullname" . }}-manager-role'
5858
subjects:
5959
- kind: ServiceAccount
60-
name: '{{ include "valid8or-plugin-aws.fullname" . }}-controller-manager'
60+
name: '{{ include "chart.fullname" . }}-controller-manager'
6161
namespace: '{{ .Release.Namespace }}'

chart/valid8or-plugin-aws/templates/metrics-reader-rbac.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4-
name: {{ include "valid8or-plugin-aws.fullname" . }}-metrics-reader
4+
name: {{ include "chart.fullname" . }}-metrics-reader
55
labels:
66
app.kubernetes.io/component: kube-rbac-proxy
77
app.kubernetes.io/created-by: valid8or-plugin-aws
88
app.kubernetes.io/part-of: valid8or-plugin-aws
9-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
9+
{{- include "chart.labels" . | nindent 4 }}
1010
rules:
1111
- nonResourceURLs:
1212
- /metrics
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4-
name: {{ include "valid8or-plugin-aws.fullname" . }}-controller-manager-metrics-service
4+
name: {{ include "chart.fullname" . }}-controller-manager-metrics-service
55
labels:
66
app.kubernetes.io/component: kube-rbac-proxy
77
app.kubernetes.io/created-by: valid8or-plugin-aws
88
app.kubernetes.io/part-of: valid8or-plugin-aws
99
control-plane: controller-manager
10-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
10+
{{- include "chart.labels" . | nindent 4 }}
1111
spec:
1212
type: {{ .Values.metricsService.type }}
1313
selector:
1414
control-plane: controller-manager
15-
{{- include "valid8or-plugin-aws.selectorLabels" . | nindent 4 }}
15+
{{- include "chart.selectorLabels" . | nindent 4 }}
1616
ports:
1717
{{- .Values.metricsService.ports | toYaml | nindent 2 -}}

chart/valid8or-plugin-aws/templates/proxy-rbac.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4-
name: {{ include "valid8or-plugin-aws.fullname" . }}-proxy-role
4+
name: {{ include "chart.fullname" . }}-proxy-role
55
labels:
66
app.kubernetes.io/component: kube-rbac-proxy
77
app.kubernetes.io/created-by: valid8or-plugin-aws
88
app.kubernetes.io/part-of: valid8or-plugin-aws
9-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
9+
{{- include "chart.labels" . | nindent 4 }}
1010
rules:
1111
- apiGroups:
1212
- authentication.k8s.io
@@ -24,17 +24,17 @@ rules:
2424
apiVersion: rbac.authorization.k8s.io/v1
2525
kind: ClusterRoleBinding
2626
metadata:
27-
name: {{ include "valid8or-plugin-aws.fullname" . }}-proxy-rolebinding
27+
name: {{ include "chart.fullname" . }}-proxy-rolebinding
2828
labels:
2929
app.kubernetes.io/component: kube-rbac-proxy
3030
app.kubernetes.io/created-by: valid8or-plugin-aws
3131
app.kubernetes.io/part-of: valid8or-plugin-aws
32-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
32+
{{- include "chart.labels" . | nindent 4 }}
3333
roleRef:
3434
apiGroup: rbac.authorization.k8s.io
3535
kind: ClusterRole
36-
name: '{{ include "valid8or-plugin-aws.fullname" . }}-proxy-role'
36+
name: '{{ include "chart.fullname" . }}-proxy-role'
3737
subjects:
3838
- kind: ServiceAccount
39-
name: '{{ include "valid8or-plugin-aws.fullname" . }}-controller-manager'
39+
name: '{{ include "chart.fullname" . }}-controller-manager'
4040
namespace: '{{ .Release.Namespace }}'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apiVersion: v1
22
kind: ServiceAccount
33
metadata:
4-
name: {{ include "valid8or-plugin-aws.fullname" . }}-controller-manager
4+
name: {{ include "chart.fullname" . }}-controller-manager
55
labels:
66
app.kubernetes.io/component: rbac
77
app.kubernetes.io/created-by: valid8or-plugin-aws
88
app.kubernetes.io/part-of: valid8or-plugin-aws
9-
{{- include "valid8or-plugin-aws.labels" . | nindent 4 }}
9+
{{- include "chart.labels" . | nindent 4 }}
1010
annotations:
1111
{{- toYaml .Values.controllerManager.serviceAccount.annotations | nindent 4 }}

0 commit comments

Comments
 (0)