kubestellar icon indicating copy to clipboard operation
kubestellar copied to clipboard

:sparkles: CombinedStatus PropagationMeta Augmentation

Open vMaroon opened this issue 6 months ago • 4 comments

Summary

Added propagation-meta to combined-status API along with all required BindingPolicy/Binding API changes, and implemented its support.

Example resources:

Specifications

BindingPolicy:

apiVersion: control.kubestellar.io/v1alpha1
kind: BindingPolicy
metadata:
  name: nginx-bindingpolicy
spec:
  clusterSelectors:
  - matchLabels: {"location-group":"edge"}
  downsync:
  - statusCollection:
      stalenessThresholdSecs: 100 # default is 120
      statusCollectors:
        - deployments-aggregator
        - deployments-stale
    objectSelectors:
    - matchLabels: {"app.kubernetes.io/name":"nginx"}

StatusCollectors:

apiVersion: control.kubestellar.io/v1alpha1
kind: StatusCollector
metadata:
  name: deployments-aggregator
spec:
  limit: 10
  filter: obj.kind == "Deployment"
  combinedFields:
    - name: deployed-replicas-sum
      type: SUM
      subject: returned.status.availableReplicas
--

apiVersion: control.kubestellar.io/v1alpha1
kind: StatusCollector
metadata:
  name: deployments-stale
spec:
  limit: 10
  filter: obj.kind == "Deployment" && propagation.stale == true
  combinedFields:
    - name: count
      type: COUNT

Generated Objects

Binding:

- apiVersion: control.kubestellar.io/v1alpha1
  kind: Binding
  metadata:
    creationTimestamp: "2024-08-15T15:43:17Z"
    finalizers:
    - transport.kubestellar.io/object-cleanup
    generation: 13
    name: nginx-bindingpolicy
    ownerReferences:
    - apiVersion: control.kubestellar.io/v1alpha1
      blockOwnerDeletion: false
      controller: true
      kind: BindingPolicy
      name: nginx-bindingpolicy
      uid: 5a9ffb8c-244f-459c-a7f4-9359d8be4f33
    resourceVersion: "2709"
    uid: 14eb026b-45cb-4437-a73e-071599e807c7
  spec:
    destinations:
    - clusterId: cluster1
    - clusterId: cluster2
    workload:
      clusterScope:
      - group: ""
        name: nginx
        resource: namespaces
        resourceVersion: "309"
        stalenessThresholdSecs: 100
        statusCollectors:
        - deployments-aggregator
        - deployments-stale
        version: v1
      namespaceScope:
      - group: apps
        name: nginx
        namespace: nginx
        resource: deployments
        resourceVersion: "342"
        stalenessThresholdSecs: 100
        statusCollectors:
        - deployments-aggregator
        - deployments-stale
        version: v1

CombinedStatus

- apiVersion: control.kubestellar.io/v1alpha1
  kind: CombinedStatus
  metadata:
    creationTimestamp: "2024-08-15T15:43:22Z"
    generation: 21
    labels:
      status.kubestellar.io/api-group: apps
      status.kubestellar.io/binding-policy: nginx-bindingpolicy
      status.kubestellar.io/name: nginx
      status.kubestellar.io/namespace: nginx
      status.kubestellar.io/resource: deployments
    name: f4b1abaf-6149-4bdb-b162-5ad0cebdada3.5a9ffb8c-244f-459c-a7f4-9359d8be4f33
    namespace: nginx
    resourceVersion: "2712"
    uid: 878e457b-e7b9-47f5-968c-1b18b0a4b6e9
  results:
  - columnNames:
    - deployed-replicas-sum
    name: deployments-aggregator
    rows:
    - columns:
      - float: "2"
        type: Number
  - columnNames:
    - count
    name: deployments-stale
    rows:
    - columns:
      - float: "2"
        type: Number

When the BindingPolicy is changed with a high staleness-threshold, the resulting CombinedStatus would be:

- apiVersion: control.kubestellar.io/v1alpha1
  kind: CombinedStatus
  metadata:
    creationTimestamp: "2024-08-15T15:43:22Z"
    generation: 24
    labels:
      status.kubestellar.io/api-group: apps
      status.kubestellar.io/binding-policy: nginx-bindingpolicy
      status.kubestellar.io/name: nginx
      status.kubestellar.io/namespace: nginx
      status.kubestellar.io/resource: deployments
    name: f4b1abaf-6149-4bdb-b162-5ad0cebdada3.5a9ffb8c-244f-459c-a7f4-9359d8be4f33
    namespace: nginx
    resourceVersion: "3085"
    uid: 878e457b-e7b9-47f5-968c-1b18b0a4b6e9
  results:
  - columnNames:
    - deployed-replicas-sum
    name: deployments-aggregator
    rows:
    - columns:
      - float: "2"
        type: Number
  - columnNames:
    - count
    name: deployments-stale

Related issue(s)

  • #2141

vMaroon avatar Aug 15 '24 16:08 vMaroon