Skip to content

feature: Related resource label selector #31

@mjudeikis

Description

@mjudeikis

Feature Description

Consider a usecase:

  1. I want to use 3rd party operator to make it "as a service". In this case https://github.com/zalando/postgres-operator
  2. It works quite well but I'm not able to sync resulting secrets due to them not having any ref in the main object. They are just "labelSelector" based.

Example:

k get postgresql -A -o yaml                                                                                                                              07:29:30
apiVersion: v1
items:
- apiVersion: acid.zalan.do/v1
  kind: postgresql
  metadata:
    creationTimestamp: "2025-03-01T20:28:55Z"
    generation: 1
    labels:
      syncagent.kcp.io/agent-name: acid.zalan.do-syncagent
      syncagent.kcp.io/remote-object-cluster: n8png67i0vb069ir
      syncagent.kcp.io/remote-object-name: inmemory-postgres
      syncagent.kcp.io/remote-object-namespace: default
    name: pg-7505d64a54e061b7acd5-2035d4aace33e98627a4
    namespace: n8png67i0vb069ir
    resourceVersion: "4190"
    uid: 1a52f26a-88a6-47e3-abdb-0fa282f71137
  spec:
    numberOfInstances: 1
    postgresql:
      version: "17"
    teamId: example-team
    volume:
      size: 1Gi
  status:
    PostgresClusterStatus: Running
kind: List
metadata:
  resourceVersion: ""

and secrets:

apiVersion: v1
items:
- apiVersion: v1
  data:
    password: b3BBTWJuTDdvelRFenkwOFRScnFCVUMyaWx6RnBtMDg2eXFCcXVkcjdEZ1c4U2VIdkU2dDZ2WlRIajFoQTRzeg==
    username: cG9zdGdyZXM=
  kind: Secret
  metadata:
    creationTimestamp: "2025-03-01T20:28:55Z"
    labels:
      application: spilo
      cluster-name: pg-7505d64a54e061b7acd5-2035d4aace33e98627a4
      team: example-team
    name: postgres.pg-7505d64a54e061b7acd5-2035d4aace33e98627a4.credentials.postgresql.acid.zalan.do
    namespace: n8png67i0vb069ir
    resourceVersion: "4014"
    uid: ef11ddd3-199e-4836-bfe1-70a30fb9f10c
  type: Opaque
- apiVersion: v1
  data:
    password: a3pwZlViZ3F5Mk96S28yeFNYZUViUUZ0TUZSZ0lJNUhJRDN1Njh3ZTlLY20xU1djcTIyS2JiZlFvUHpJN3h0aQ==
    username: c3RhbmRieQ==
  kind: Secret
  metadata:
    creationTimestamp: "2025-03-01T20:28:56Z"
    labels:
      application: spilo
      cluster-name: pg-7505d64a54e061b7acd5-2035d4aace33e98627a4
      team: example-team
    name: standby.pg-7505d64a54e061b7acd5-2035d4aace33e98627a4.credentials.postgresql.acid.zalan.do
    namespace: n8png67i0vb069ir
    resourceVersion: "4015"
    uid: 9fc72851-fad5-4b64-9c83-3b12cfa274ec
  type: Opaque
kind: List
metadata:
  resourceVersion: ""

Proposed Solution

I would want to have something like this:

apiVersion: syncagent.kcp.io/v1alpha1
kind: PublishedResource
metadata:
  name: publish-postgres-postgresql
spec:
  resource:
    kind: postgresql
    apiGroup: acid.zalan.do
    version: v1
  naming:
    # This is the implicit default configuration.
    namespace: "$remoteClusterName"
    name: "pg-$remoteNamespaceHash-$remoteNameHash"
  related:
      identifier: pg-secret"
      origin: service
      kind: Secret
      labelSelector:
        namespace: "$remoteClusterName"
        matchLabels:
          cluster-name: "$remoteClusterName"

I can provide label selectors (potentially namespace too to avoid false-positives as we use namespace isolation).

Alternative Solutions

No response

Want to contribute?

  • I would like to work on this issue.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions