openyurtio / yurt-device-controller

This repository contains the device-controller that leverages EdgeX Foundry to manage edge devices
Apache License 2.0
14 stars 15 forks source link

[BUG] sync failed when deviceservice set instancename #58

Closed theonefx closed 1 year ago

theonefx commented 1 year ago

When deviceservice set instance name. Edgex concatenates the original name with the instance name using the character _. As code below:

func setServiceName(name string) string {
    envValue := os.Getenv(EnvInstanceName)
    if len(envValue) > 0 {
        instanceName = envValue
    }

    if len(instanceName) > 0 {
        name = name + "_" + instanceName
    }

    return name
}

The Yurt-device-controller creates a deviceservice CR and uses the name in Edgex as the name of the cr. But, the character _ is illegal in k8s. image

/kind bug

openyurt-bot commented 1 year ago

@theonefx: The label(s) kind/bug cannot be applied, because the repository doesn't have them

In response to [this](https://github.com/openyurtio/yurt-device-controller/issues/58): >When deviceservice set instance name. Edgex concatenates the original name with the instance name using the character `_`. >As code below: >```go >func setServiceName(name string) string { > envValue := os.Getenv(EnvInstanceName) > if len(envValue) > 0 { > instanceName = envValue > } > > if len(instanceName) > 0 { > name = name + "_" + instanceName > } > > return name >} >``` >The Yurt-device-controller creates a deviceservice CR and uses the name in Edgex as the name of the cr. >But, the character `_` is illegal in k8s. >![image](https://user-images.githubusercontent.com/3760138/218992064-2de4b11d-7376-49cb-a573-250c0c7d27d9.png) > > >/kind bug > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.