forked from openyurtio/openyurt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build iot system configuration isolation on nodepool(openyurtio#1597)
- Loading branch information
1 parent
734da95
commit 51bc6cf
Showing
38 changed files
with
1,627 additions
and
492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"registry-mirrors": [ | ||
"https://cfd18f1af0d14fa4b573927c8eb9e317.mirror.swr.myhuaweicloud.com", | ||
"https://dockerhub.icu", | ||
"https://docker.m.daocloud.io", | ||
"https://noohub.ru", | ||
"https://huecker.io", | ||
"https://dockerhub.timeweb.cloud" , | ||
"https://icz9tanv.mirror.aliyuncs.com", | ||
"https://registry.docker-cn.com", | ||
"http://hub-mirror.c.163.com", | ||
"https://register.liberx.info", | ||
"https://dockerpull.com", | ||
"https://docker.anyhub.us.kg", | ||
"https://dockerhub.jobcher.com", | ||
"https://dockerhub.icu", | ||
"https://docker.awsl9527.cn" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+143 KB
...uild-iot-system-configuration-isolation-on-nodepool/platformadmin-new-frame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29 KB
...0819-build-iot-system-configuration-isolation-on-nodepool/platformadmin-new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+142 KB
...uild-iot-system-configuration-isolation-on-nodepool/platformadmin-old-frame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28.8 KB
...0819-build-iot-system-configuration-isolation-on-nodepool/platformadmin-old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
166 changes: 166 additions & 0 deletions
166
docs/proposals/20240819-build-iot-system-configuration-isolation-on-nodepool.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
| title | authors | reviewers | creation-date | last-updated | status | | ||
| :--------------------------------------------------: | ----------------- | ------------ | ------------- | ------------ | ------ | | ||
| Build-iot-system-configuration-isolation-on-nodepool | @WoShiZhangmingyu | @LavenderQAQ | 2024-08-19 | 2024-09-16 | | | ||
|
||
# Build-iot-system-configuration-isolation-on-nodepool | ||
|
||
## Table of Contents | ||
|
||
- [Build-iot-system-configuration-isolation-on-nodepool](#build-iot-system-configuration-isolation-on-nodepool) | ||
- [Table of Contents](#table-of-contents) | ||
- [Summary](#summary) | ||
- [Motivation](#motivation) | ||
- [Goals](#goals) | ||
- [Proposal](#proposal) | ||
- [User Stories](#user-stories) | ||
- [Implementation Details](#implementation-details) | ||
- [Test Plan](#test-plan) | ||
- [Implementation History](#implementation-history) | ||
|
||
## Summary | ||
|
||
Openyurt gave users the ability to customize iot systems, but it's currently not isolated enough for nodepool. | ||
This proposal aims to provide multiple PlatformAdmin deployments within the same namespace, and to allow users the ability to customize the configuration of a nodepool. | ||
|
||
## Motivation | ||
|
||
Suppose now you need to expand several nodepools with the same configuration, the current plan is to create several new Platformadmins with the same configuration.Obviously, the operability and reusability of this solution is poor. | ||
One potential enhancement involves modifying the mapping between Platformadmin and nodepools to a one-to-many relationship, that is, changing the poolName in PlatformadminSpec to pools to correspond to multiple nodepools. | ||
In this proposal, users can deploy multiple node pools with the same configuration by creating a single PlatformAdmin. | ||
|
||
### Goals | ||
|
||
- Provide multiple PlatformAdmin deployments within the same namespace | ||
|
||
- Allow users the ability to customize the configuration of a nodepool | ||
|
||
- Add unit test for platform\_ admin_controller and modify corresponding e2e test | ||
|
||
## Proposal | ||
|
||
### User Stories | ||
|
||
- As a user,I wanted to customize configurations based on the nodepool dimension, thereby achieving the reuse of both custom configurations and Platformadmin. | ||
|
||
### Implementation Details | ||
|
||
PlatformAdmin has evolved from the previous version of the EdgeX CRD and serves as an abstraction for the edge device management platform. Users simply input the platform settings, the name of the NodePool to be deployed, the version to be deployed, and so on, to deploy a complete edge device management platform within the node pool. | ||
|
||
The platformadmin-controller, integrated within yurt-manager, is responsible for parsing the PlatformAdmin CR into the corresponding configmap, service, and yurtappset, thereby realizing the deployment of the edge device management platform. | ||
|
||
Users have the capability to customize a PlatformAdminFramework that is initialized with a standard configuration, followed by the creation of a PlatformAdmin. After this step, the platformadmin-controller will automatically initiate the reconciliation process to handle services and YurtAppSets. | ||
|
||
However, a notable drawback of this process is that, even when multiple nodepools share identical configurations, it necessitates the creation of multiple PlatformAdmins. This redundancy can lead to unnecessary administrative overhead and complexity. | ||
|
||
![platformadmin-old-frame](../img/20240819-build-iot-system-configuration-isolation-on-nodepool/platformadmin-old-frame.png) | ||
|
||
- Old Platformadmin Setup(A Platformadmin is responsible for reconciling a nodepool) | ||
|
||
![platformadmin-old](../img/20240819-build-iot-system-configuration-isolation-on-nodepool/platformadmin-old.png) | ||
|
||
In scenarios where expansion of a nodepool with identical configuration is required, the current approach involves creating a new Platformadmin with the same configuration. This method, however, lacks operational efficiency and reusability. | ||
|
||
A potential enhancement would be to modify the relationship between Platformadmin and nodepools from one-to-one to one-to-many. Specifically, altering the "poolName" in PlatformadminSpec to "nodePools" would allow a single Platformadmin to correspond to multiple nodepools and modify the corresponding processing logic. | ||
|
||
Therefore, we need to modify the design of PlatformAdmin to allow a single PlatformAdmin to manage multiple nodepools with identical configurations. In the future, when faced with similar situations, we can adopt a configuration scheme as depicted in the following diagram. | ||
|
||
![platformadmin-new-frame](../img/20240819-build-iot-system-configuration-isolation-on-nodepool/platformadmin-new-frame.png) | ||
|
||
- New Platformadmin Setup(One Platformadmin is responsible for reconciling multiple nodepools) | ||
|
||
![platformadmin-new](../img/20240819-build-iot-system-configuration-isolation-on-nodepool/platformadmin-new.png) | ||
|
||
OpenYurt extends the concept of nodepools on top of k8s, so an ideal deployment is that users can configure each nodepool iot system independently. With [#1435](https://github.com/openyurtio/openyurt/issues/1435) we can manipulate yurtappset to configure each nodepool individually. And service topology allows us to separate the traffic from each nodepool. With these two capabilities we can take a step closer to idealizing the current deployment model. | ||
|
||
#### Modify CRD | ||
|
||
Platformadmin needs to provide deployment for multiple nodepools, so the original **poolName** has been changed to the **nodePools** , as follows: | ||
|
||
``` | ||
nodepools: | ||
items: | ||
type: string | ||
type: array | ||
``` | ||
|
||
A simple example: | ||
|
||
``` | ||
apiVersion: iot.openyurt.io/v1beta1 | ||
kind: PlatformAdmin | ||
metadata: | ||
name: edgex-sample | ||
spec: | ||
version: minnesota | ||
nodePools: | ||
- hangzhou | ||
- beijing | ||
EOF | ||
``` | ||
|
||
#### Modify PlatformAdminSpec | ||
|
||
Also change PoolName to NodePools: | ||
|
||
``` | ||
type PlatformAdminSpec struct { | ||
Version string `json:"version,omitempty"` | ||
ImageRegistry string `json:"imageRegistry,omitempty"` | ||
NodePools []string `json:"nodepools,omitempty"` | ||
ServiceType corev1.ServiceType `json:"serviceType,omitempty"` | ||
// +optional | ||
AdditionalService []ServiceTemplateSpec `json:"additionalServices,omitempty"` | ||
// +optional | ||
AdditionalDeployment []DeploymentTemplateSpec `json:"additionalDeployments,omitempty"` | ||
} | ||
``` | ||
|
||
#### Modify Platformadmin | ||
|
||
In the update regarding IoT API, we have decided to remove support for version v1alpha1, while retaining support for version v1alpha2. Furthermore, we have added version v1beta1. In version v1beta1, we made modifications to the spec field of the platformadmin resource, renaming the poolName field to nodePools and changing its data type from a single string to [] string. This change aims to support more complex deployment scenarios, allowing users to configure and manage multiple node pools simultaneously, thereby significantly improving deployment scalability. | ||
|
||
Enhance the Reconcile logic of the platformadminController to accommodate multiple nodepools, thereby enabling more refined resource management and scheduling. | ||
for example: | ||
|
||
``` | ||
for _, nodePool := range platformAdmin.Spec.NodePools { | ||
exists := false | ||
for _, pool := range yas.Spec.Pools { | ||
if pool == nodePool { | ||
exists = true | ||
break | ||
} | ||
} | ||
if !exists { | ||
yas.Spec.Pools = append(yas.Spec.Pools, nodePool) | ||
} | ||
} | ||
yas.Spec.Workload.WorkloadTweaks = []appsv1beta1.WorkloadTweak{ | ||
{ | ||
Pools: yas.Spec.Pools, | ||
Tweaks: appsv1beta1.Tweaks{ | ||
Replicas: pointer.Int32(1), | ||
}, | ||
}, | ||
} | ||
``` | ||
|
||
### Test Plan | ||
|
||
#### Unit Test | ||
|
||
Create platformadmin_comtroler_test.go as a unit test file to verify if the corresponding service and yurtappset have been generated correctly. | ||
|
||
#### E2E Test | ||
|
||
Perform E2E testing only after ensuring that the unit test passes. Add test cases specifically to test configurations, such as verifying concurrent processing of multiple PlatformAdmin instances. Test in the local k8s environment simulated by kind to ensure that all parts of the system can work together | ||
|
||
## Implementation History | ||
|
||
- [ ] 8/19/2024: Draft proposal created | ||
- [ ] 8/26/2024: Update proposal | ||
- [ ] 9/16/2024: Updated the version and version description of IoT API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Copyright 2023 The OpenYurt Authors. | ||
Licensed under the Apache License, Version 2.0 (the License); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an AS IS BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package apis | ||
|
||
import ( | ||
version "github.com/openyurtio/openyurt/pkg/apis/iot/v1beta1" | ||
) | ||
|
||
func init() { | ||
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back | ||
AddToSchemes = append(AddToSchemes, version.SchemeBuilder.AddToScheme) | ||
} |
Oops, something went wrong.