From da1711a496ed3ddefab0c3046d4ab30374254870 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Mon, 23 Oct 2023 11:18:54 +0100 Subject: [PATCH 1/2] Fix long validator names --- rust/helm/hyperlane-agent/templates/_helpers.tpl | 8 ++++++++ .../hyperlane-agent/templates/validator-configmap.yaml | 2 +- .../templates/validator-external-secret.yaml | 4 ++-- .../templates/validator-statefulset.yaml | 10 +++++----- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/rust/helm/hyperlane-agent/templates/_helpers.tpl b/rust/helm/hyperlane-agent/templates/_helpers.tpl index e69de29bb2..a30142b99b 100644 --- a/rust/helm/hyperlane-agent/templates/_helpers.tpl +++ b/rust/helm/hyperlane-agent/templates/_helpers.tpl @@ -0,0 +1,8 @@ +{{/* +We truncate at 63 chars - (11 + (len $suffix)) because the controller-revision-hash label adds an 11 character suffix +to the pod name. See https://github.com/kubernetes/kubernetes/issues/64023 +*/}} +{{- define "validator.fullname" -}} +{{- $suffix := "-validator" }} +{{- include "agent-common.fullname" . | trunc (int (sub 63 (add 11 (len $suffix)))) | trimSuffix "-" }}{{ print $suffix }} +{{- end }} diff --git a/rust/helm/hyperlane-agent/templates/validator-configmap.yaml b/rust/helm/hyperlane-agent/templates/validator-configmap.yaml index da452f4fa8..cabed1644a 100644 --- a/rust/helm/hyperlane-agent/templates/validator-configmap.yaml +++ b/rust/helm/hyperlane-agent/templates/validator-configmap.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "agent-common.fullname" . }}-validator + name: {{ include "validator.fullname" . }} labels: {{- include "agent-common.labels" . | nindent 4 }} data: diff --git a/rust/helm/hyperlane-agent/templates/validator-external-secret.yaml b/rust/helm/hyperlane-agent/templates/validator-external-secret.yaml index c38900483a..c15081f119 100644 --- a/rust/helm/hyperlane-agent/templates/validator-external-secret.yaml +++ b/rust/helm/hyperlane-agent/templates/validator-external-secret.yaml @@ -2,7 +2,7 @@ apiVersion: external-secrets.io/v1beta1 kind: ExternalSecret metadata: - name: {{ include "agent-common.fullname" . }}-validator-external-secret + name: {{ include "validator.fullname" . }}-external-secret labels: {{- include "agent-common.labels" . | nindent 4 }} annotations: @@ -14,7 +14,7 @@ spec: refreshInterval: "1h" # The secret that will be created target: - name: {{ include "agent-common.fullname" . }}-validator-secret + name: {{ include "validator.fullname" . }}-secret template: type: Opaque metadata: diff --git a/rust/helm/hyperlane-agent/templates/validator-statefulset.yaml b/rust/helm/hyperlane-agent/templates/validator-statefulset.yaml index 29df0f5398..1b0a87dd41 100644 --- a/rust/helm/hyperlane-agent/templates/validator-statefulset.yaml +++ b/rust/helm/hyperlane-agent/templates/validator-statefulset.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: StatefulSet metadata: - name: {{ include "agent-common.fullname" . }}-validator + name: {{ include "validator.fullname" . }} labels: {{- include "agent-common.labels" . | nindent 4 }} app.kubernetes.io/component: validator @@ -12,7 +12,7 @@ spec: {{- include "agent-common.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: validator replicas: {{ len .Values.hyperlane.validator.configs }} - serviceName: {{ include "agent-common.fullname" . }}-validator + serviceName: {{ include "validator.fullname" . }} template: metadata: annotations: @@ -58,7 +58,7 @@ spec: - secretRef: name: {{ include "agent-common.fullname" . }}-secret - secretRef: - name: {{ include "agent-common.fullname" . }}-validator-secret + name: {{ include "validator.fullname" . }}-secret env: - name: REPLICA_NAME valueFrom: @@ -79,10 +79,10 @@ spec: volumes: - name: config-env-vars configMap: - name: {{ include "agent-common.fullname" . }}-validator + name: {{ include "validator.fullname" . }} - name: secret-env-vars secret: - secretName: {{ include "agent-common.fullname" . }}-validator-secret + secretName: {{ include "validator.fullname" . }}-secret {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} From 1cebd20384f9e3121d105c2de19bb81996a6d289 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Mon, 23 Oct 2023 11:20:38 +0100 Subject: [PATCH 2/2] name --- rust/helm/hyperlane-agent/templates/_helpers.tpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust/helm/hyperlane-agent/templates/_helpers.tpl b/rust/helm/hyperlane-agent/templates/_helpers.tpl index a30142b99b..cd30646bf6 100644 --- a/rust/helm/hyperlane-agent/templates/_helpers.tpl +++ b/rust/helm/hyperlane-agent/templates/_helpers.tpl @@ -1,6 +1,7 @@ {{/* We truncate at 63 chars - (11 + (len $suffix)) because the controller-revision-hash label adds an 11 character suffix -to the pod name. See https://github.com/kubernetes/kubernetes/issues/64023 +to the pod name, and we want the -validator suffix to still be present, but are happy to truncate the preceding name. +See https://github.com/kubernetes/kubernetes/issues/64023 for controller-revision-hash details. */}} {{- define "validator.fullname" -}} {{- $suffix := "-validator" }}