Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Periodical collect #88

Merged
merged 15 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,756 changes: 2,378 additions & 2,378 deletions EdgeXConfig/config-nosecty.yaml

Large diffs are not rendered by default.

14,314 changes: 7,157 additions & 7,157 deletions EdgeXConfig/config.yaml

Large diffs are not rendered by default.

42 changes: 41 additions & 1 deletion api/v1alpha1/edgex_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ limitations under the License.
package v1alpha1

import (
"encoding/json"

"github.com/openyurtio/yurt-edgex-manager/api/v1alpha2"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
Expand All @@ -39,7 +41,26 @@ func (src *EdgeX) ConvertTo(dstRaw conversion.Hub) error {
dst.Status.UnreadyComponentNum = src.Status.DeploymentReplicas - src.Status.DeploymentReadyReplicas
dst.Status.Conditions = src.Status.Conditions

// Transform additionaldeployment
if len(src.Spec.AdditionalDeployment) > 0 {
additionalDeployment, err := json.Marshal(src.Spec.AdditionalDeployment)
if err != nil {
return err
}
dst.ObjectMeta.Annotations["AdditionalDeployments"] = string(additionalDeployment)
}

// Transform additionalservice
if len(src.Spec.AdditionalService) > 0 {
additionalService, err := json.Marshal(src.Spec.AdditionalService)
if err != nil {
return err
}
dst.ObjectMeta.Annotations["AdditionalServices"] = string(additionalService)
}

//TODO: Components

return nil
}
func (dst *EdgeX) ConvertFrom(srcRaw conversion.Hub) error {
Expand All @@ -64,6 +85,25 @@ func (dst *EdgeX) ConvertFrom(srcRaw conversion.Hub) error {
dst.Status.DeploymentReplicas = src.Status.ReadyComponentNum + src.Status.UnreadyComponentNum
dst.Status.Conditions = src.Status.Conditions

//TODO: AdditionalService and AdditionalDeployment
// Transform additionaldeployment
if _, ok := src.ObjectMeta.Annotations["AdditionalDeployments"]; ok {
var additionalDeployments []DeploymentTemplateSpec = make([]DeploymentTemplateSpec, 0)
err := json.Unmarshal([]byte(src.ObjectMeta.Annotations["AdditionalDeployments"]), &additionalDeployments)
if err != nil {
return err
}
dst.Spec.AdditionalDeployment = additionalDeployments
}

// Transform additionalservice
if _, ok := src.ObjectMeta.Annotations["AdditionalServices"]; ok {
var additionalServices []ServiceTemplateSpec = make([]ServiceTemplateSpec, 0)
err := json.Unmarshal([]byte(src.ObjectMeta.Annotations["AdditionalServices"]), &additionalServices)
if err != nil {
return err
}
dst.Spec.AdditionalService = additionalServices
}

return nil
}
8 changes: 4 additions & 4 deletions config/samples/hangzhou.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
name: edgex-sample-hangzhou
spec:
version: hanoi
poolname: hangzhou
additinalservices:
poolName: hangzhou
additionalServices:
- metadata:
name: edgex-device-virtual
spec:
Expand All @@ -18,7 +18,7 @@ spec:
protocol: TCP
targetPort: 49990
nodePort: 30090
additinaldeployments:
additionalDeployments:
- metadata:
name: edgex-device-virtual
spec:
Expand All @@ -41,7 +41,7 @@ spec:
containerPort: 49990
envFrom:
- configMapRef:
name: common-variables
name: common-variable-hanoi
env:
- name: Service_Host
value: "edgex-device-virtual"
11 changes: 5 additions & 6 deletions config/samples/jakarta-sak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
name: edgex-sample-hangzhou
spec:
version: jakarta
poolname: hangzhou
additinalservices:
poolName: beijing
additionalServices:
- metadata:
name: edgex-device-sak
spec:
Expand All @@ -18,7 +18,7 @@ spec:
protocol: TCP
targetPort: 59100
nodePort: 30090
additinaldeployments:
additionalDeployments:
- metadata:
name: edgex-device-sak
spec:
Expand All @@ -41,9 +41,8 @@ spec:
containerPort: 59100
envFrom:
- configMapRef:
name: common-variables
name: common-variable-jakarta
env:
- name: SERVICE_HOST
value: "edgex-device-sak"
securityContext:
privileged: true

68 changes: 68 additions & 0 deletions controllers/edgex_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package controllers

import (
"context"
"encoding/json"
"reflect"
"time"

Expand Down Expand Up @@ -161,6 +162,13 @@ func (r *EdgeXReconciler) reconcileDelete(ctx context.Context, edgex *devicev1al
} else {
desiredComponents = NoSectyComponents[edgex.Spec.Version]
}

additionalComponents, err := annotationToComponent(edgex.Annotations)
if err != nil {
return ctrl.Result{}, err
}
desiredComponents = append(desiredComponents, additionalComponents...)

//TODO: handle edgex.Spec.Components

for _, dc := range desiredComponents {
Expand Down Expand Up @@ -285,6 +293,13 @@ func (r *EdgeXReconciler) reconcileComponent(ctx context.Context, edgex *devicev
} else {
desireComponents = NoSectyComponents[edgex.Spec.Version]
}

additionalComponents, err := annotationToComponent(edgex.Annotations)
if err != nil {
return false, err
}
desireComponents = append(desireComponents, additionalComponents...)

//TODO: handle edgex.Spec.Components

defer func() {
Expand Down Expand Up @@ -459,6 +474,59 @@ func (r *EdgeXReconciler) handleYurtAppSet(ctx context.Context, edgex *devicev1a
return ud, nil
}

// For version compatibility, v1alpha1's additionalservice and additionaldeployment are placed in
// v2alpha2's annotation, this function is to convert the annotation to component.
func annotationToComponent(annotation map[string]string) ([]*Component, error) {
var components []*Component = []*Component{}
var additionalDeployments []devicev1alpha1.DeploymentTemplateSpec = make([]devicev1alpha1.DeploymentTemplateSpec, 0)
if _, ok := annotation["AdditionalDeployments"]; ok {
err := json.Unmarshal([]byte(annotation["AdditionalDeployments"]), &additionalDeployments)
if err != nil {
return nil, err
}
}
var additionalServices []devicev1alpha1.ServiceTemplateSpec = make([]devicev1alpha1.ServiceTemplateSpec, 0)
if _, ok := annotation["AdditionalServices"]; ok {
err := json.Unmarshal([]byte(annotation["AdditionalServices"]), &additionalServices)
if err != nil {
return nil, err
}
}
if len(additionalDeployments) == 0 && len(additionalServices) == 0 {
return components, nil
}
var services map[string]*corev1.ServiceSpec = make(map[string]*corev1.ServiceSpec)
var usedServices map[string]struct{} = make(map[string]struct{})
for _, additionalservice := range additionalServices {
services[additionalservice.Name] = &additionalservice.Spec
}
for _, additionalDeployment := range additionalDeployments {
var component Component
component.Name = additionalDeployment.Name
component.Deployment = &additionalDeployment.Spec
service, ok := services[component.Name]
if ok {
component.Service = service
usedServices[component.Name] = struct{}{}
}
components = append(components, &component)
}
if len(usedServices) < len(services) {
for name, service := range services {
_, ok := usedServices[name]
if ok {
continue
}
var component Component
component.Name = name
component.Service = service
components = append(components, &component)
}
}

return components, nil
}

// SetupWithManager sets up the controller with the Manager.
func (r *EdgeXReconciler) SetupWithManager(mgr ctrl.Manager) error {

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/data/beijing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
containerPort: 59900
envFrom:
- configMapRef:
name: common-variables
name: common-variable-jakarta
env:
- name: Service_Host
value: "edgex-device-virtual"
2 changes: 1 addition & 1 deletion test/e2e/data/hangzhou.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
containerPort: 49990
envFrom:
- configMapRef:
name: common-variables
name: common-variable-hanoi
env:
- name: Service_Host
value: "edgex-device-virtual"
25 changes: 11 additions & 14 deletions tools/collector/config/multiarch_imagelist.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
kong:2.8.1
redis:7.0.5-alpine
vault:1.11.4
lfedge/ekuiper:1.7.1-alpine
postgres:13.8-alpine
redis:7.0.5-alpine
kong:2.8.1
consul:1.13.2
vault:1.8.4
vault:1.11.4
postgres:13.4-alpine
lfedge/ekuiper:1.4.4-alpine
redis:6.2.6-alpine
consul:1.10.3
vault:1.8.4
kong:2.5.1
consul:1.10.10
redis:6.2.6-alpine
vault:1.8.9
lfedge/ekuiper:1.4.4-alpine
kong:2.6.1
postgres:13.5-alpine
consul:1.10.10
redis:6.2.6-alpine
redis:6.2.4-alpine
postgres:12.3-alpine
kong:2.6.1
lfedge/ekuiper:1.4.4-alpine
vault:1.7.2
consul:1.9.5
redis:6.2.4-alpine
lfedge/ekuiper:1.3.0-alpine
kong:2.4.1-alpine
postgres:12.3-alpine
kong:2.0.5
redis:6.0.9-alpine
consul:1.9.5
emqx/kuiper:1.1.1-alpine
kong:2.0.5
postgres:12.3-alpine
vault:1.5.3
postgres:12.3-alpine
kong:2.0.5
76 changes: 39 additions & 37 deletions tools/collector/config/singlearch_imagelist.txt
Original file line number Diff line number Diff line change
@@ -1,65 +1,67 @@
edgexfoundry/security-proxy-setup:2.3.0 edgexfoundry/security-proxy-setup-arm64:2.3.0
edgexfoundry/core-command:2.3.0 edgexfoundry/core-command-arm64:2.3.0
edgexfoundry/device-virtual:2.3.0 edgexfoundry/device-virtual-arm64:2.3.0
edgexfoundry/app-service-configurable:2.3.0 edgexfoundry/app-service-configurable-arm64:2.3.0
edgexfoundry/security-bootstrapper:2.3.0 edgexfoundry/security-bootstrapper-arm64:2.3.0
edgexfoundry/device-rest:2.3.0 edgexfoundry/device-rest-arm64:2.3.0
edgexfoundry/support-notifications:2.3.0 edgexfoundry/support-notifications-arm64:2.3.0
edgexfoundry/security-secretstore-setup:2.3.0 edgexfoundry/security-secretstore-setup-arm64:2.3.0
edgexfoundry/core-data:2.3.0 edgexfoundry/core-data-arm64:2.3.0
edgexfoundry/sys-mgmt-agent:2.3.0 edgexfoundry/sys-mgmt-agent-arm64:2.3.0
edgexfoundry/edgex-ui:2.3.0 edgexfoundry/edgex-ui-arm64:2.3.0
edgexfoundry/core-command:2.3.0 edgexfoundry/core-command-arm64:2.3.0
edgexfoundry/security-secretstore-setup:2.3.0 edgexfoundry/security-secretstore-setup-arm64:2.3.0
edgexfoundry/core-metadata:2.3.0 edgexfoundry/core-metadata-arm64:2.3.0
edgexfoundry/sys-mgmt-agent:2.3.0 edgexfoundry/sys-mgmt-agent-arm64:2.3.0
edgexfoundry/app-service-configurable:2.3.0 edgexfoundry/app-service-configurable-arm64:2.3.0
edgexfoundry/support-scheduler:2.3.0 edgexfoundry/support-scheduler-arm64:2.3.0
edgexfoundry/device-rest:2.3.0 edgexfoundry/device-rest-arm64:2.3.0
edgexfoundry/core-data:2.3.0 edgexfoundry/core-data-arm64:2.3.0
edgexfoundry/app-service-configurable:2.1.1 edgexfoundry/app-service-configurable-arm64:2.1.1
edgexfoundry/security-proxy-setup:2.3.0 edgexfoundry/security-proxy-setup-arm64:2.3.0
edgexfoundry/security-bootstrapper:2.3.0 edgexfoundry/security-bootstrapper-arm64:2.3.0
edgexfoundry/security-secretstore-setup:2.1.1 edgexfoundry/security-secretstore-setup-arm64:2.1.1
edgexfoundry/support-scheduler:2.1.1 edgexfoundry/support-scheduler-arm64:2.1.1
edgexfoundry/core-command:2.1.1 edgexfoundry/core-command-arm64:2.1.1
edgexfoundry/core-metadata:2.1.1 edgexfoundry/core-metadata-arm64:2.1.1
edgexfoundry/security-bootstrapper:2.1.1 edgexfoundry/security-bootstrapper-arm64:2.1.1
edgexfoundry/support-notifications:2.1.1 edgexfoundry/support-notifications-arm64:2.1.1
edgexfoundry/device-virtual:2.1.1 edgexfoundry/device-virtual-arm64:2.1.1
edgexfoundry/support-scheduler:2.1.1 edgexfoundry/support-scheduler-arm64:2.1.1
edgexfoundry/edgex-ui:2.1.0 edgexfoundry/edgex-ui-arm64:2.1.0
edgexfoundry/security-secretstore-setup:2.1.1 edgexfoundry/security-secretstore-setup-arm64:2.1.1
edgexfoundry/core-data:2.1.1 edgexfoundry/core-data-arm64:2.1.1
edgexfoundry/sys-mgmt-agent:2.1.1 edgexfoundry/sys-mgmt-agent-arm64:2.1.1
edgexfoundry/core-metadata:2.1.1 edgexfoundry/core-metadata-arm64:2.1.1
edgexfoundry/security-proxy-setup:2.1.1 edgexfoundry/security-proxy-setup-arm64:2.1.1
edgexfoundry/sys-mgmt-agent:2.1.1 edgexfoundry/sys-mgmt-agent-arm64:2.1.1
edgexfoundry/device-rest:2.1.1 edgexfoundry/device-rest-arm64:2.1.1
edgexfoundry/core-data:2.1.1 edgexfoundry/core-data-arm64:2.1.1
edgexfoundry/edgex-ui:2.1.0 edgexfoundry/edgex-ui-arm64:2.1.0
edgexfoundry/device-virtual:2.1.1 edgexfoundry/device-virtual-arm64:2.1.1
edgexfoundry/app-service-configurable:2.1.1 edgexfoundry/app-service-configurable-arm64:2.1.1
edgexfoundry/support-scheduler:2.2.0 edgexfoundry/support-scheduler-arm64:2.2.0
edgexfoundry/core-data:2.2.0 edgexfoundry/core-data-arm64:2.2.0
edgexfoundry/core-command:2.2.0 edgexfoundry/core-command-arm64:2.2.0
edgexfoundry/edgex-ui:2.2.0 edgexfoundry/edgex-ui-arm64:2.2.0
edgexfoundry/app-service-configurable:2.2.0 edgexfoundry/app-service-configurable-arm64:2.2.0
edgexfoundry/device-rest:2.2.0 edgexfoundry/device-rest-arm64:2.2.0
edgexfoundry/security-bootstrapper:2.2.0 edgexfoundry/security-bootstrapper-arm64:2.2.0
edgexfoundry/core-metadata:2.2.0 edgexfoundry/core-metadata-arm64:2.2.0
edgexfoundry/security-secretstore-setup:2.2.0 edgexfoundry/security-secretstore-setup-arm64:2.2.0
edgexfoundry/support-scheduler:2.2.0 edgexfoundry/support-scheduler-arm64:2.2.0
edgexfoundry/core-data:2.2.0 edgexfoundry/core-data-arm64:2.2.0
edgexfoundry/support-notifications:2.2.0 edgexfoundry/support-notifications-arm64:2.2.0
edgexfoundry/device-virtual:2.2.0 edgexfoundry/device-virtual-arm64:2.2.0
edgexfoundry/sys-mgmt-agent:2.2.0 edgexfoundry/sys-mgmt-agent-arm64:2.2.0
edgexfoundry/security-proxy-setup:2.2.0 edgexfoundry/security-proxy-setup-arm64:2.2.0
edgexfoundry/core-metadata:2.2.0 edgexfoundry/core-metadata-arm64:2.2.0
edgexfoundry/security-bootstrapper:2.2.0 edgexfoundry/security-bootstrapper-arm64:2.2.0
edgexfoundry/device-rest:2.2.0 edgexfoundry/device-rest-arm64:2.2.0
edgexfoundry/support-notifications:2.2.0 edgexfoundry/support-notifications-arm64:2.2.0
edgexfoundry/sys-mgmt-agent:2.2.0 edgexfoundry/sys-mgmt-agent-arm64:2.2.0
edgexfoundry/app-service-configurable:2.2.0 edgexfoundry/app-service-configurable-arm64:2.2.0
edgexfoundry/support-scheduler:2.0.0 edgexfoundry/support-scheduler-arm64:2.0.0
edgexfoundry/security-secretstore-setup:2.0.0 edgexfoundry/security-secretstore-setup-arm64:2.0.0
edgexfoundry/core-metadata:2.0.0 edgexfoundry/core-metadata-arm64:2.0.0
edgexfoundry/support-notifications:2.0.0 edgexfoundry/support-notifications-arm64:2.0.0
edgexfoundry/security-bootstrapper:2.0.0 edgexfoundry/security-bootstrapper-arm64:2.0.0
edgexfoundry/app-service-configurable:2.0.1 edgexfoundry/app-service-configurable-arm64:2.0.1
edgexfoundry/core-data:2.0.0 edgexfoundry/core-data-arm64:2.0.0
edgexfoundry/security-proxy-setup:2.0.0 edgexfoundry/security-proxy-setup-arm64:2.0.0
edgexfoundry/sys-mgmt-agent:2.0.0 edgexfoundry/sys-mgmt-agent-arm64:2.0.0
edgexfoundry/security-bootstrapper:2.0.0 edgexfoundry/security-bootstrapper-arm64:2.0.0
edgexfoundry/app-service-configurable:2.0.1 edgexfoundry/app-service-configurable-arm64:2.0.1
edgexfoundry/core-command:2.0.0 edgexfoundry/core-command-arm64:2.0.0
edgexfoundry/device-rest:2.0.0 edgexfoundry/device-rest-arm64:2.0.0
edgexfoundry/security-secretstore-setup:2.0.0 edgexfoundry/security-secretstore-setup-arm64:2.0.0
edgexfoundry/device-virtual:2.0.0 edgexfoundry/device-virtual-arm64:2.0.0
edgexfoundry/docker-device-virtual-go:1.3.1 edgexfoundry/docker-device-virtual-go-arm64:1.3.1
edgexfoundry/docker-core-metadata-go:1.3.1 edgexfoundry/docker-core-metadata-go-arm64:1.3.1
edgexfoundry/core-metadata:2.0.0 edgexfoundry/core-metadata-arm64:2.0.0
edgexfoundry/device-rest:2.0.0 edgexfoundry/device-rest-arm64:2.0.0
edgexfoundry/support-notifications:2.0.0 edgexfoundry/support-notifications-arm64:2.0.0
edgexfoundry/core-data:2.0.0 edgexfoundry/core-data-arm64:2.0.0
edgexfoundry/docker-device-rest-go:1.2.1 edgexfoundry/docker-device-rest-go-arm64:1.2.1
edgexfoundry/docker-core-command-go:1.3.1 edgexfoundry/docker-core-command-go-arm64:1.3.1
edgexfoundry/docker-support-scheduler-go:1.3.1 edgexfoundry/docker-support-scheduler-go-arm64:1.3.1
edgexfoundry/docker-support-notifications-go:1.3.1 edgexfoundry/docker-support-notifications-go-arm64:1.3.1
edgexfoundry/docker-security-secretstore-setup-go:1.3.1 edgexfoundry/docker-security-secretstore-setup-go-arm64:1.3.1
edgexfoundry/docker-security-bootstrap-redis-go:1.3.1 edgexfoundry/docker-security-bootstrap-redis-go-arm64:1.3.1
edgexfoundry/docker-security-secrets-setup-go:1.3.1 edgexfoundry/docker-security-secrets-setup-go-arm64:1.3.1
edgexfoundry/docker-edgex-consul:1.3.0 edgexfoundry/docker-edgex-consul-arm64:1.3.0
edgexfoundry/docker-core-metadata-go:1.3.1 edgexfoundry/docker-core-metadata-go-arm64:1.3.1
edgexfoundry/docker-app-service-configurable:1.3.1 edgexfoundry/docker-app-service-configurable-arm64:1.3.1
edgexfoundry/docker-security-secretstore-setup-go:1.3.1 edgexfoundry/docker-security-secretstore-setup-go-arm64:1.3.1
edgexfoundry/docker-core-data-go:1.3.1 edgexfoundry/docker-core-data-go-arm64:1.3.1
edgexfoundry/docker-support-scheduler-go:1.3.1 edgexfoundry/docker-support-scheduler-go-arm64:1.3.1
edgexfoundry/docker-sys-mgmt-agent-go:1.3.1 edgexfoundry/docker-sys-mgmt-agent-go-arm64:1.3.1
edgexfoundry/docker-security-proxy-setup-go:1.3.1 edgexfoundry/docker-security-proxy-setup-go-arm64:1.3.1
edgexfoundry/docker-security-secrets-setup-go:1.3.1 edgexfoundry/docker-security-secrets-setup-go-arm64:1.3.1
edgexfoundry/docker-core-command-go:1.3.1 edgexfoundry/docker-core-command-go-arm64:1.3.1
edgexfoundry/docker-device-rest-go:1.2.1 edgexfoundry/docker-device-rest-go-arm64:1.2.1
edgexfoundry/docker-edgex-consul:1.3.0 edgexfoundry/docker-edgex-consul-arm64:1.3.0
edgexfoundry/docker-edgex-consul:1.3.0 edgexfoundry/docker-edgex-consul-arm64:1.3.0
2 changes: 1 addition & 1 deletion tools/collector/edgex/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func ModifyImagesName(edgexConfig *EdgeXConfig, repo string) {

}

func CollectVersionToManifest(versionList []Version, oldManifest *Manifest) *Manifest {
func CollectVersionToManifest(versionList []*Version, oldManifest *Manifest) *Manifest {
versions := make([]string, 0)
for _, v := range versionList {
versions = append(versions, v.Name)
Expand Down
Loading