From 0f41e14af8e922a2a20b7635f3b59291ba8fbb85 Mon Sep 17 00:00:00 2001 From: Uri Zaidenwerg Date: Sun, 23 Jan 2022 07:56:11 +0200 Subject: [PATCH] ISSUE-744 PVCs are created with generated names Fixes #744 Create PersistentVolumeClaim with Name instead of Generated Name Will allow kafka k8s cluster switch over using global storage classes that span multiple kubernetes clusters. --- pkg/resources/kafka/kafka.go | 3 ++- pkg/resources/kafka/pvc.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/resources/kafka/kafka.go b/pkg/resources/kafka/kafka.go index c91df044c..2e9808990 100644 --- a/pkg/resources/kafka/kafka.go +++ b/pkg/resources/kafka/kafka.go @@ -57,7 +57,8 @@ type brokerReconcilePriority int const ( componentName = "kafka" brokerConfigTemplate = "%s-config" - brokerStorageTemplate = "%s-%d-storage-%d-" + brokerStorageTemplate = "%s-%d-storage-%d" + brokerConfigMapVolumeMount = "broker-config" kafkaDataVolumeMount = "kafka-data" diff --git a/pkg/resources/kafka/pvc.go b/pkg/resources/kafka/pvc.go index eb41184a0..44669bb9c 100644 --- a/pkg/resources/kafka/pvc.go +++ b/pkg/resources/kafka/pvc.go @@ -29,7 +29,7 @@ import ( func (r *Reconciler) pvc(brokerId int32, storageIndex int, storage v1beta1.StorageConfig, _ logr.Logger) runtime.Object { return &corev1.PersistentVolumeClaim{ - ObjectMeta: templates.ObjectMetaWithGeneratedNameAndAnnotations( + ObjectMeta: templates.ObjectMetaWithNameAndAnnotations( fmt.Sprintf(brokerStorageTemplate, r.KafkaCluster.Name, brokerId, storageIndex), util.MergeLabels( kafka.LabelsForKafka(r.KafkaCluster.Name),