Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Set Ownership of PVC's correctly #10888

Open
Spazzy757 opened this issue Nov 28, 2024 · 1 comment
Open

[Bug]: Set Ownership of PVC's correctly #10888

Spazzy757 opened this issue Nov 28, 2024 · 1 comment

Comments

@Spazzy757
Copy link

Bug Description

We use Argocd to deploy all of our applications, currently we are using a stateful Kafka setup which deploys three kafak pods and three kafka zookeeper pods. Each of tehse in turn creates a PPVC as such:

NAME                     STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   VOLUMEATTRIBUTESCLASS   AGE
data-0-kafka-kafka-0     Bound    pvc-c27d6fea-7c1e-485a-8c61-03acf3ac42f3   15Gi       RWO            sbs-default    <unset>                 52m
data-0-kafka-kafka-1     Bound    pvc-279d281a-eacb-4667-8989-55a8adf88c97   15Gi       RWO            sbs-default    <unset>                 52m
data-0-kafka-kafka-2     Bound    pvc-ef05a2ca-5d75-4f16-b7a3-38462be2438f   15Gi       RWO            sbs-default    <unset>                 52m
data-kafka-zookeeper-0   Bound    pvc-f53c2d7c-5d22-438f-aed3-469454e1a9c8   5Gi        RWO            sbs-default    <unset>                 53m
data-kafka-zookeeper-1   Bound    pvc-eec536b6-371a-4629-844c-1af74db75187   5Gi        RWO            sbs-default    <unset>                 53m
data-kafka-zookeeper-2   Bound    pvc-bf144f91-fbe0-462a-ba05-fdafd848bd4b   5Gi        RWO            sbs-default    <unset>                 53m

The problem we run into is that ownership of these resources does not seem to be correct as when you utilize ArgoCD it see's these resources and gives the error:

This resource is not present in the application's source. It will be deleted from Kubernetes if the prune option is enabled during sync

And when ArgoCD resyncs, it tries to delete the PVC's

My understanding is that if you set the ownership of these resources to the Kafka CRD, this would no longer occur as they would be seen of children of the Kafka instance:

something similar to:

 ownerReferences:
  - apiVersion: kafka.strimzi.io/v1beta2
    kind: Kafka
    name: kafka
    uid: 7e8a15f3-3698-4876-a20e-1535520daeeb

on each PVC would solve this issue completely

Steps to reproduce

Deploy a stateful kafka cluster using Argocd application

Expected behavior

We should be able to fully utilize this operator with a GitOps pattern

Strimzi version

0.37.0

Kubernetes version

1.29

Installation method

helm

Infrastructure

Scaleway Kapsule

Configuration files and logs

No response

Additional context

No response

@scholzj
Copy link
Member

scholzj commented Nov 28, 2024

If you set the owner reference, the PVC will get automatically deleted when the owner (the Kafka CR) is deleted. This is not desired as it might lead to data loss. For this reason, we do not set it by default - similarly to how StatefulSet does it for example.

If you want, you can tell Strimzi to use the owner reference in the Kafka CR (through the deleteClaim flag in the storage configuration - check the docs for details). But we recommend this only for development and test clusters. For production, you should ideally just configure your Argo to not delete it. There are multiple past issues and discussions on this topic where you find the various ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants