Skip to content

Commit

Permalink
ISSUE-744 PVCs are created with generated names
Browse files Browse the repository at this point in the history
Fixes banzaicloud#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.
  • Loading branch information
Uri Zaidenwerg committed Jan 23, 2022
1 parent b84d7fd commit 0f41e14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/resources/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/kafka/pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 0f41e14

Please sign in to comment.