Skip to content

Commit

Permalink
Ensure job names are <= 52 chars
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Mar 26, 2024
1 parent d5fc038 commit bc11729
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
7 changes: 4 additions & 3 deletions charts/cluster-auth-manager/templates/ocm-mc/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

{{ $content := toString $data }}
{{ $crd := dig "spec" "names" "plural" "" ($content | fromYaml) }}
{{ $job := printf "cluster-auth-regcrd-%s" $crd | trunc 52 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-auth-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "0"
Expand All @@ -21,7 +22,7 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: cluster-auth-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "1"
Expand Down Expand Up @@ -56,7 +57,7 @@ spec:
secretName: {{ $.Values.kubeconfigSecretName }}
- name: crd-volume
configMap:
name: cluster-auth-regcrd-{{ $crd }}
name: {{ $job }}
restartPolicy: Never
{{- end }}
{{- end }}
7 changes: 4 additions & 3 deletions charts/cluster-gateway-manager/templates/ocm-mc/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

{{ $content := toString $data }}
{{ $crd := dig "spec" "names" "plural" "" ($content | fromYaml) }}
{{ $job := printf "cluster-gateway-regcrd-%s" $crd | trunc 52 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-gateway-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "0"
Expand All @@ -21,7 +22,7 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: cluster-gateway-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "1"
Expand Down Expand Up @@ -56,7 +57,7 @@ spec:
secretName: {{ $.Values.kubeconfigSecretName }}
- name: crd-volume
configMap:
name: cluster-gateway-regcrd-{{ $crd }}
name: {{ $job }}
restartPolicy: Never
{{- end }}
{{- end }}
7 changes: 4 additions & 3 deletions charts/cluster-proxy-manager/templates/ocm-mc/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

{{ $content := toString $data }}
{{ $crd := dig "spec" "names" "plural" "" ($content | fromYaml) }}
{{ $job := printf "cluster-proxy-regcrd-%s" $crd | trunc 52 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-proxy-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "0"
Expand All @@ -21,7 +22,7 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: cluster-proxy-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "1"
Expand Down Expand Up @@ -56,7 +57,7 @@ spec:
secretName: {{ $.Values.kubeconfigSecretName }}
- name: crd-volume
configMap:
name: cluster-proxy-regcrd-{{ $crd }}
name: {{ $job }}
restartPolicy: Never
{{- end }}
{{- end }}
7 changes: 4 additions & 3 deletions charts/fluxcd-manager/templates/ocm-mc/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

{{ $content := toString $data }}
{{ $crd := dig "spec" "names" "plural" "" ($content | fromYaml) }}
{{ $job := printf "fluxcd-regcrd-%s" $crd | trunc 52 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: fluxcd-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "0"
Expand All @@ -21,7 +22,7 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: fluxcd-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "1"
Expand Down Expand Up @@ -56,7 +57,7 @@ spec:
secretName: {{ $.Values.kubeconfigSecretName }}
- name: crd-volume
configMap:
name: fluxcd-regcrd-{{ $crd }}
name: {{ $job }}
restartPolicy: Never
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

{{ $content := toString $data }}
{{ $crd := dig "spec" "names" "plural" "" ($content | fromYaml) }}
{{ $job := printf "managed-serviceaccount-regcrd-%s" $crd | trunc 52 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: managed-serviceaccount-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "0"
Expand All @@ -21,7 +22,7 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: managed-serviceaccount-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "1"
Expand Down Expand Up @@ -56,7 +57,7 @@ spec:
secretName: {{ $.Values.kubeconfigSecretName }}
- name: crd-volume
configMap:
name: managed-serviceaccount-regcrd-{{ $crd }}
name: {{ $job }}
restartPolicy: Never
{{- end }}
{{- end }}
7 changes: 4 additions & 3 deletions charts/spoke-cluster-proxy/templates/ocm-mc/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

{{ $content := toString $data }}
{{ $crd := dig "spec" "names" "plural" "" ($content | fromYaml) }}
{{ $job := printf "spoke-cluster-proxy-regcrd-%s" $crd | trunc 52 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: spoke-cluster-proxy-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "0"
Expand All @@ -21,7 +22,7 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: spoke-cluster-proxy-regcrd-{{ $crd }}
name: {{ $job }}
namespace: {{ $.Release.Namespace }}
annotations:
"helm.sh/hook-weight": "1"
Expand Down Expand Up @@ -56,7 +57,7 @@ spec:
secretName: {{ $.Values.kubeconfigSecretName }}
- name: crd-volume
configMap:
name: spoke-cluster-proxy-regcrd-{{ $crd }}
name: {{ $job }}
restartPolicy: Never
{{- end }}
{{- end }}

0 comments on commit bc11729

Please sign in to comment.