-
Notifications
You must be signed in to change notification settings - Fork 407
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: support forward requests to leader hub for sharing pool scope metadata in nodepool #2325
feat: support forward requests to leader hub for sharing pool scope metadata in nodepool #2325
Conversation
8f25132
to
2e41ba9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2325 +/- ##
==========================================
+ Coverage 45.70% 45.97% +0.26%
==========================================
Files 394 394
Lines 25953 26103 +150
==========================================
+ Hits 11861 12000 +139
- Misses 12946 12952 +6
- Partials 1146 1151 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
4514d42
to
cbef4f1
Compare
cmd/yurthub/app/options/options.go
Outdated
@@ -167,6 +171,19 @@ func (options *YurtHubOptions) Validate() error { | |||
if len(options.CACertHashes) == 0 && !options.UnsafeSkipCAVerification { | |||
return fmt.Errorf("set --discovery-token-unsafe-skip-ca-verification flag as true or pass CACertHashes to continue") | |||
} | |||
|
|||
if len(options.NodePoolName) == 0 { | |||
return fmt.Errorf("node-pool-name is empty") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("node-pool-name is empty") | |
return errors.New("node-pool-name is empty") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if !ok { | ||
return | ||
} | ||
oldCfg, _ := oldObj.(*corev1.ConfigMap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not check the "ok" value still?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because FilterFunc
in configmap informer as following can ensure only configmap object is transferred to event handlers.
configmapInformer.AddEventHandler(cache.FilteringResourceEventHandler{
FilterFunc: func(obj interface{}) bool {
cfg, ok := obj.(*corev1.ConfigMap)
if ok && cfg.Name == util.YurthubConfigMapName {
return true
}
return false
},
Handler: cache.ResourceEventHandlerFuncs{
AddFunc: m.addConfigmap,
UpdateFunc: m.updateConfigmap,
DeleteFunc: m.deleteConfigmap,
},
})
oldCM, _ := oldObj.(*corev1.ConfigMap) | ||
newCM, _ := newObj.(*corev1.ConfigMap) | ||
|
||
if reflect.DeepEqual(oldCM.Data, newCM.Data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maps.Equal(...) is a new std lib for comparing maps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
f2e80fc
to
c86a55a
Compare
…etadata in nodepool. Signed-off-by: rambohe-ch <[email protected]>
c86a55a
to
be43355
Compare
|
/LGTM |
What type of PR is this?
/kind feature
What this PR does / why we need it:
openyurt.io/configmap-name: {configmap-name}
is added to these two configmaps.make local-up-openyurt
as following:openyurt-e2e-test-control-plane
node intoyurt-pool1
openyurt-e2e-test-worker
andopenyurt-e2e-test-worker2
nodes intoyurt-pool2
openyurt-e2e-test-worker3
andopenyurt-e2e-test-worker4
nodes intoyurt-pool3
Which issue(s) this PR fixes:
Fixes #2261
Special notes for your reviewer:
Does this PR introduce a user-facing change?
other Note