From 7259a6315c7f7d97665d928de6357fc3cbcae136 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 26 Apr 2022 15:53:36 -0400 Subject: Truncate annotations when generating kubernetes yaml files Kubernetes only allows 63 characters in an annotation. Make sure that we only add 63 or less charaters when generating kube. Warn if containers or pods have longer length and truncate. Discussion: https://github.com/containers/podman/discussions/13901 Fixes: https://github.com/containers/podman/issues/13962 Signed-off-by: Daniel J Walsh --- libpod/define/annotations.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libpod/define') diff --git a/libpod/define/annotations.go b/libpod/define/annotations.go index a83fbff0b..8f5279981 100644 --- a/libpod/define/annotations.go +++ b/libpod/define/annotations.go @@ -135,6 +135,8 @@ const ( // creating a checkpoint image to specify the name of host distribution on // which the checkpoint was created. CheckpointAnnotationDistributionName = "io.podman.annotations.checkpoint.distribution.name" + // MaxKubeAnnotation is the max length of annotations allowed by Kubernetes. + MaxKubeAnnotation = 63 ) // IsReservedAnnotation returns true if the specified value corresponds to an -- cgit v1.2.3-54-g00ecf