-
Notifications
You must be signed in to change notification settings - Fork 408
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: move yurt-device-controller into yurt-manager #1607
Conversation
Welcome @wangxye! It looks like this is your first PR to openyurtio/openyurt 🎉 |
/assign @LavenderQAQ |
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.
IoT-sig finally decided to change yurt-device-controller to yurt-iot-dock (YurtIoTDock), please revise it.
Namespace: "default", | ||
CoreDataAddr: "edgex-core-data:59880", | ||
CoreMetadataAddr: "edgex-core-metadata:59881", | ||
CoreCommandAddr: "edgex-core-command:59882", |
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.
We need to keep these parameters in sync with the configuration in PlatformAdmin in the future, could you open an issue to track this?
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.
Of course, I will continue to track and extend the yurt-iot-dock using the ability to customize configurations in PlatformAdmin.
) | ||
|
||
const ( | ||
DeviceFinalizer = "iot.device.finalizer" |
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.
I think it might be better to change this to "iot.openyurt.io/device".
) | ||
|
||
const ( | ||
DeviceProfileFinalizer = "iot.deviceProfile.finalizer" |
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.
I think it might be better to change this to "iot.openyurt.io/deviceprofile".
) | ||
|
||
const ( | ||
DeviceServiceFinalizer = "iot.deviceService.finalizer" |
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.
I think it might be better to change this to "iot.openyurt.io/deviceservice".
return nil, err | ||
} | ||
// YurtIoTCarrier doesn't need a service yet | ||
yurtIoTCarrierConfig := map[string]interface{}{ |
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.
Here don't use the map[string]interface
, please use appsv1.DeploymentSpec
and appsv1alpha1.YurtAppSet
.
err = json.Unmarshal([]byte(yurtIoTCarrierConfigBytes), &yurtIoTCarrierDeployment) | ||
if err != nil { | ||
return nil, err | ||
} |
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.
The serialization and deserialization here looks a little redundant.
@@ -600,3 +611,111 @@ func annotationToComponent(annotation map[string]string) ([]*config.Component, e | |||
|
|||
return components, nil | |||
} | |||
|
|||
func NewYurtIoTCarrierComponent(platformAdmin *iotv1alpha2.PlatformAdmin) (*config.Component, error) { |
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.
The build method can be considered as an internal function, and the build Deployment process can be placed in the util package.
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.
This function is still needed, but keep it as simple as possible.
|
||
const IotCtrlName = "yurt-iot-carrier" | ||
|
||
func DefaultVersion(platformAdmin *iotv1alpha2.PlatformAdmin) (string, string, error) { |
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.
You can set it as an internal function to put the component building process into util as well.
package controllers | ||
|
||
const ( | ||
EdgeXObjectName = "device-controller/edgex-object.name" |
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.
Please update this label.
@@ -226,6 +226,12 @@ func (r *ReconcilePlatformAdmin) reconcileDelete(ctx context.Context, platformAd | |||
} | |||
desiredComponents = append(desiredComponents, additionalComponents...) | |||
|
|||
yurtIotDock, err := util.NewYurtIoTDockComponent(platformAdmin) |
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.
Rebase may be required here after #1596 is combined.
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.
The current code looks fine. There may be some changes here after #1596 is merged, you could wait a while to rebase. I will review and test it again after rebase.
/hold |
Signed-off-by: wangxye <1031989637@qq.com>
Signed-off-by: wangxye <1031989637@qq.com>
Signed-off-by: wangxye <1031989637@qq.com>
Signed-off-by: wangxye <1031989637@qq.com>
Signed-off-by: wangxye <1031989637@qq.com>
Signed-off-by: wangxye <1031989637@qq.com>
/unhold |
1 similar comment
/unhold |
pkg/controller/platformadmin/util.go
Outdated
Containers: []corev1.Container{ | ||
{ | ||
Name: "yurt-iot-dock", | ||
Image: fmt.Sprintf("leoabyss/yurt-iot-dock:%s", ver), |
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.
It would be better to replace "leoabyss" with "openyurt" to make it more appropriate.
return iotv1alpha1.Device{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: toKubeName(ed.Name), | ||
Namespace: "default", |
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 more appropriate to set the namespace here to match that of yurt-iot-dock?
return iotv1alpha1.DeviceService{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: toKubeName(ds.Name), | ||
Namespace: "default", |
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.
the same
return iotv1alpha1.DeviceProfile{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: toKubeName(dp.Name), | ||
Namespace: "default", |
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.
the same
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.
some suggestions
Signed-off-by: wangxye <1031989637@qq.com>
SonarCloud Quality Gate failed. 0 Bugs No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
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.
/lgtm
@LavenderQAQ: 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/test-infra repository. |
@rambohe-ch This pr involves some CI changes (adding a new image build process for YurtIoTDock), needs to test the workflow. |
@rambohe-ch We found some problems with |
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
Codecov Report
@@ Coverage Diff @@
## master #1607 +/- ##
==========================================
+ Coverage 51.43% 52.13% +0.70%
==========================================
Files 134 142 +8
Lines 15947 16911 +964
==========================================
+ Hits 8202 8817 +615
- Misses 7000 7273 +273
- Partials 745 821 +76
Flags with carried forward coverage won't be shown. Click here to find out more.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: LavenderQAQ, rambohe-ch, wangxye 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 |
What type of PR is this?
/kind feature
/sig iot
What this PR does / why we need it:
This PR integrates the yurt-device-controller for iot into the yurt manager. Users can deploy it using PlatformAdmin.
Which issue(s) this PR fixes:
Fixes #1580
Special notes for your reviewer:
Does this PR introduce a user-facing change?