Skip to content

Commit

Permalink
refactor: rename IoT crd and device group to PlatformAdmin crd and io…
Browse files Browse the repository at this point in the history
…t group

Signed-off-by: LavenderQAQ <1254297317@qq.com>
  • Loading branch information
LavenderQAQ committed Jun 9, 2023
1 parent e655775 commit 9aa902a
Show file tree
Hide file tree
Showing 38 changed files with 663 additions and 655 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: iots.device.openyurt.io
name: platformadmins.iot.openyurt.io
spec:
group: device.openyurt.io
group: iot.openyurt.io
names:
categories:
- all
kind: IoT
listKind: IoTList
plural: iots
kind: PlatformAdmin
listKind: PlatformAdminList
plural: platformadmins
shortNames:
- iot
singular: iot
- pa
singular: platformadmin
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The edgex ready status
- description: The platform ready status
jsonPath: .status.ready
name: READY
type: boolean
Expand All @@ -40,13 +40,13 @@ spec:
name: ReadyDeployment
type: integer
deprecated: true
deprecationWarning: device.openyurt.io/v1alpha1 EdgeX will be deprecated in future;
use device.openyurt.io/v1alpha2 EdgeX; v1alpha1 EdgeX.Spec.ServiceType only
support ClusterIP
deprecationWarning: iot.openyurt.io/v1alpha1 PlatformAdmin will be deprecated
in future; use iot.openyurt.io/v1alpha2 PlatformAdmin; v1alpha1 PlatformAdmin.Spec.ServiceType
only support ClusterIP
name: v1alpha1
schema:
openAPIV3Schema:
description: IoT is the Schema for the samples API
description: PlatformAdmin is the Schema for the samples API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -61,7 +61,7 @@ spec:
metadata:
type: object
spec:
description: IoTSpec defines the desired state of IoT
description: PlatformAdminSpec defines the desired state of PlatformAdmin
properties:
additionalDeployments:
items:
Expand Down Expand Up @@ -8334,12 +8334,13 @@ spec:
type: string
type: object
status:
description: IoTStatus defines the observed state of IoT
description: PlatformAdminStatus defines the observed state of PlatformAdmin
properties:
conditions:
description: Current Edgex state
description: Current PlatformAdmin state
items:
description: IoTCondition describes current state of a IoT.
description: PlatformAdminCondition describes current state of a
PlatformAdmin.
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status
Expand Down Expand Up @@ -8384,7 +8385,7 @@ spec:
subresources:
status: {}
- additionalPrinterColumns:
- description: The edgex ready status
- description: The platformadmin ready status
jsonPath: .status.ready
name: READY
type: boolean
Expand All @@ -8399,7 +8400,7 @@ spec:
name: v1alpha2
schema:
openAPIV3Schema:
description: IoT is the Schema for the samples API
description: PlatformAdmin is the Schema for the samples API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -8414,7 +8415,7 @@ spec:
metadata:
type: object
spec:
description: IoTSpec defines the desired state of IoT
description: PlatformAdminSpec defines the desired state of PlatformAdmin
properties:
components:
items:
Expand All @@ -8440,12 +8441,13 @@ spec:
type: string
type: object
status:
description: IoTStatus defines the observed state of IoT
description: PlatformAdminStatus defines the observed state of PlatformAdmin
properties:
conditions:
description: Current Edgex state
description: Current PlatformAdmin state
items:
description: IoTCondition describes current state of a IoT.
description: PlatformAdminCondition describes current state of a
PlatformAdmin.
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status
Expand Down
72 changes: 36 additions & 36 deletions charts/yurt-manager/templates/yurt-manager-auto-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -374,40 +374,40 @@ rules:
- list
- watch
- apiGroups:
- device.openyurt.io
- discovery.k8s.io
resources:
- iots
- endpointslices
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- device.openyurt.io
- iot.openyurt.io
resources:
- iots/finalizers
- platformadmins
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- device.openyurt.io
- iot.openyurt.io
resources:
- iots/status
- platformadmins/finalizers
verbs:
- get
- patch
- update
- apiGroups:
- discovery.k8s.io
- iot.openyurt.io
resources:
- endpointslices
- platformadmins/status
verbs:
- get
- list
- patch
- watch
- update
- apiGroups:
- raven.openyurt.io
resources:
Expand Down Expand Up @@ -464,39 +464,39 @@ webhooks:
service:
name: yurt-manager-webhook-service
namespace: {{ .Release.Namespace }}
path: /mutate-device-openyurt-io-v1alpha2-iot
path: /mutate-apps-openyurt-io-v1beta1-nodepool
failurePolicy: Fail
name: miot.kb.io
name: m.v1beta1.nodepool.kb.io
rules:
- apiGroups:
- device.openyurt.io
- apps.openyurt.io
apiVersions:
- v1alpha2
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- iots
- nodepools
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: yurt-manager-webhook-service
namespace: {{ .Release.Namespace }}
path: /mutate-apps-openyurt-io-v1beta1-nodepool
path: /mutate-iot-openyurt-io-v1alpha2-platformadmin
failurePolicy: Fail
name: m.v1beta1.nodepool.kb.io
name: mplatformadmin.kb.io
rules:
- apiGroups:
- apps.openyurt.io
- iot.openyurt.io
apiVersions:
- v1beta1
- v1alpha2
operations:
- CREATE
- UPDATE
resources:
- nodepools
- platformadmins
sideEffects: None
- admissionReviewVersions:
- v1
Expand Down Expand Up @@ -594,40 +594,40 @@ webhooks:
service:
name: yurt-manager-webhook-service
namespace: {{ .Release.Namespace }}
path: /validate-device-openyurt-io-v1alpha2-iot
path: /validate-apps-openyurt-io-v1beta1-nodepool
failurePolicy: Fail
name: viot.kb.io
name: v.v1beta1.nodepool.kb.io
rules:
- apiGroups:
- device.openyurt.io
- apps.openyurt.io
apiVersions:
- v1alpha2
- v1beta1
operations:
- CREATE
- UPDATE
- DELETE
resources:
- iots
- nodepools
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: yurt-manager-webhook-service
namespace: {{ .Release.Namespace }}
path: /validate-apps-openyurt-io-v1beta1-nodepool
path: /validate-iot-openyurt-io-v1alpha2-platformadmin
failurePolicy: Fail
name: v.v1beta1.nodepool.kb.io
name: vplatformadmin.kb.io
rules:
- apiGroups:
- apps.openyurt.io
- iot.openyurt.io
apiVersions:
- v1beta1
- v1alpha2
operations:
- CREATE
- UPDATE
- DELETE
resources:
- nodepools
- platformadmins
sideEffects: None
- admissionReviewVersions:
- v1
Expand Down
10 changes: 5 additions & 5 deletions cmd/yurt-manager/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type YurtManagerOptions struct {
YurtStaticSetController *YurtStaticSetControllerOptions
YurtAppSetController *YurtAppSetControllerOptions
YurtAppDaemonController *YurtAppDaemonControllerOptions
IoTController *IoTControllerOptions
PlatformAdminController *PlatformAdminControllerOptions
}

// NewYurtManagerOptions creates a new YurtManagerOptions with a default config.
Expand All @@ -44,7 +44,7 @@ func NewYurtManagerOptions() (*YurtManagerOptions, error) {
YurtStaticSetController: NewYurtStaticSetControllerOptions(),
YurtAppSetController: NewYurtAppSetControllerOptions(),
YurtAppDaemonController: NewYurtAppDaemonControllerOptions(),
IoTController: NewIoTControllerOptions(),
PlatformAdminController: NewPlatformAdminControllerOptions(),
}

return &s, nil
Expand All @@ -57,7 +57,7 @@ func (y *YurtManagerOptions) Flags() cliflag.NamedFlagSets {
y.GatewayController.AddFlags(fss.FlagSet("gateway controller"))
y.YurtStaticSetController.AddFlags(fss.FlagSet("yurtstaticset controller"))
y.YurtAppDaemonController.AddFlags(fss.FlagSet("yurtappdaemon controller"))
y.IoTController.AddFlags(fss.FlagSet("iot controller"))
y.PlatformAdminController.AddFlags(fss.FlagSet("iot controller"))
// Please Add Other controller flags @kadisi

return fss
Expand All @@ -71,7 +71,7 @@ func (y *YurtManagerOptions) Validate() error {
errs = append(errs, y.GatewayController.Validate()...)
errs = append(errs, y.YurtStaticSetController.Validate()...)
errs = append(errs, y.YurtAppDaemonController.Validate()...)
errs = append(errs, y.IoTController.Validate()...)
errs = append(errs, y.PlatformAdminController.Validate()...)
return utilerrors.NewAggregate(errs)
}

Expand All @@ -89,7 +89,7 @@ func (y *YurtManagerOptions) ApplyTo(c *config.Config) error {
if err := y.YurtAppDaemonController.ApplyTo(&c.ComponentConfig.YurtAppDaemonController); err != nil {
return err
}
if err := y.IoTController.ApplyTo(&c.ComponentConfig.IoTController); err != nil {
if err := y.PlatformAdminController.ApplyTo(&c.ComponentConfig.PlatformAdminController); err != nil {
return err
}
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,42 @@ import (

"github.com/spf13/pflag"

"github.com/openyurtio/openyurt/pkg/controller/iot/config"
"github.com/openyurtio/openyurt/pkg/controller/platformadmin/config"
)

type IoTControllerOptions struct {
*config.IoTControllerConfiguration
type PlatformAdminControllerOptions struct {
*config.PlatformAdminControllerConfiguration
}

func NewIoTControllerOptions() *IoTControllerOptions {
return &IoTControllerOptions{
config.NewIoTControllerConfiguration(),
func NewPlatformAdminControllerOptions() *PlatformAdminControllerOptions {
return &PlatformAdminControllerOptions{
config.NewPlatformAdminControllerConfiguration(),
}
}

// AddFlags adds flags related to nodepool for yurt-manager to the specified FlagSet.
func (n *IoTControllerOptions) AddFlags(fs *pflag.FlagSet) {
func (n *PlatformAdminControllerOptions) AddFlags(fs *pflag.FlagSet) {
if n == nil {
return
}
}

// ApplyTo fills up nodepool config with options.
func (o *IoTControllerOptions) ApplyTo(cfg *config.IoTControllerConfiguration) error {
func (o *PlatformAdminControllerOptions) ApplyTo(cfg *config.PlatformAdminControllerConfiguration) error {
if o == nil {
return nil
}
*cfg = *o.IoTControllerConfiguration
*cfg = *o.PlatformAdminControllerConfiguration
return nil
}

// Validate checks validation of IoTControllerOptions.
func (o *IoTControllerOptions) Validate() []error {
func (o *PlatformAdminControllerOptions) Validate() []error {
if o == nil {
return nil
}
errs := []error{}
if o.IoTControllerConfiguration == nil {
if o.PlatformAdminControllerConfiguration == nil {
errs = append(errs, errors.New("IoTControllerConfiguration can not be empty!"))
}
return errs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package apis

import (
version "github.com/openyurtio/openyurt/pkg/apis/device/v1alpha1"
version "github.com/openyurtio/openyurt/pkg/apis/iot/v1alpha1"
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package apis

import (
version "github.com/openyurtio/openyurt/pkg/apis/device/v1alpha2"
version "github.com/openyurtio/openyurt/pkg/apis/iot/v1alpha2"
)

func init() {
Expand Down
Loading

0 comments on commit 9aa902a

Please sign in to comment.