Skip to content

add optional reconcile policy configuration to ResourceSync #11

@lukebond

Description

@lukebond

there are some use-cases where we want the sinker to copy across resources once, or whenever the source changes, and never delete the target. e.g. configmaps and secrets. stale information is probably better than it going missing later when we want it.

there are other use-cases where we want the sinker to remove the target when the source is removed, e.g. live status information. we don't want to retain stale status information that could lead to us erroneously reporting a healthy status for something that is gone.

currently it won't ever delete the target, so we have case one only.

a suggested format:

apiVersion: sinker.influxdata.io/v1alpha1
kind: ResourceSync
metadata:
  name: cluster-0001-kustomization-status
  namespace: customer-0001
spec:
  mappings:
  - fromFieldPath: status
    toFieldPath: spec
  - fromFieldPath: metadata.labels
    toFieldPath: metadata.labels
  reconcilePolicy:
    mode: Reconcile
    prune: true
  source:
    cluster:
      kubeConfig:
        secretRef:
          key: value
          name: cluster-0001-kubeconfig
      namespace: iox
    resourceRef:
      apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
      kind: Kustomization
      name: iox-manifests
  target:
    resourceRef:
      apiVersion: tubernetes.influxdata.io/v1beta2
      kind: FluxcdKustomizationStatus
      name: iox-manifests

to give just the relevant section:

  reconcilePolicy:
    mode: Reconcile
    prune: true

the Reconcile policy is what we do now. i can't think of another mode but we may come up with some later. prune means "if the source is gone, delete the target". it should default to false so that current syncs have no change of behaviour, and it's possibly what people would expect as default.

@cannonpalms i feel you had another example in our call that might give us another mode but i can't remember it right now.

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