Skip to content

Commit

Permalink
feat: move yurt-device-controller into yurt-manager (#1607)
Browse files Browse the repository at this point in the history
* add a new crd iot.device/deviceservice/deviceprofile and incorporate it

Signed-off-by: wangxye <[email protected]>
  • Loading branch information
wangxye authored Aug 9, 2023
1 parent 7cf623d commit d89a805
Show file tree
Hide file tree
Showing 51 changed files with 5,769 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
target: [ yurthub, node-servant, yurt-manager ]
target: [ yurthub, node-servant, yurt-manager, yurt-iot-dock ]
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ docker-push-yurt-tunnel-server: docker-buildx-builder
docker-push-yurt-tunnel-agent: docker-buildx-builder
docker buildx build --no-cache --push ${DOCKER_BUILD_ARGS} --platform ${TARGET_PLATFORMS} -f hack/dockerfiles/release/Dockerfile.yurt-tunnel-agent . -t ${IMAGE_REPO}/yurt-tunnel-agent:${GIT_VERSION}

docker-push-yurt-iot-dock: docker-buildx-builder
docker buildx build --no-cache --push ${DOCKER_BUILD_ARGS} --platform ${TARGET_PLATFORMS} -f hack/dockerfiles/release/Dockerfile.yurt-iot-dock . -t ${IMAGE_REPO}/yurt-iot-dock:${GIT_VERSION}

generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
# hack/make-rule/generate_openapi.sh // TODO by kadisi
Expand Down
172 changes: 172 additions & 0 deletions charts/yurt-manager/crds/iot.openyurt.io_deviceprofiles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: deviceprofiles.iot.openyurt.io
spec:
group: iot.openyurt.io
names:
kind: DeviceProfile
listKind: DeviceProfileList
plural: deviceprofiles
shortNames:
- dp
singular: deviceprofile
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The nodepool of deviceProfile
jsonPath: .spec.nodePool
name: NODEPOOL
type: string
- description: The synced status of deviceProfile
jsonPath: .status.synced
name: SYNCED
type: boolean
- jsonPath: .metadata.creationTimestamp
name: AGE
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: DeviceProfile represents the attributes and operational capabilities
of a device. It is a template for which there can be multiple matching devices
within a given system. NOTE This struct is derived from edgex/go-mod-core-contracts/models/deviceprofile.go
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: DeviceProfileSpec defines the desired state of DeviceProfile
properties:
description:
type: string
deviceCommands:
items:
properties:
isHidden:
type: boolean
name:
type: string
readWrite:
type: string
resourceOperations:
items:
properties:
defaultValue:
type: string
deviceResource:
type: string
mappings:
additionalProperties:
type: string
type: object
required:
- defaultValue
type: object
type: array
required:
- isHidden
- name
- readWrite
- resourceOperations
type: object
type: array
deviceResources:
items:
properties:
attributes:
additionalProperties:
type: string
type: object
description:
type: string
isHidden:
type: boolean
name:
type: string
properties:
properties:
assertion:
type: string
base:
type: string
defaultValue:
type: string
mask:
type: string
maximum:
type: string
mediaType:
type: string
minimum:
type: string
offset:
type: string
readWrite:
type: string
scale:
type: string
shift:
type: string
units:
type: string
valueType:
type: string
type: object
tag:
type: string
required:
- description
- isHidden
- name
- properties
type: object
type: array
labels:
description: Labels used to search for groups of profiles on EdgeX
Foundry
items:
type: string
type: array
manufacturer:
description: Manufacturer of the device
type: string
model:
description: Model of the device
type: string
nodePool:
description: NodePool specifies which nodePool the deviceProfile belongs
to
type: string
type: object
status:
description: DeviceProfileStatus defines the observed state of DeviceProfile
properties:
id:
type: string
synced:
type: boolean
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
195 changes: 195 additions & 0 deletions charts/yurt-manager/crds/iot.openyurt.io_devices.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: devices.iot.openyurt.io
spec:
group: iot.openyurt.io
names:
kind: Device
listKind: DeviceList
plural: devices
shortNames:
- dev
singular: device
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The nodepool of device
jsonPath: .spec.nodePool
name: NODEPOOL
type: string
- description: The synced status of device
jsonPath: .status.synced
name: SYNCED
type: boolean
- description: The managed status of device
jsonPath: .spec.managed
name: MANAGED
priority: 1
type: boolean
- jsonPath: .metadata.creationTimestamp
name: AGE
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Device is the Schema for the devices API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: DeviceSpec defines the desired state of Device
properties:
adminState:
description: Admin state (locked/unlocked)
type: string
description:
description: Information describing the device
type: string
deviceProperties:
additionalProperties:
properties:
desiredValue:
type: string
name:
type: string
putURL:
type: string
required:
- desiredValue
- name
type: object
description: TODO support the following field A list of auto-generated
events coming from the device AutoEvents []AutoEvent `json:"autoEvents"`
DeviceProperties represents the expected state of the device's properties
type: object
labels:
description: Other labels applied to the device to help with searching
items:
type: string
type: array
location:
description: 'Device service specific location (interface{} is an
empty interface so it can be anything) TODO: location type in edgex
is interface{}'
type: string
managed:
description: True means device is managed by cloud, cloud can update
the related fields False means cloud can't update the fields
type: boolean
nodePool:
description: NodePool indicates which nodePool the device comes from
type: string
notify:
type: boolean
operatingState:
description: Operating state (enabled/disabled)
type: string
profileName:
description: Associated Device Profile - Describes the device
type: string
protocols:
additionalProperties:
additionalProperties:
type: string
type: object
description: A map of supported protocols for the given device
type: object
serviceName:
description: Associated Device Service - One per device
type: string
required:
- notify
- profileName
- serviceName
type: object
status:
description: DeviceStatus defines the observed state of Device
properties:
adminState:
description: Admin state (locked/unlocked)
type: string
conditions:
description: current device state
items:
description: DeviceCondition describes current state of a Device.
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status
to another.
format: date-time
type: string
message:
description: A human readable message indicating details about
the transition.
type: string
reason:
description: The reason for the condition's last transition.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of in place set condition.
type: string
type: object
type: array
deviceProperties:
additionalProperties:
properties:
actualValue:
type: string
getURL:
type: string
name:
type: string
required:
- actualValue
- name
type: object
description: it represents the actual state of the device's properties
type: object
edgeId:
type: string
lastConnected:
description: Time (milliseconds) that the device last provided any
feedback or responded to any request
format: int64
type: integer
lastReported:
description: Time (milliseconds) that the device reported data to
the core microservice
format: int64
type: integer
operatingState:
description: Operating state (up/down/unknown)
type: string
synced:
description: Synced indicates whether the device already exists on
both OpenYurt and edge platform
type: boolean
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading

0 comments on commit d89a805

Please sign in to comment.