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

Watch changes in the referenced objects #212

Closed
Tracked by #213
turkenh opened this issue Mar 8, 2024 · 1 comment · Fixed by #235
Closed
Tracked by #213

Watch changes in the referenced objects #212

turkenh opened this issue Mar 8, 2024 · 1 comment · Fixed by #235
Labels
enhancement New feature or request
Milestone

Comments

@turkenh
Copy link
Collaborator

turkenh commented Mar 8, 2024

What problem are you facing?

Today, it is possible to reference k8s objects in the control plane API by with spec.references field. For example, the following manifest will read the ConfigMap named foo in the default namespace and propagate it to another cluster/namespace.

apiVersion: kubernetes.crossplane.io/v1alpha2
kind: Object
metadata:
  name: foo-copy
spec:
  references:
  # Use patchesFrom to patch field from other k8s resource to this object
  - patchesFrom:
      apiVersion: v1
      kind: ConfigMap
      name: foo
      namespace: default
      fieldPath: data
    toFieldPath: data
  forProvider:
    manifest:
      apiVersion: v1
      kind: ConfigMap
      metadata:
        namespace: default
  providerConfigRef:
    name: another-cluster

This problem is that if the ConfigMap foo on the control plane changes, it takes up to the poll interval (up to 10mins by default) for it to be propagated again.

This sounds similar to #159 but different since here were proposing the objects that are part of the desired state. That issue wants to be aware of changes in the observed state as soon as possible by watching them.

How could Crossplane help solve your problem?

Watch changes in the referenced objects so that updates on the referenced object reconciled immediately instead of waiting for the poll interval.

@turkenh turkenh added the enhancement New feature or request label Mar 8, 2024
@jeanduplessis jeanduplessis added this to the v1.0.0 milestone Mar 8, 2024
@turkenh
Copy link
Collaborator Author

turkenh commented Mar 13, 2024

Leaving some breadcrumbs (from @sttts):

There will be similarities to Crossplane realtime compositions but this will be a lot simpler since the main controller (XRs in crossplane) does not come and go, and there is only one. So it is only about the referenced objects. In Crossplane we have many XRs, dynamically updated, and all share the composed object informers.

We don't need RegisterComposite in composedResourceInformers, but WatchComposedResources and cleanupComposedResourceInformers will be very similar. We might copy those nearly 1:1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants