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/AdvancedCronJob #3368

Merged

Conversation

yike21
Copy link
Member

@yike21 yike21 commented Apr 5, 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/AdvancedCronJob 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/AdvancedCronJob`

@karmada-bot karmada-bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Apr 5, 2023
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 5, 2023
@yike21 yike21 force-pushed the bundle-kruise-resources-cronjob branch 3 times, most recently from 251a381 to 4785d4e Compare April 10, 2023 07:39
desiredObj.status.lastScheduleTime = lastScheduleTime
return desiredObj
end
healthInterpretation:
Copy link
Member Author

Choose a reason for hiding this comment

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

For AdvancedCronJob, its .spec.template is either a jobTemplate or a broadcastJobTemplate, and .status.type indicates the type of the template, which is the only one considered legal in the health judgment.

Copy link
Member

Choose a reason for hiding this comment

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

For AdvancedCronJob, status only reflects template information, not the status of actual workloads. So interpretHealth is not needed.

@yike21 yike21 force-pushed the bundle-kruise-resources-cronjob branch 3 times, most recently from c947db0 to 5845ddb Compare April 14, 2023 07:25
@yike21
Copy link
Member Author

yike21 commented Apr 14, 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/CronJob$ karmadactl interpret -f customizations.yaml --check
I0414 15:24:18.047536 2954857 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"}
I0414 15:24:18.047705 2954857 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"}
I0414 15:24:18.056998 2954857 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"}
I0414 15:24:18.057131 2954857 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-advancedcronjob
TARGET: apps.kruise.io/v1alpha1 AdvancedCronJob   
RULERS:
    Retain:                                       UNSET
    InterpretReplica:                             UNSET
    ReviseReplica:                                UNSET
    InterpretStatus:                              UNSET
    AggregateStatus:                              PASS
    InterpretHealth:                              UNSET
    InterpretDependency:                          PASS

### Execute the statusAggregation rule
byk@debian:~/go/src/karmada/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CronJob$ karmadactl interpret -f customizations.yaml --operation aggregateStatus --observed-file testdata/observed-acj-nginx.yaml --status-file testdata/status-file.yaml 
I0414 15:24:44.501376 2954911 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"}
I0414 15:24:44.501563 2954911 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"}
I0414 15:24:44.513731 2954911 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"}
I0414 15:24:44.514235 2954911 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: AdvancedCronJob
metadata:
    labels:
        app: sample
    name: sample
    namespace: test-acj
spec:
    schedule: '*/2 * * * *'
    template:
        broadcastJobTemplate:
            spec:
                completionPolicy:
                    type: Never
                template:
                    metadata:
                        labels:
                            app: sample
                    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
                        restartPolicy: Never
                        volumes:
                            - configMap:
                                name: my-sample-config
                              name: configmap
status:
    active:
        - apiVersion: apps.kruise.io/v1alpha1
          kind: BroadcastJob
          name: sample-1681378080
          namespace: test-acj
          resourceVersion: "3636404"
          uid: f96013ef-2869-49d7-adf3-8f7231cc5e2a
        - apiVersion: apps.kruise.io/v1alpha1
          kind: BroadcastJob
          name: sample-1681378080
          namespace: test-acj
          resourceVersion: "3635081"
          uid: d1f3c194-d650-4cce-b23d-307a445bb92e
    lastScheduleTime: "2023-04-13T09:30:00Z"
    type: BroadcastJob

### Execute the dependencyInterpretation rule
byk@debian:~/go/src/karmada/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CronJob$ karmadactl interpret -f customizations.yaml --operation interpretDependency --observed-file testdata/observed-acj-nginx.yaml 
I0414 15:25:07.628068 2954947 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"}
I0414 15:25:07.628536 2954947 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"}
I0414 15:25:07.650315 2954947 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"}
I0414 15:25:07.651070 2954947 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-acj
- apiVersion: v1
  kind: ConfigMap
  name: mysql-config
  namespace: test-acj

@yike21 yike21 force-pushed the bundle-kruise-resources-cronjob branch from 5845ddb to 9628830 Compare April 14, 2023 07:34
@yike21
Copy link
Member Author

yike21 commented Apr 14, 2023

make git rebase : force-pushed the bundle-kruise-resources-cronjob branch from 5845ddb to 9628830

@codecov-commenter
Copy link

Codecov Report

Merging #3368 (9628830) into master (0553306) 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    #3368   +/-   ##
=======================================
  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.

@yike21
Copy link
Member Author

yike21 commented Apr 14, 2023

/cc @Poor12

@karmada-bot karmada-bot requested a review from Poor12 April 14, 2023 08:42
@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 ab9404a into karmada-io:master Apr 14, 2023
@yike21 yike21 deleted the bundle-kruise-resources-cronjob branch April 15, 2023 11:39
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