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 helm.toolkit.fluxcd.io/v2beta1/HelmRelease #3488

Merged
merged 1 commit into from
May 4, 2023

Conversation

yike21
Copy link
Member

@yike21 yike21 commented May 1, 2023

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Add third-party resource helm.toolkit.fluxcd.io/v2beta1/HelmRelease 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 `helm.toolkit.fluxcd.io/v2beta1/HelmRelease`

@karmada-bot karmada-bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label May 1, 2023
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 1, 2023
@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 15:29:23.715228  901593 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 15:29:23.715389  901593 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 15:29:23.726673  901593 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 15:29:23.726775  901593 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-helmrelease
TARGET: helm.toolkit.fluxcd.io/v2beta1 HelmRelease   
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-helmrelease.yaml --observed-file testdata/observed-helmrelease.yaml 
I0501 15:29:43.872279  902031 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 15:29:43.872458  902031 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 15:29:43.883970  902031 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 15:29:43.884104  902031 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: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
    name: sample
    namespace: default
spec:
    chart:
        spec:
            chart: ./charts/podinfo
            interval: 1m
            sourceRef:
                kind: GitRepository
                name: podinfo
                namespace: default
            version: '>=4.0.0 <5.0.0'
    interval: 5m
    test:
        enable: true
        ignoreFailures: true

### Execute the statusReflection rule
$ karmadactl interpret -f customizations.yaml --operation interpretStatus --observed-file testdata/observed-helmrelease.yaml 
I0501 15:30:03.407351  902463 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 15:30:03.407497  902463 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 15:30:03.417331  902463 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 15:30:03.417591  902463 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:
conditions:
    - lastTransitionTime: "2023-05-01T07:11:16Z"
      message: Release reconciliation succeeded
      reason: ReconciliationSucceeded
      status: "True"
      type: Ready
    - lastTransitionTime: "2023-05-01T07:11:16Z"
      message: Helm install succeeded
      reason: InstallSucceeded
      status: "True"
      type: Released
helmChart: test-helmrelease/test-helmrelease-sample
lastAppliedRevision: 6.3.5
lastAttemptedRevision: 6.3.5
lastAttemptedValuesChecksum: da39a3ee5e6b4b0d3255bfef95601890afd80709
lastReleaseRevision: 1
observedGeneration: 1

### Execute the healthInterpretation rule 
$ karmadactl interpret -f customizations.yaml --operation interpretHealth --observed-file testdata/observed-helmrelease.yaml 
I0501 15:30:19.384058  902853 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 15:30:19.384204  902853 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 15:30:19.393197  902853 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 15:30:19.393820  902853 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-helmrelease.yaml 
I0501 15:30:39.998897  903311 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 15:30:39.999133  903311 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 15:30:40.014558  903311 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 15:30:40.015327  903311 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: ConfigMap
  name: fake-configmap
  namespace: default
- apiVersion: v1
  kind: Secret
  name: fake-secret
  namespace: default
- apiVersion: v1
  kind: Secret
  name: fake-verify-secret
  namespace: default
- apiVersion: v1
  kind: ServiceAccount
  name: fake-sa
  namespace: default

### Execute the statusAggregation rule
$ karmadactl interpret -f customizations.yaml --operation aggregateStatus --observed-file testdata/observed-helmrelease.yaml --status-file testdata/status-file.yaml 
I0501 15:38:14.893089  913057 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 15:38:14.893241  913057 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 15:38:14.902996  913057 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 15:38:14.903090  913057 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: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
    name: sample
    namespace: default
spec:
    chart:
        spec:
            chart: ./charts/podinfo
            interval: 1m
            sourceRef:
                kind: GitRepository
                name: podinfo
                namespace: default
            verify:
                secretRef:
                    name: fake-verify-secret
            version: '>=4.0.0 <5.0.0'
    interval: 5m
    kubeConfig:
        secretRef:
            name: fake-secret
    serviceAccountName: fake-sa
    test:
        enable: true
        ignoreFailures: true
    valuesFrom:
        - kind: ConfigMap
          name: fake-configmap
status:
    conditions:
        - lastTransitionTime: "2023-05-01T07:11:16Z"
          message: member1=Release reconciliation succeeded, member3=Release reconciliation succeeded
          reason: ReconciliationSucceeded
          status: "True"
          type: Ready
        - lastTransitionTime: "2023-05-01T07:11:16Z"
          message: member1=Helm install succeeded, member3=Helm install succeeded
          reason: InstallSucceeded
          status: "True"
          type: Released
    helmChart: test-helmrelease/test-helmrelease-sample
    lastAppliedRevision: 6.3.5
    lastAttemptedRevision: 6.3.5
    lastAttemptedValuesChecksum: da39a3ee5e6b4b0d3255bfef95601890afd80709
    lastReleaseRevision: 1

@codecov-commenter
Copy link

Codecov Report

Merging #3488 (2f421ea) into master (b841c54) will decrease coverage by 0.02%.
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    #3488      +/-   ##
==========================================
- Coverage   53.61%   53.60%   -0.02%     
==========================================
  Files         210      210              
  Lines       19182    19182              
==========================================
- Hits        10284    10282       -2     
- Misses       8345     8347       +2     
  Partials      553      553              
Flag Coverage Δ
unittests 53.60% <ø> (-0.02%) ⬇️

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

see 1 file with indirect coverage changes

@Poor12
Copy link
Member

Poor12 commented May 4, 2023

It works well in my local env.
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label May 4, 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 4, 2023
@karmada-bot karmada-bot merged commit faf0d4b into karmada-io:master May 4, 2023
@yike21 yike21 deleted the bundle-fluxcd-helmrelease branch May 4, 2023 09:38
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.

4 participants