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 apps.krusie.io/v1alpha1/DaemonSet #3358

Merged

Conversation

yike21
Copy link
Member

@yike21 yike21 commented Apr 2, 2023

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Add third-party resources apps.krusie.io/v1alpha1/DaemonSet 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 `apps.krusie.io/v1alpha1/DaemonSet`

@karmada-bot karmada-bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Apr 2, 2023
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 2, 2023
@yike21 yike21 force-pushed the bundle-kruise-resources-DaemonSet branch 2 times, most recently from ce9584b to 48c2e6b Compare April 10, 2023 07:44
@codecov-commenter
Copy link

codecov-commenter commented Apr 10, 2023

Codecov Report

Merging #3358 (f051591) into master (c3d54cc) will not change coverage.
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    #3358   +/-   ##
=======================================
  Coverage   51.64%   51.64%           
=======================================
  Files         210      210           
  Lines       18926    18926           
=======================================
  Hits         9775     9775           
  Misses       8620     8620           
  Partials      531      531           
Flag Coverage Δ
unittests 51.64% <ø> (ø)

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

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

status.daemonSetHash = observedObj.status.daemonSetHash
return status
end
healthInterpretation:
Copy link
Member Author

@yike21 yike21 Apr 13, 2023

Choose a reason for hiding this comment

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

The healthInterpretation rule for daemonset.apps.kruise.io is a reference to the code in pkg/resourceinterpreter/default/native/healthy.go corresponding to native daemonset. The idea is changed from "determine what is healthy" to "determine what is unhealthy/illegal". It allows a member cluster to be considered healthy when the pod is not fully ready, and to be aggregated.

@yike21 yike21 force-pushed the bundle-kruise-resources-DaemonSet branch 3 times, most recently from 63ea28a to 2e0d448 Compare April 13, 2023 15:42
@yike21
Copy link
Member Author

yike21 commented Apr 13, 2023

The test report based on karmadactl interpret is below:

### Check the customizations in file
byk@debian:~/go/src/karmada/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet$ karmadactl interpret -f customizations.yaml --check
I0413 23:38:50.698903 2877496 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"}
I0413 23:38:50.699064 2877496 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"}
I0413 23:38:50.708950 2877496 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"}
I0413 23:38:50.709085 2877496 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-daemonset
TARGET: apps.kruise.io/v1alpha1 DaemonSet   
RULERS:
    Retain:                                 UNSET
    InterpretReplica:                       UNSET
    ReviseReplica:                          UNSET
    InterpretStatus:                        PASS
    AggregateStatus:                        PASS
    InterpretHealth:                        PASS
    InterpretDependency:                    PASS

### Execute the statusReflection rule
byk@debian:~/go/src/karmada/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet$ karmadactl interpret -f customizations.yaml --operation interpretStatus --observed-file testdata/observed-daemonset-nginx.yaml 
I0413 23:39:07.022272 2877557 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"}
I0413 23:39:07.022430 2877557 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"}
I0413 23:39:07.032730 2877557 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"}
I0413 23:39:07.033008 2877557 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:
currentNumberScheduled: 1
daemonSetHash: 7dd59cf749
desiredNumberScheduled: 1
numberAvailable: 1
numberMisscheduled: 0
numberReady: 1
observedGeneration: 1
updatedNumberScheduled: 1

### Execute the healthInterpretation rule
byk@debian:~/go/src/karmada/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet$ karmadactl interpret -f customizations.yaml --operation interpretHealth --observed-file testdata/observed-daemonset-nginx.yaml 
I0413 23:39:12.897887 2877596 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"}
I0413 23:39:12.898102 2877596 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"}
I0413 23:39:12.913925 2877596 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"}
I0413 23:39:12.914133 2877596 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
byk@debian:~/go/src/karmada/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet$ karmadactl interpret -f customizations.yaml --operation interpretDependency --observed-file testdata/observed-daemonset-nginx.yaml 
I0413 23:39:33.320548 2877621 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"}
I0413 23:39:33.320732 2877621 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"}
I0413 23:39:33.332483 2877621 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"}
I0413 23:39:33.332623 2877621 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: my-sample-config
  namespace: test-kruise-daemonset
- apiVersion: v1
  kind: ConfigMap
  name: mysql-config
  namespace: test-kruise-daemonset

### Execute the statusAggregation rule
byk@debian:~/go/src/karmada/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet$ karmadactl interpret -f customizations.yaml --operation aggregateStatus --observed-file testdata/observed-daemonset-nginx.yaml --status-file testdata/status-file.yaml 
I0413 23:40:04.475707 2877671 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"}
I0413 23:40:04.475969 2877671 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"}
I0413 23:40:04.490717 2877671 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"}
I0413 23:40:04.490849 2877671 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: apps.kruise.io/v1alpha1
kind: DaemonSet
metadata:
    generation: 1
    labels:
        app: sample-daemonset
    name: sample
    namespace: test-kruise-daemonset
spec:
    selector:
        matchLabels:
            app: sample-daemonset
    template:
        metadata:
            labels:
                app: sample-daemonset
        spec:
            containers:
                - env:
                    - name: logData
                      valueFrom:
                        configMapKeyRef:
                            key: log
                            name: mysql-config
                    - name: lowerData
                      valueFrom:
                        configMapKeyRef:
                            key: lower
                            name: mysql-config
                  image: nginx:alpine
                  name: nginx
            volumes:
                - configMap:
                    name: my-sample-config
                  name: configmap
status:
    currentNumberScheduled: 2
    daemonSetHash: 7dd59cf749
    desiredNumberScheduled: 2
    numberAvailable: 2
    numberMisscheduled: 0
    numberReady: 2
    numberUnavailable: 0
    observedGeneration: 1
    updatedNumberScheduled: 2

Signed-off-by: yike21 <yike21@qq.com>
@yike21 yike21 force-pushed the bundle-kruise-resources-DaemonSet branch from 2e0d448 to f051591 Compare April 14, 2023 03:06
@Poor12
Copy link
Member

Poor12 commented Apr 14, 2023

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 14, 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 Apr 14, 2023
@karmada-bot karmada-bot merged commit 0553306 into karmada-io:master Apr 14, 2023
11 checks passed
@yike21 yike21 deleted the bundle-kruise-resources-DaemonSet branch April 14, 2023 06:59
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

4 participants