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

Align federated GitRepository's observedGeneration semantics with its native #5086

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

yike21
Copy link
Member

@yike21 yike21 commented Jun 23, 2024

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.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 23, 2024
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 23, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

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

❗ 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.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yike21
Copy link
Member Author

yike21 commented Jun 23, 2024

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

@XiShanYongYe-Chang
Copy link
Member

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

@veophi
Copy link

veophi commented Jul 8, 2024

/lgtm

@karmada-bot
Copy link
Collaborator

@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.

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

Thanks.

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 8, 2024
@karmada-bot
Copy link
Collaborator

[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 karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 8, 2024
@karmada-bot karmada-bot merged commit f869fba into karmada-io:master Jul 8, 2024
12 checks passed
@RainbowMango RainbowMango added this to the v1.11 milestone Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants