-
Notifications
You must be signed in to change notification settings - Fork 94
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
✨ addon: add support for multiple GVK #585
✨ addon: add support for multiple GVK #585
Conversation
adds test cases updates mergeAddonConfig function to match new multi same-gvk configs Signed-off-by: Joao Marcal <jmarcal@redhat.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #585 +/- ##
==========================================
+ Coverage 62.60% 63.74% +1.14%
==========================================
Files 181 181
Lines 13964 14039 +75
==========================================
+ Hits 8742 8949 +207
+ Misses 4338 4195 -143
- Partials 884 895 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
19d6f36
to
74d73d7
Compare
Signed-off-by: haoqing0110 <qhao@redhat.com>
74d73d7
to
4c7ce51
Compare
/assign @qiujian16 |
@haoqing0110: GitHub didn't allow me to request PR reviews from the following users: JoaoBraveCoding. Note that only open-cluster-management-io members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
for _, config := range mcaCopy.Status.ConfigReferences { | ||
if _, ok := desiredConfigMap[config.ConfigGroupResource]; ok { | ||
mergedConfigs = append(mergedConfigs, config) | ||
for _, configRef := range mcaCopy.Status.ConfigReferences { |
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.
add some comments for each for loop
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.
added.
output := addonConfigMap{} | ||
for k, v := range d { | ||
output[k] = v | ||
func (m addonConfigMap) copy() addonConfigMap { |
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.
is this a deepcopy?
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.
yes, update the code.
@@ -461,3 +495,53 @@ func rolloutStatusHasCluster(clusterRolloutStatus []clustersdkv1alpha1.ClusterRo | |||
} | |||
return false | |||
} | |||
|
|||
func overrideConfigMapByInstallConfigRef( |
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.
comment on this func
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.
added.
} | ||
} | ||
|
||
func overrideConfigMapByAddOnConfigs( |
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.
ditto we need more docs for matinability
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.
added
addOnConfigs []addonv1alpha1.AddOnConfig, | ||
desiredConfigs map[addonv1alpha1.ConfigGroupResource][]addonv1alpha1.ConfigReferent, | ||
) { | ||
gvkOverwritten := make(map[addonv1alpha1.ConfigGroupResource]struct{}) |
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.
can we uset Set generic here?
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.
yes, have modified the code to use sets.
@@ -48,14 +48,14 @@ type addonNode struct { | |||
status *clustersdkv1alpha1.ClusterRolloutStatus | |||
} | |||
|
|||
type addonConfigMap map[addonv1alpha1.ConfigGroupResource]addonv1alpha1.ConfigReference | |||
type addonConfigMap map[addonv1alpha1.ConfigGroupResource][]addonv1alpha1.ConfigReference |
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.
would it be easier if we use something like
type addonConfigMap map[addonv1alpha1.ConfigGroupResource]set.Set[addonv1alpha1.ConfigReference]
?
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.
For the ConfigReference, we use it to store ConfigGroupResource, DesiredConfig, LastObservedGeneration and LastAppliedConfig, while only use ConfigGroupResource and DesiredConfig.ConfigReferent when doing comparison, it seems not be able to use the strengths of sets, like Has().
Signed-off-by: haoqing0110 <qhao@redhat.com>
1c0879c
to
ca344f4
Compare
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.
/approve
@JoaoBraveCoding could you help take a look? |
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.
Great job!
@iblancasa: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: haoqing0110, iblancasa, qiujian16 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 |
/lgtm |
dfa835d
into
open-cluster-management-io:main
Summary
Related issue(s)
Ref: #547