Skip to content

v0.9.0 modifies custom resource specΒ #308

@piotr-bzdyl-vertexinc

Description

@piotr-bzdyl-vertexinc

After upgrading to v0.9.0 we have noticed that the operator modifies the spec of the custom resource, e.g. PulsarTopic. This causes endless competition between the operator and continuous deployment (e.g. FluxCD:

  • continuous deployment process ensures the resource matches the code from git
  • pulsar-resources-operator applies this change but modifies the spec part of the resource
  • continuous deployment process detects drift in the resource spec, thus it applies it again to match the code from git
  • pulsar-resources-operator detects the change in the resource and modifies the spec part again
  • and so on...

I was able to reproduce it with the following PulsarTopic applied by continuous deployment:

apiVersion: resource.streamnative.io/v1alpha1
kind: PulsarTopic
metadata:
  name: test-topic
spec:
  connectionRef:
    name: test-cluster
  name: persistent://test-tenant/test-ns/test-topic
  persistent: true
  retentionTime: 14d
  retentionSize: -1

The operator modifies it by adding spec.partitions: 0 and changing type of spec.retentionSize from int to string:

apiVersion: resource.streamnative.io/v1alpha1
kind: PulsarTopic
metadata:
  name: test-topic
spec:
  connectionRef:
    name: test-cluster
  name: persistent://test-tenant/test-ns/test-topic
  partitions: 0
  persistent: true
  retentionTime: 14d
  retentionSize: "-1"

We had also modifications made in the following PulsarTopic

apiVersion: resource.streamnative.io/v1alpha1
kind: PulsarTopic
metadata:
  name: test-topic
spec:
  connectionRef:
    name: test-cluster
  name: persistent://test-tenant/test-ns/test-topic
  persistent: true
  retentionTime: 14d
  retentionSize: -1
  schemaInfo:
    type: STRING
    schema: ""

In this case the operator deletes spec.schemaInfo.schema from the kubernetes resource:

apiVersion: resource.streamnative.io/v1alpha1
kind: PulsarTopic
metadata:
  name: test-topic
spec:
  connectionRef:
    name: test-cluster
  name: persistent://test-tenant/test-ns/test-topic
  partitions: 0
  persistent: true
  retentionTime: 14d
  retentionSize: "-1"
  schemaInfo:
    type: STRING

According to https://github.com/streamnative/pulsar-resources-operator/blob/main/docs/pulsar_topic.md#schemainfo spec.schemaInfo.schema is required, which is even more confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions