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

add customizations for source.toolkit.fluxcd.io/v1beta2/OCIRepository #3482

Merged
merged 1 commit into from
May 6, 2023

Conversation

yike21
Copy link
Member

@yike21 yike21 commented Apr 29, 2023

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Add third-party resources source.toolkit.fluxcd.io/v1beta2/OCIRepository into Resource Interpreter framework.

Which issue(s) this PR fixes:
Part of #3331

Special notes for your reviewer:
@Poor12

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

`Resource Interpreter`: Support `source.toolkit.fluxcd.io/v1beta2/OCIRepository`

@karmada-bot karmada-bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Apr 29, 2023
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 29, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #3482 (82c246a) into master (db01a12) will decrease coverage by 0.01%.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #3482      +/-   ##
==========================================
- Coverage   53.62%   53.62%   -0.01%     
==========================================
  Files         210      210              
  Lines       19182    19182              
==========================================
- Hits        10287    10286       -1     
- Misses       8343     8344       +1     
  Partials      552      552              
Flag Coverage Δ
unittests 53.62% <ø> (-0.01%) ⬇️

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

see 1 file with indirect coverage changes

@yike21 yike21 force-pushed the bundle-fluxcd-helmrepository branch from 82c246a to e600e60 Compare May 1, 2023 10:42
@yike21
Copy link
Member Author

yike21 commented May 1, 2023

The test report base on karmadactl interpret is below:

### Check the customizations in file
$ karmadactl interpret -f customizations.yaml --check
I0501 18:39:59.663208 1133844 deploy.go:75] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:39:59.663658 1133844 enable_option.go:63] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:39:59.676541 1133844 cmdinit.go:149] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:39:59.676863 1133844 register.go:160] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
-----------------------------------
SOURCE: declarative-configuration-ocirepository
TARGET: source.toolkit.fluxcd.io/v1beta2 OCIRepository   
RULERS:
    Retain:                                              PASS
    InterpretReplica:                                    UNSET
    ReviseReplica:                                       UNSET
    InterpretStatus:                                     PASS
    AggregateStatus:                                     PASS
    InterpretHealth:                                     PASS
    InterpretDependency:                                 PASS

### Execute the retention rule
$ karmadactl interpret -f customizations.yaml --operation retain --desired-file testdata/desired-ocirepository.yaml --observed-file testdata/observed-ocirepository.yaml 
I0501 18:40:13.367630 1134058 deploy.go:75] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:40:13.368063 1134058 enable_option.go:63] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:40:13.377319 1134058 cmdinit.go:149] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:40:13.377413 1134058 register.go:160] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
---
# [1/1] retained:
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
    name: sample
    namespace: test-ocirepository
spec:
    interval: 5m
    ref:
        semver: 6.2.x
    suspend: true
    url: oci://ghcr.io/stefanprodan/podinfo-deploy

### Execute the statusReflection rule
$ karmadactl interpret -f customizations.yaml --operation interpretStatus --observed-file testdata/observed-ocirepository.yaml 
I0501 18:40:42.048515 1134414 deploy.go:75] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:40:42.048773 1134414 enable_option.go:63] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:40:42.062364 1134414 cmdinit.go:149] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:40:42.062491 1134414 register.go:160] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
---
# [1/1] status:
artifact:
    digest: sha256:b6ccead26c790c8a0d40579905edc6d83f732ceacc0f4133f578fed456a2438a
    lastUpdateTime: "2023-04-29T06:07:53Z"
    metadata:
        org.opencontainers.image.created: "2022-11-09T11:24:23Z"
        org.opencontainers.image.revision: 6.2.3/8615cb75d926ea0ba5353b1d56867868c737bf5e
        org.opencontainers.image.source: https://github.com/stefanprodan/podinfo
    path: ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz
    revision: 6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792
    size: 1103
    url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz
conditions:
    - lastTransitionTime: "2023-04-29T06:07:53Z"
      message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792'
      observedGeneration: 1
      reason: Succeeded
      status: "True"
      type: Ready
    - lastTransitionTime: "2023-04-29T06:07:53Z"
      message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792'
      observedGeneration: 1
      reason: Succeeded
      status: "True"
      type: ArtifactInStorage
url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/latest.tar.gz

### Execute the healthInterpretation rule
$ karmadactl interpret -f customizations.yaml --operation interpretHealth --observed-file testdata/observed-ocirepository.yaml 
I0501 18:41:00.268049 1134670 deploy.go:75] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:41:00.268219 1134670 enable_option.go:63] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:41:00.278142 1134670 cmdinit.go:149] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:41:00.278247 1134670 register.go:160] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
---
# [1/1] healthy:
true

### Execute the dependencyInterpretation rule
$ karmadactl interpret -f customizations.yaml --operation interpretDependency --observed-file testdata/observed-ocirepository.yaml 
I0501 18:41:14.375932 1134889 deploy.go:75] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:41:14.376089 1134889 enable_option.go:63] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:41:14.386914 1134889 cmdinit.go:149] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:41:14.387347 1134889 register.go:160] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
---
# [1/1] dependencies:
- apiVersion: v1
  kind: Secret
  name: fake-secret
  namespace: test-ocirepository
- apiVersion: v1
  kind: ServiceAccount
  name: fake-serviceaccount
  namespace: test-ocirepository

### Execute the statusAggregation rule
$ karmadactl interpret -f customizations.yaml --operation aggregateStatus --observed-file testdata/observed-ocirepository.yaml --status-file testdata/status-file.yaml 
I0501 18:41:32.842745 1135145 deploy.go:75] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:41:32.842943 1135145 enable_option.go:63] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:41:32.853589 1135145 cmdinit.go:149] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
I0501 18:41:32.853681 1135145 register.go:160] No default release version found. build version: version.Info{GitVersion:"", GitCommit:"c8720e81c7f4badb2a2e07ed7218391b3ea7d912", GitTreeState:"dirty", BuildDate:"2023-04-12T09:43:27Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
---
# [1/1] aggregatedStatus:
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
    name: sample
    namespace: test-ocirepository
spec:
    interval: 5m
    provider: generic
    ref:
        semver: 6.2.x
    secretRef:
        name: fake-secret
    serviceAccountName: fake-serviceaccount
    suspend: true
    timeout: 60s
    url: oci://ghcr.io/stefanprodan/podinfo-deploy
status:
    artifact:
        digest: sha256:b6ccead26c790c8a0d40579905edc6d83f732ceacc0f4133f578fed456a2438a
        lastUpdateTime: "2023-04-29T06:07:53Z"
        metadata:
            org.opencontainers.image.created: "2022-11-09T11:24:23Z"
            org.opencontainers.image.revision: 6.2.3/8615cb75d926ea0ba5353b1d56867868c737bf5e
            org.opencontainers.image.source: https://github.com/stefanprodan/podinfo
        path: ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz
        revision: 6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792
        size: 1103
        url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz
    conditions:
        - lastTransitionTime: "2023-04-29T06:07:53Z"
          message: member1=stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792', member3=stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792'
          observedGeneration: 1
          reason: Succeeded
          status: "True"
          type: Ready
        - lastTransitionTime: "2023-04-29T06:07:53Z"
          message: member1=stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792', member3=stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792'
          observedGeneration: 1
          reason: Succeeded
          status: "True"
          type: ArtifactInStorage
    url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/latest.tar.gz

@yike21 yike21 force-pushed the bundle-fluxcd-helmrepository branch 3 times, most recently from 2747a0f to 2b159d6 Compare May 4, 2023 16:15
@yike21 yike21 force-pushed the bundle-fluxcd-helmrepository branch from 2b159d6 to ac4fe4f Compare May 5, 2023 13:06
@Poor12
Copy link
Member

Poor12 commented May 6, 2023

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label May 6, 2023
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Poor12

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 May 6, 2023
@karmada-bot karmada-bot merged commit 0e10088 into karmada-io:master May 6, 2023
@yike21 yike21 deleted the bundle-fluxcd-helmrepository branch May 6, 2023 02:02
semver: 6.2.x
secretRef:
name: fake-secret
serviceAccountName: fake-serviceaccount
Copy link
Member

Choose a reason for hiding this comment

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

How was this serviceAccountName generated?
/cc @yike21

Copy link
Member

Choose a reason for hiding this comment

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

I did not see this serviceAccountName field in the desired-ocirepository.yaml file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! This is just for testing 'dependencyInterpretation'. In fact, .spec.serviceAccountName is edited and not generated.

@karmada-bot
Copy link
Collaborator

@chaunceyjiang: GitHub didn't allow me to request PR reviews from the following users: yike21.

Note that only karmada-io members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

How was this serviceAccountName generated?
/cc @yike21

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/test-infra repository.

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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants