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

feat: add yurtappset validation webhook and default nodepool label #1997

Merged
merged 9 commits into from
Apr 8, 2024

Conversation

vie-serendipity
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind bug
/kind documentation
/kind enhancement
/kind good-first-issue
/kind feature
/kind question
/kind design
/sig ai
/sig iot
/sig network
/sig storage

/kind feature

What this PR does / why we need it:

  1. Add yurtappset validation webhook
  2. Support {{nodepool-name}} for batch modifying
  3. Support statefulset

Which issue(s) this PR fixes:

Fixes #
#1966
#1969
#1970

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 58.11966% with 98 lines in your changes are missing coverage. Please review.

Project coverage is 54.71%. Comparing base (3194f0b) to head (29920a4).
Report is 2 commits behind head on master.

Files Patch % Lines
...ebhook/yurtappset/v1beta1/yurtappset_validation.go 46.03% 30 Missing and 4 partials ⚠️
.../yurtappset/workloadmanager/statefulset_manager.go 60.49% 18 Missing and 14 partials ⚠️
...er/controller/yurtappset/workloadmanager/tweaks.go 71.92% 9 Missing and 7 partials ⚠️
...ger/controller/yurtappset/yurtappset_controller.go 25.00% 7 Missing and 2 partials ⚠️
pkg/yurtmanager/controller/yurtappset/revision.go 60.00% 1 Missing and 3 partials ⚠️
...r/yurtappset/workloadmanager/deployment_manager.go 60.00% 0 Missing and 2 partials ⚠️
...r/webhook/yurtappset/v1beta1/yurtappset_handler.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1997       /-   ##
==========================================
  Coverage   53.06%   54.71%    1.64%     
==========================================
  Files         176      177        1     
  Lines       21000    17271    -3729     
==========================================
- Hits        11144     9450    -1694     
  Misses       8902     6849    -2053     
- Partials      954      972       18     
Flag Coverage Δ
unittests 54.71% <58.11%> ( 1.64%) ⬆️

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.

@vie-serendipity
Copy link
Member Author

/rerun

@rambohe-ch
Copy link
Member

@vie-serendipity Thanks for posting pull request. A lot of files from kubernetes are imported, how about import k8s.io/kubernetes directly? it seems that we can avoid importing k8s.io/kubernetes directly.

feat: import k8s.io/kubernetes directly

chore: delete useless files

feat: remove invalid revision judgement
@vie-serendipity
Copy link
Member Author

/rerun

@vie-serendipity
Copy link
Member Author

Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v3/dist/codecov' failed with exit code 255
It seems codecov encounter some problems. @rambohe-ch

@rambohe-ch
Copy link
Member

@vie-serendipity please fix the following unit test error:

=== RUN TestDefault/nodepool_has_pool_type
nodepool_default_test.go:111: expect &v1beta1.NodePool{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"foo", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), DeletionTimestamp:, DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{"nodepool.openyurt.io/type":"Cloud"}, Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ClusterName:"", ManagedFields:[]v1.ManagedFieldsEntry(nil)}, Spec:v1beta1.NodePoolSpec{Type:"Cloud", HostNetwork:true, Labels:map[string]string(nil), Annotations:map[string]string(nil), Taints:[]v1.Taint(nil)}, Status:v1beta1.NodePoolStatus{ReadyNodeNum:0, UnreadyNodeNum:0, Nodes:[]string{}}}, got &v1beta1.NodePool{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"foo", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), DeletionTimestamp:, DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{"nodepool.openyurt.io/type":"cloud"}, Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ClusterName:"", ManagedFields:[]v1.ManagedFieldsEntry(nil)}, Spec:v1beta1.NodePoolSpec{Type:"Cloud", HostNetwork:true, Labels:map[string]string(nil), Annotations:map[string]string(nil), Taints:[]v1.Taint(nil)}, Status:v1beta1.NodePoolStatus{ReadyNodeNum:0, UnreadyNodeNum:0, Nodes:[]string{}}}
--- FAIL: TestDefault (0.00s)
--- PASS: TestDefault/it_is_not_a_nodepool (0.00s)
--- FAIL: TestDefault/nodepool_has_no_type (0.00s)
--- FAIL: TestDefault/nodepool_has_pool_type (0.00s)

Copy link

sonarqubecloud bot commented Apr 8, 2024

Quality Gate Passed Quality Gate passed

Issues
5 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@rambohe-ch rambohe-ch added approved approved lgtm lgtm labels Apr 8, 2024
@rambohe-ch
Copy link
Member

/lgtm

@rambohe-ch rambohe-ch merged commit c137221 into openyurtio:master Apr 8, 2024
13 checks passed
zyjhtangtang pushed a commit to zyjhtangtang/openyurt that referenced this pull request Apr 16, 2024
@rambohe-ch
Copy link
Member

Fixes #1970

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved approved lgtm lgtm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants