karmada icon indicating copy to clipboard operation
karmada copied to clipboard

Align federated GitRepository's observedGeneration semantics with its native

Open yike21 opened this issue 1 year ago • 4 comments

What type of PR is this? /kind feature

What this PR does / why we need it: Part of #4870

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?: NONE

`karmada-controller-manager`: Mark `.status.observedGeneration` of GitRepository with `.metadata.generation` only when all members' statuses are algined with its resource template generation.

yike21 avatar Jun 23 '24 09:06 yike21

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (master@5e35497). Learn more about missing BASE report.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5086   +/-   ##
=========================================
  Coverage          ?   28.21%           
=========================================
  Files             ?      632           
  Lines             ?    43551           
  Branches          ?        0           
=========================================
  Hits              ?    12289           
  Misses            ?    30365           
  Partials          ?      897           
Flag Coverage Δ
unittests 28.21% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jun 23 '24 09:06 codecov-commenter

Use karmadactl interpret to view test results:

## Execute the statusAggregation rule
$ karmadactl interpret -f customizations.yaml --operation aggregateStatus --desired-file testdata/desired-gitrepository.yaml  --status-file testdata/status-file.yaml 
---
# [1/1] aggregatedStatus:
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
    generation: 1
    name: sample
    namespace: test-gitrepository
spec:
    interval: 30s
    ref:
        branch: master
    url: https://github.com/stefanprodan/podinfo
status:
    artifact:
        digest: sha256:a375b2ca68275734e3850d3c80e0bc20c1d7a4daa1a9717056d5c0c563ea0719
        lastUpdateTime: "2023-05-01T10:17:08Z"
        path: gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz
        revision: master@sha1:0647aea75b85755411b007a290b9321668370be5
        size: 83516
        url: http://source-controller.flux-system.svc.cluster.local./gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz
    conditions:
        - lastTransitionTime: "2023-05-01T10:17:09Z"
          message: member1=stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5', member3=stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5'
          observedGeneration: 1
          reason: Succeeded
          status: "True"
          type: Ready
        - lastTransitionTime: "2023-05-01T10:17:09Z"
          message: member1=stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5', member3=stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5'
          observedGeneration: 1
          reason: Succeeded
          status: "True"
          type: ArtifactInStorage
    observedGeneration: 1

## Execute the statusReflection rule
$ karmadactl interpret -f customizations.yaml --operation interpretStatus --observed-file testdata/observed-gitrepository.yaml 
---
# [1/1] status:
artifact:
    digest: sha256:a375b2ca68275734e3850d3c80e0bc20c1d7a4daa1a9717056d5c0c563ea0719
    lastUpdateTime: "2023-05-01T10:17:09Z"
    path: gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz
    revision: master@sha1:0647aea75b85755411b007a290b9321668370be5
    size: 83516
    url: http://source-controller.flux-system.svc.cluster.local./gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz
conditions:
    - lastTransitionTime: "2023-05-01T10:17:09Z"
      message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5'
      observedGeneration: 1
      reason: Succeeded
      status: "True"
      type: Ready
    - lastTransitionTime: "2023-05-01T10:17:09Z"
      message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5'
      observedGeneration: 1
      reason: Succeeded
      status: "True"
      type: ArtifactInStorage
generation: 1
observedGeneration: 1
resourceTemplateGeneration: 1

yike21 avatar Jun 23 '24 09:06 yike21

Hi @veophi, can you help take a review? cc @veophi

XiShanYongYe-Chang avatar Jun 24 '24 03:06 XiShanYongYe-Chang

/lgtm

veophi avatar Jul 08 '24 02:07 veophi

@veophi: changing LGTM is restricted to collaborators

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

karmada-bot avatar Jul 08 '24 02:07 karmada-bot

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

karmada-bot avatar Jul 08 '24 02:07 karmada-bot